From ba0a7fb1643118167bff5ea27e009c5573a2f692 Mon Sep 17 00:00:00 2001 From: Dmytro Kyshchenko Date: Sun, 27 Aug 2023 22:53:18 +0300 Subject: [PATCH] #667 - Migrate to NUnit. --- Directory.Packages.props | 6 +- README.md | 2 +- .../DifferentiatorTests/DifferentiatorTest.cs | 588 +++++++------- .../DifferentiatorTests/NullArgumentTest.cs | 186 ++--- .../Formatters/CommonFormatterTest.cs | 734 +++++++++--------- .../SimplifierTests/AddSimplifierTest.cs | 108 +-- .../SimplifierTests/AngleSimplifierTest.cs | 30 +- .../SimplifierTests/BaseSimplifierTest.cs | 6 +- .../SimplifierTests/DivSimplifierTest.cs | 46 +- .../SimplifierTests/LogSimplifierTest.cs | 24 +- .../SimplifierTests/MulSimplifierTest.cs | 110 +-- .../SimplifierTests/PowerSimplifierTest.cs | 30 +- .../SimplifierTests/SimplifierTest.cs | 60 +- .../SimplifierTests/SubSimplifierTest.cs | 104 +-- .../SimplifierTests/ToNumberSimplifierTest.cs | 20 +- .../TrigonometricSimplifierTest.cs | 74 +- .../Analyzers/TypeAnalyzerTests/AbsTests.cs | 28 +- .../Analyzers/TypeAnalyzerTests/AddTests.cs | 118 +-- .../Analyzers/TypeAnalyzerTests/CeilTests.cs | 22 +- .../TypeAnalyzerTests/ComplexNumberTests.cs | 38 +- .../Analyzers/TypeAnalyzerTests/DivTests.cs | 52 +- .../Analyzers/TypeAnalyzerTests/FloorTests.cs | 22 +- .../Analyzers/TypeAnalyzerTests/FracTests.cs | 22 +- .../TypeAnalyzerTests/HyperbolicTests.cs | 106 +-- .../Analyzers/TypeAnalyzerTests/LogTests.cs | 42 +- .../TypeAnalyzerTests/LogicalBitwiseTests.cs | 72 +- .../TypeAnalyzerTests/LogicalTests.cs | 80 +- .../TypeAnalyzerTests/MatrixTests.cs | 56 +- .../Analyzers/TypeAnalyzerTests/MulTests.cs | 94 +-- .../NumericConvertionTests.cs | 24 +- .../Analyzers/TypeAnalyzerTests/PowTests.cs | 18 +- .../AssignmentOperatorsTests.cs | 42 +- .../ConditionalOperatorsTests.cs | 42 +- .../EqualityOperatorsTests.cs | 312 ++++---- .../ProgrammingTests/ProgrammingTest.cs | 24 +- .../RelationalOperatorsTests.cs | 330 ++++---- .../ProgrammingTests/ShiftOperatorsTests.cs | 42 +- .../Analyzers/TypeAnalyzerTests/RootTests.cs | 18 +- .../Analyzers/TypeAnalyzerTests/RoundTests.cs | 24 +- .../Analyzers/TypeAnalyzerTests/SignTests.cs | 22 +- .../TypeAnalyzerTests/StandardTests.cs | 138 ++-- .../TypeAnalyzerTests/StatisticalTests.cs | 110 +-- .../Analyzers/TypeAnalyzerTests/SubTests.cs | 116 +-- .../TypeAnalyzerTests/ToNumberTests.cs | 22 +- .../TypeAnalyzerTests/TrigonometricTests.cs | 120 +-- .../Analyzers/TypeAnalyzerTests/TruncTests.cs | 22 +- .../TypeAnalyzerBaseTests.cs | 6 +- .../TypeAnalyzerTests/UnaryMinusTests.cs | 26 +- xFunc.Tests/BuilderTest.cs | 248 +++--- xFunc.Tests/Expressions/AbsTest.cs | 58 +- xFunc.Tests/Expressions/AddTest.cs | 174 ++--- xFunc.Tests/Expressions/AssignTest.cs | 58 +- .../Expressions/BaseExpressionTests.cs | 2 +- xFunc.Tests/Expressions/BinaryTest.cs | 24 +- xFunc.Tests/Expressions/CallExpressionTest.cs | 66 +- xFunc.Tests/Expressions/CeilTest.cs | 42 +- .../ComplexNumbers/ComplexNumberTest.cs | 51 +- .../ComplexNumbers/ConjugateTest.cs | 10 +- .../Expressions/ComplexNumbers/ImTest.cs | 10 +- .../Expressions/ComplexNumbers/PhaseTest.cs | 10 +- .../Expressions/ComplexNumbers/ReTest.cs | 10 +- .../ComplexNumbers/ReciprocalTest.cs | 10 +- .../ComplexNumbers/ToComplexTest.cs | 10 +- xFunc.Tests/Expressions/DelTest.cs | 30 +- .../Expressions/DelegateExpressionTest.cs | 36 +- xFunc.Tests/Expressions/DerivativeTest.cs | 16 +- xFunc.Tests/Expressions/DivTest.cs | 74 +- .../Expressions/Domains/DomainBuilderTests.cs | 2 +- .../Expressions/Domains/DomainRangeTests.cs | 62 +- .../Expressions/Domains/DomainTests.cs | 46 +- xFunc.Tests/Expressions/ExpTest.cs | 14 +- xFunc.Tests/Expressions/FactTest.cs | 20 +- xFunc.Tests/Expressions/FloorTest.cs | 42 +- xFunc.Tests/Expressions/FracTest.cs | 78 +- xFunc.Tests/Expressions/GCDTest.cs | 32 +- .../Hyperbolic/HyperbolicArcosecantTest.cs | 16 +- .../Hyperbolic/HyperbolicArcosineTest.cs | 16 +- .../Hyperbolic/HyperbolicArcotangentTest.cs | 16 +- .../Hyperbolic/HyperbolicArsecantTest.cs | 16 +- .../Hyperbolic/HyperbolicArsineTest.cs | 16 +- .../Hyperbolic/HyperbolicArtangentTest.cs | 16 +- .../Hyperbolic/HyperbolicCosecantTest.cs | 28 +- .../Hyperbolic/HyperbolicCosineTest.cs | 28 +- .../Hyperbolic/HyperbolicCotangentTest.cs | 28 +- .../Hyperbolic/HyperbolicSecantTest.cs | 28 +- .../Hyperbolic/HyperbolicSineTest.cs | 28 +- .../Hyperbolic/HyperbolicTangentTest.cs | 28 +- xFunc.Tests/Expressions/LCMTest.cs | 20 +- .../Expressions/LambdaExpressionTest.cs | 60 +- xFunc.Tests/Expressions/LambdaTests.cs | 48 +- xFunc.Tests/Expressions/LbTest.cs | 14 +- xFunc.Tests/Expressions/LgTest.cs | 18 +- xFunc.Tests/Expressions/LnTest.cs | 18 +- xFunc.Tests/Expressions/LogTest.cs | 20 +- .../Expressions/LogicalAndBitwise/AndTest.cs | 22 +- .../Expressions/LogicalAndBitwise/BoolTest.cs | 65 +- .../LogicalAndBitwise/EqualityTest.cs | 14 +- .../LogicalAndBitwise/ImplicationTest.cs | 14 +- .../Expressions/LogicalAndBitwise/NAndTest.cs | 14 +- .../Expressions/LogicalAndBitwise/NOrTest.cs | 14 +- .../Expressions/LogicalAndBitwise/NotTest.cs | 16 +- .../Expressions/LogicalAndBitwise/OrTest.cs | 22 +- .../Expressions/LogicalAndBitwise/XOrTest.cs | 22 +- .../Expressions/Matrices/CrossProductTests.cs | 18 +- .../Expressions/Matrices/DeterminantTest.cs | 24 +- .../Expressions/Matrices/DotProductTests.cs | 16 +- .../Expressions/Matrices/InverseTest.cs | 12 +- .../Expressions/Matrices/MatrixTest.cs | 76 +- .../Expressions/Matrices/MatrixValueTests.cs | 44 +- .../Expressions/Matrices/TransposeTest.cs | 14 +- .../Expressions/Matrices/VectorTest.cs | 60 +- .../Expressions/Matrices/VectorValueTests.cs | 78 +- xFunc.Tests/Expressions/ModTest.cs | 20 +- xFunc.Tests/Expressions/MulTest.cs | 148 ++-- xFunc.Tests/Expressions/NumberTest.cs | 48 +- xFunc.Tests/Expressions/NumberValueTest.cs | 98 +-- .../Parameters/ExpressionParameterTest.cs | 287 +++---- .../Expressions/Parameters/ParameterTest.cs | 114 +-- .../Parameters/ParameterValueTest.cs | 16 +- xFunc.Tests/Expressions/PowTest.cs | 52 +- .../Expressions/Programming/AddAssignTest.cs | 36 +- .../Programming/ConditionalAndTest.cs | 14 +- .../Programming/ConditionalOrTest.cs | 10 +- .../Expressions/Programming/DecTest.cs | 38 +- .../Expressions/Programming/DivAssignTest.cs | 38 +- .../Expressions/Programming/EqualTest.cs | 70 +- .../Expressions/Programming/ForTest.cs | 8 +- .../Programming/GreaterOrEqualTest.cs | 50 +- .../Expressions/Programming/GreaterTest.cs | 46 +- xFunc.Tests/Expressions/Programming/IfTest.cs | 28 +- .../Expressions/Programming/IncTest.cs | 38 +- .../Programming/LeftShiftAssignTest.cs | 24 +- .../Expressions/Programming/LeftShiftTest.cs | 14 +- .../Programming/LessOrEqualTest.cs | 48 +- .../Expressions/Programming/LessThanTest.cs | 46 +- .../Expressions/Programming/MulAssignTest.cs | 38 +- .../Expressions/Programming/NotEqualTest.cs | 70 +- .../Programming/RightShiftAssignTest.cs | 24 +- .../Expressions/Programming/RightShiftTest.cs | 14 +- .../Expressions/Programming/SubAssignTest.cs | 38 +- .../Expressions/Programming/WhileTest.cs | 14 +- xFunc.Tests/Expressions/RationalTest.cs | 12 +- xFunc.Tests/Expressions/RationalValueTests.cs | 210 ++--- xFunc.Tests/Expressions/RootTest.cs | 24 +- xFunc.Tests/Expressions/RoundTest.cs | 50 +- xFunc.Tests/Expressions/SignTest.cs | 46 +- xFunc.Tests/Expressions/SimplifyTest.cs | 14 +- xFunc.Tests/Expressions/SqrtTest.cs | 26 +- .../Expressions/Statistical/AvgTest.cs | 18 +- .../Expressions/Statistical/CountTest.cs | 14 +- .../Expressions/Statistical/MaxTest.cs | 18 +- .../Expressions/Statistical/MinTest.cs | 18 +- .../Expressions/Statistical/ProductTest.cs | 14 +- .../Statistical/StatisticalTests.cs | 72 +- .../Expressions/Statistical/StdevTest.cs | 16 +- .../Expressions/Statistical/StdevpTest.cs | 16 +- .../Expressions/Statistical/SumTest.cs | 14 +- .../Expressions/Statistical/VarTest.cs | 16 +- .../Expressions/Statistical/VarpTest.cs | 18 +- .../Expressions/StringExpressionTests.cs | 48 +- xFunc.Tests/Expressions/SubTest.cs | 150 ++-- xFunc.Tests/Expressions/ToBinTest.cs | 28 +- xFunc.Tests/Expressions/ToHexTest.cs | 28 +- xFunc.Tests/Expressions/ToNumberTest.cs | 46 +- xFunc.Tests/Expressions/ToOctTest.cs | 20 +- xFunc.Tests/Expressions/ToRationalTest.cs | 10 +- .../Expressions/Trigonometric/ArccosTest.cs | 16 +- .../Expressions/Trigonometric/ArccotTest.cs | 16 +- .../Expressions/Trigonometric/ArccscTest.cs | 16 +- .../Expressions/Trigonometric/ArcsecTest.cs | 16 +- .../Expressions/Trigonometric/ArcsinTest.cs | 16 +- .../Expressions/Trigonometric/ArctanTest.cs | 16 +- .../Expressions/Trigonometric/CosecantTest.cs | 68 +- .../Expressions/Trigonometric/CosineTest.cs | 68 +- .../Trigonometric/CotangentTest.cs | 68 +- .../Expressions/Trigonometric/SecantTest.cs | 68 +- .../Expressions/Trigonometric/SineTest.cs | 68 +- .../Expressions/Trigonometric/TangentTest.cs | 68 +- xFunc.Tests/Expressions/TruncTest.cs | 42 +- xFunc.Tests/Expressions/UnaryMinusTest.cs | 54 +- xFunc.Tests/Expressions/UnaryTest.cs | 14 +- xFunc.Tests/Expressions/UnassignTest.cs | 40 +- .../Expressions/Units/AngleUnits/AngleTest.cs | 32 +- .../Units/AngleUnits/AngleUnitTest.cs | 44 +- .../Units/AngleUnits/AngleValueTest.cs | 120 +-- .../Units/AngleUnits/ToDegreeTest.cs | 18 +- .../Units/AngleUnits/ToGradianTest.cs | 18 +- .../Units/AngleUnits/ToRadianTest.cs | 18 +- .../Expressions/Units/AreaUnits/AreaTest.cs | 32 +- .../Units/AreaUnits/AreaUnitTest.cs | 56 +- .../Units/AreaUnits/AreaValueTest.cs | 84 +- xFunc.Tests/Expressions/Units/ConvertTests.cs | 46 +- .../Units/Converters/AngleConverterTests.cs | 18 +- .../Units/Converters/AreaConverterTests.cs | 20 +- .../Units/Converters/ConverterTests.cs | 14 +- .../Units/Converters/LengthConverterTests.cs | 20 +- .../Units/Converters/MassConverterTests.cs | 20 +- .../Units/Converters/PowerConverterTests.cs | 18 +- .../Converters/TemperatureConverterTests.cs | 18 +- .../Units/Converters/TimeConverterTests.cs | 20 +- .../Units/Converters/VolumeConverterTests.cs | 20 +- .../Units/LengthUnits/LengthTest.cs | 32 +- .../Units/LengthUnits/LengthUnitTest.cs | 48 +- .../Units/LengthUnits/LengthValueTest.cs | 160 ++-- .../Expressions/Units/MassUnits/MassTest.cs | 32 +- .../Units/MassUnits/MassUnitTest.cs | 36 +- .../Units/MassUnits/MassValueTest.cs | 104 +-- .../Expressions/Units/PowerUnits/PowerTest.cs | 32 +- .../Units/PowerUnits/PowerUnitTests.cs | 32 +- .../Units/PowerUnits/PowerValueTest.cs | 84 +- .../Units/TemperatureUnits/TemperatureTest.cs | 32 +- .../TemperatureUnits/TemperatureUnitTests.cs | 32 +- .../TemperatureUnits/TemperatureValueTest.cs | 92 +-- .../Expressions/Units/TimeUnits/TimeTest.cs | 32 +- .../Units/TimeUnits/TimeUnitTest.cs | 36 +- .../Units/TimeUnits/TimeValueTest.cs | 116 +-- .../Units/VolumeUnits/VolumeTest.cs | 32 +- .../Units/VolumeUnits/VolumeUnitTest.cs | 44 +- .../Units/VolumeUnits/VolumeValueTest.cs | 84 +- xFunc.Tests/Expressions/VariableTest.cs | 61 +- xFunc.Tests/ParserTests/AngleTests.cs | 46 +- xFunc.Tests/ParserTests/AreaUnitTests.cs | 22 +- xFunc.Tests/ParserTests/AssignTests.cs | 116 +-- xFunc.Tests/ParserTests/BaseParserTests.cs | 2 +- xFunc.Tests/ParserTests/ComplexNumberTests.cs | 62 +- .../ParserTests/ConditionalOperatorTests.cs | 12 +- .../ParserTests/EqualityOperatorTests.cs | 6 +- xFunc.Tests/ParserTests/ForTests.cs | 24 +- xFunc.Tests/ParserTests/GCDTests.cs | 20 +- xFunc.Tests/ParserTests/HyperbolicTests.cs | 28 +- xFunc.Tests/ParserTests/IfTests.cs | 34 +- xFunc.Tests/ParserTests/LambdaTests.cs | 42 +- xFunc.Tests/ParserTests/LengthUnitTests.cs | 34 +- xFunc.Tests/ParserTests/LogTests.cs | 14 +- .../ParserTests/LogicalOperatorTests.cs | 32 +- xFunc.Tests/ParserTests/MassUnitTests.cs | 12 +- .../NotBalancedParenthesisTests.cs | 16 +- xFunc.Tests/ParserTests/NumberTests.cs | 26 +- xFunc.Tests/ParserTests/ParserTest.cs | 316 ++++---- xFunc.Tests/ParserTests/PowerTests.cs | 24 +- xFunc.Tests/ParserTests/PowerUnitTests.cs | 6 +- .../ParserTests/RelationalOperatorTests.cs | 10 +- .../ParserTests/ReverseHyperbolicTests.cs | 32 +- .../ParserTests/ReverseTrigonometricTests.cs | 24 +- xFunc.Tests/ParserTests/StringTests.cs | 28 +- .../ParserTests/TemperatureUnitTests.cs | 6 +- xFunc.Tests/ParserTests/TimeUnitTests.cs | 18 +- xFunc.Tests/ParserTests/TrigonometricTests.cs | 24 +- xFunc.Tests/ParserTests/UnassignTests.cs | 10 +- xFunc.Tests/ParserTests/UnitTests.cs | 6 +- xFunc.Tests/ParserTests/VolumeUnitTests.cs | 16 +- xFunc.Tests/ParserTests/WhileTests.cs | 14 +- xFunc.Tests/ProcessorTest.cs | 140 ++-- xFunc.Tests/Results/AngleNumberResultTest.cs | 12 +- xFunc.Tests/Results/AreaNumberResultTest.cs | 12 +- xFunc.Tests/Results/BooleanResultTest.cs | 8 +- .../Results/ComplexNumberResultTest.cs | 40 +- xFunc.Tests/Results/LambdaResultTest.cs | 12 +- xFunc.Tests/Results/LengthNumberResultTest.cs | 12 +- xFunc.Tests/Results/MassNumberResultTest.cs | 12 +- xFunc.Tests/Results/MatrixValueResultTest.cs | 12 +- xFunc.Tests/Results/NumberResultTest.cs | 12 +- xFunc.Tests/Results/PowerNumberResultTest.cs | 12 +- .../Results/RationalValueResultTest.cs | 12 +- xFunc.Tests/Results/StringResultTest.cs | 18 +- .../Results/TemperatureNumberResultTest.cs | 12 +- xFunc.Tests/Results/TimeNumberResultTest.cs | 12 +- xFunc.Tests/Results/VectorValueResultTest.cs | 12 +- xFunc.Tests/Results/VolumeNumberResultTest.cs | 12 +- xFunc.Tests/xFunc.Tests.csproj | 11 +- 270 files changed, 6443 insertions(+), 6438 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f0264e296..6f28a4337 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,6 +3,9 @@ + + + @@ -10,8 +13,5 @@ - - - \ No newline at end of file diff --git a/README.md b/README.md index 401ec0128..bc9e7264c 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ xFunc is released under MIT License. [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) [Coverlet](https://github.com/coverlet-coverage/coverlet) [ReportGenerator](https://github.com/danielpalme/ReportGenerator) -[xUnit](https://github.com/xunit/xunit) +[NUnit](https://github.com/nunit/nunit) [NSubstitute](https://github.com/nsubstitute/NSubstitute) [docfx](https://github.com/dotnet/docfx) [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) diff --git a/xFunc.Tests/Analyzers/DifferentiatorTests/DifferentiatorTest.cs b/xFunc.Tests/Analyzers/DifferentiatorTests/DifferentiatorTest.cs index ea534ab06..bc0a83314 100644 --- a/xFunc.Tests/Analyzers/DifferentiatorTests/DifferentiatorTest.cs +++ b/xFunc.Tests/Analyzers/DifferentiatorTests/DifferentiatorTest.cs @@ -26,85 +26,85 @@ private IExpression Differentiate(IExpression exp, Variable variable, Expression #region Common - [Fact] + [Test] public void NumberTest() { var exp = Differentiate(new Number(10)); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void AngleNumberTest() { var exp = Differentiate(new Angle(AngleValue.Degree(10))); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void PowerNumberTest() { var exp = Differentiate(new Power(PowerValue.Watt(10))); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void TemperatureNumberTest() { var exp = Differentiate(TemperatureValue.Celsius(10).AsExpression()); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void MassNumberTest() { var exp = Differentiate(MassValue.Kilogram(10).AsExpression()); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void LengthNumberTest() { var exp = Differentiate(LengthValue.Kilometer(10).AsExpression()); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void TimeNumberTest() { var exp = Differentiate(TimeValue.Second(10).AsExpression()); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void AreaNumberTest() { var exp = Differentiate(AreaValue.Meter(10).AsExpression()); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void VolumeNumberTest() { var exp = Differentiate(VolumeValue.Meter(10).AsExpression()); - Assert.Equal(zero, exp); + Assert.That(exp, Is.EqualTo(zero)); } - [Fact] + [Test] public void VariableNullTest() { Assert.Throws(() => Differentiate(new Number(10), null)); } - [Fact] + [Test] public void AbsDerivativeTest1() { var exp = Differentiate(new Abs(Variable.X)); @@ -113,10 +113,10 @@ public void AbsDerivativeTest1() new Div(Variable.X, new Abs(Variable.X)) ); - Assert.Equal(expected, exp); + Assert.That(exp, Is.EqualTo(expected)); } - [Fact] + [Test] public void AbsPartialDerivativeTest1() { var exp = new Abs(new Mul(Variable.X, Variable.Y)); @@ -129,10 +129,10 @@ public void AbsPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void AbsPartialDerivativeTest2() { var exp = new Abs(new Mul(Variable.X, Variable.Y)); @@ -145,28 +145,28 @@ public void AbsPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void AbsPartialDerivativeTest3() { var deriv = Differentiate(new Abs(Variable.X), Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void AddDerivativeTest1() { var exp = new Add(new Mul(Number.Two, Variable.X), new Number(3)); var deriv = Differentiate(exp); var expected = new Mul(Number.Two, Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddDerivativeTest2() { var exp = new Add( @@ -179,10 +179,10 @@ public void AddDerivativeTest2() new Mul(new Number(3), Number.One) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddPartialDerivativeTest1() { var exp = new Add( @@ -192,10 +192,10 @@ public void AddPartialDerivativeTest1() var deriv = Differentiate(exp); var expected = new Add(new Mul(Number.One, Variable.Y), Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddPartialDerivativeTest2() { var exp = new Add( @@ -205,19 +205,19 @@ public void AddPartialDerivativeTest2() var deriv = Differentiate(exp, Variable.Y); var expected = new Add(new Mul(Variable.X, Number.One), Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddPartialDerivativeTest3() { var exp = new Add(Variable.X, Number.One); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void DivDerivativeTest1() { var exp = new Div(Number.One, Variable.X); @@ -227,10 +227,10 @@ public void DivDerivativeTest1() new Pow(Variable.X, Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivDerivativeTest2() { // sin(x) / x @@ -244,10 +244,10 @@ public void DivDerivativeTest2() new Pow(Variable.X, Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivPartialDerivativeTest1() { // (y + x ^ 2) / x @@ -275,10 +275,10 @@ public void DivPartialDerivativeTest1() new Pow(Variable.X, Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivPartialDerivativeTest2() { var exp = new Div(Variable.Y, Variable.X); @@ -288,40 +288,40 @@ public void DivPartialDerivativeTest2() new Pow(Variable.X, Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivPartialDerivativeTest3() { var exp = new Div(Variable.Y, Variable.X); var deriv = Differentiate(exp, Variable.Y); var expected = new Div(Number.One, Variable.X); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivPartialDerivativeTest4() { // (x + 1) / x var exp = new Div(new Add(Variable.X, Number.One), Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ExpDerivativeTest1() { var exp = new Exp(Variable.X); var deriv = Differentiate(exp); var expected = new Mul(Number.One, new Exp(Variable.X)); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExpDerivativeTest2() { var exp = new Exp(new Mul(Number.Two, Variable.X)); @@ -331,10 +331,10 @@ public void ExpDerivativeTest2() new Exp(new Mul(Number.Two, Variable.X)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExpPartialDerivativeTest1() { var exp = new Exp(new Mul(Variable.X, Variable.Y)); @@ -344,10 +344,10 @@ public void ExpPartialDerivativeTest1() new Exp(new Mul(Variable.X, Variable.Y)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExpPartialDerivativeTest2() { var exp = new Exp(new Mul(Variable.X, Variable.Y)); @@ -357,19 +357,19 @@ public void ExpPartialDerivativeTest2() new Exp(new Mul(Variable.X, Variable.Y)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExpPartialDerivativeTest3() { var exp = new Exp(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void LnDerivativeTest1() { var exp = new Ln(new Mul(Number.Two, Variable.X)); @@ -379,10 +379,10 @@ public void LnDerivativeTest1() new Mul(Number.Two, Variable.X) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LnPartialDerivativeTest1() { // ln(xy) @@ -393,10 +393,10 @@ public void LnPartialDerivativeTest1() new Mul(Variable.X, Variable.Y) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LnPartialDerivativeTest2() { // ln(xy) @@ -407,19 +407,19 @@ public void LnPartialDerivativeTest2() new Mul(Variable.X, Variable.Y) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LnPartialDerivativeTest3() { var exp = new Ln(Variable.Y); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void LgDerivativeTest1() { var exp = new Lg(new Mul(Number.Two, Variable.X)); @@ -429,10 +429,10 @@ public void LgDerivativeTest1() new Mul(new Mul(Number.Two, Variable.X), new Ln(new Number(10))) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LgPartialDerivativeTest1() { // lg(2xy) @@ -446,20 +446,20 @@ public void LgPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LgPartialDerivativeTest2() { // lg(2xy) var exp = new Lg(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void LbDerivativeTest1() { var exp = new Lb(new Mul(Number.Two, Variable.X)); @@ -469,10 +469,10 @@ public void LbDerivativeTest1() new Mul(new Mul(Number.Two, Variable.X), new Ln(Number.Two)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LbPartialDerivativeTest1() { // lb(2xy) @@ -486,30 +486,30 @@ public void LbPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LbPartialDerivativeTest2() { // lb(2xy) var exp = new Lb(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void LogDerivativeTest1() { var exp = new Log(Number.Two, Variable.X); var deriv = Differentiate(exp); var expected = new Div(Number.One, new Mul(Variable.X, new Ln(Number.Two))); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LogDerivativeTest3() { var exp = new Log(Variable.X, Number.Two); @@ -521,10 +521,10 @@ public void LogDerivativeTest3() new Pow(new Ln(Variable.X), Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LogPartialDerivativeTest1() { var exp = new Log(Number.Two, Variable.X); @@ -534,29 +534,29 @@ public void LogPartialDerivativeTest1() new Mul(Variable.X, new Ln(Number.Two)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void LogPartialDerivativeTest2() { var exp = new Log(Number.Two, Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void MulDerivativeTest1() { var exp = new Mul(Number.Two, Variable.X); var deriv = Differentiate(exp); var expected = new Mul(Number.Two, Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulPartialDerivativeTest1() { // (x + 1) * (y + x) @@ -570,10 +570,10 @@ public void MulPartialDerivativeTest1() new Mul(new Add(Variable.X, Number.One), Number.One) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulPartialDerivativeTest2() { // (y + 1) * (3 + x) @@ -584,10 +584,10 @@ public void MulPartialDerivativeTest2() var deriv = Differentiate(exp, Variable.Y); var expected = new Mul(Number.One, new Add(new Number(3), Variable.X)); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulPartialDerivativeTest3() { // (x + 1) * (y + x) @@ -598,10 +598,10 @@ public void MulPartialDerivativeTest3() var deriv = Differentiate(exp, Variable.Y); var expected = new Mul(new Add(Variable.X, Number.One), Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulPartialDerivativeTest4() { // (x + 1) * (3 + x) @@ -611,10 +611,10 @@ public void MulPartialDerivativeTest4() ); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact(DisplayName = "x ^ 3")] + [Test] public void PowDerivativeTest1() { var exp = new Pow(Variable.X, new Number(3)); @@ -624,10 +624,10 @@ public void PowDerivativeTest1() new Mul(new Number(3), new Pow(Variable.X, new Sub(new Number(3), Number.One))) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact(DisplayName = "2 ^ (3x)")] + [Test] public void PowDerivativeTest2() { var exp = new Pow(Number.Two, new Mul(new Number(3), Variable.X)); @@ -640,10 +640,10 @@ public void PowDerivativeTest2() new Mul(new Number(3), Number.One) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact(DisplayName = "x ^ x")] + [Test] public void PowXbyX() { var exp = new Pow(Variable.X, Variable.X); @@ -655,10 +655,10 @@ public void PowXbyX() new Mul(Variable.X, new Div(Number.One, Variable.X))) ); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact(DisplayName = "x ^ 2x")] + [Test] public void PowXby2X() { var exp = new Pow(Variable.X, new Mul(Number.Two, Variable.X)); @@ -670,10 +670,10 @@ public void PowXby2X() new Mul(new Mul(Number.Two, Variable.X), new Div(Number.One, Variable.X))) ); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact(DisplayName = "x ^ sin(x)")] + [Test] public void PowXbySinX() { var exp = new Pow(Variable.X, new Sin(Variable.X)); @@ -686,10 +686,10 @@ public void PowXbySinX() ) ); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void PowPartialDerivativeTest1() { // (yx) ^ 3 @@ -706,10 +706,10 @@ public void PowPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void PowPartialDerivativeTest2() { // (yx) ^ 3 @@ -726,19 +726,19 @@ public void PowPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void PowPartialDerivativeTest3() { var exp = new Pow(Variable.X, new Number(3)); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void RootDerivativeTest1() { var exp = new Root(Variable.X, new Number(3)); @@ -754,10 +754,10 @@ public void RootDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void RootPartialDerivativeTest1() { var exp = new Root(new Mul(Variable.X, Variable.Y), new Number(3)); @@ -773,19 +773,19 @@ public void RootPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void RootPartialDerivativeTest2() { var exp = new Root(Variable.Y, new Number(3)); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void SqrtDerivativeTest1() { var exp = new Sqrt(new Mul(Number.Two, Variable.X)); @@ -795,10 +795,10 @@ public void SqrtDerivativeTest1() new Mul(Number.Two, new Sqrt(new Mul(Number.Two, Variable.X))) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SqrtPartialDerivativeTest1() { // sqrt(2xy) @@ -816,19 +816,19 @@ public void SqrtPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SqrtPartialDerivativeTest2() { var exp = new Sqrt(Variable.Y); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void SubDerivativeTest1() { // x - sin(x) @@ -839,100 +839,100 @@ public void SubDerivativeTest1() new Mul(new Cos(Variable.X), Number.One) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubPartialDerivativeTest1() { var exp = new Sub(new Mul(Variable.X, Variable.Y), Variable.Y); var deriv = Differentiate(exp, Variable.Y); var expected = new Sub(new Mul(Variable.X, Number.One), Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubPartialDerivativeTest2() { var exp = new Sub(Variable.X, Variable.Y); var deriv = Differentiate(exp); - Assert.Equal(Number.One, deriv); + Assert.That(deriv, Is.EqualTo(Number.One)); } - [Fact] + [Test] public void SubPartialDerivativeTest3() { var exp = new Sub(Variable.X, Variable.Y); var deriv = Differentiate(exp, Variable.Y); var expected = new UnaryMinus(Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubPartialDerivativeTest4() { var exp = new Sub(Variable.X, Number.One); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void UnaryMinusTest() { var exp = new UnaryMinus(new Sin(Variable.X)); var deriv = Differentiate(exp); var expected = new UnaryMinus(new Mul(new Cos(Variable.X), Number.One)); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void UnaryMinusTest2() { var exp = new UnaryMinus(new Sin(new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void DiffVarTest() { var exp = new Mul(Variable.X, Variable.Y); var deriv = Differentiate(exp); var expected = new Mul(Number.One, Variable.Y); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void VarTest() { var exp = Variable.Y; var deriv = Differentiate(exp); - Assert.Equal(Variable.Y, deriv); + Assert.That(deriv, Is.EqualTo(Variable.Y)); } #endregion Common #region Trigonometric - [Fact] + [Test] public void SinDerivativeTest1() { var exp = new Sin(Variable.X); var deriv = Differentiate(exp); var expected = new Mul(new Cos(Variable.X), Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SinDerivativeTest2() { var exp = new Sin(new Mul(Number.Two, Variable.X)); @@ -942,10 +942,10 @@ public void SinDerivativeTest2() new Mul(Number.Two, Number.One) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SinPartialDerivativeTest1() { var exp = new Sin(new Mul(Variable.X, Variable.Y)); @@ -955,10 +955,10 @@ public void SinPartialDerivativeTest1() new Mul(Number.One, Variable.Y) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SinPartialDerivativeTest2() { var exp = new Sin(new Mul(Variable.X, Variable.Y)); @@ -968,29 +968,29 @@ public void SinPartialDerivativeTest2() new Mul(Variable.X, Number.One) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SinPartialDerivativeTest3() { var exp = new Sin(Variable.Y); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void CosDerivativeTest1() { var exp = new Cos(Variable.X); var deriv = Differentiate(exp); var expected = new UnaryMinus(new Mul(new Sin(Variable.X), Number.One)); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CosDerivativeTest2() { var exp = new Cos(new Mul(Number.Two, Variable.X)); @@ -1002,10 +1002,10 @@ public void CosDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CosPartialDerivativeTest1() { var exp = new Cos(new Mul(Variable.X, Variable.Y)); @@ -1017,10 +1017,10 @@ public void CosPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CosPartialDerivativeTest2() { var exp = new Cos(new Mul(Variable.X, Variable.Y)); @@ -1032,29 +1032,29 @@ public void CosPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CosPartialDerivativeTest3() { var exp = new Cos(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void TanDerivativeTest1() { var exp = new Tan(Variable.X); var deriv = Differentiate(exp); var expected = new Div(Number.One, new Pow(new Cos(Variable.X), Number.Two)); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void TanDerivativeTest2() { var exp = new Tan(new Mul(Number.Two, Variable.X)); @@ -1064,10 +1064,10 @@ public void TanDerivativeTest2() new Pow(new Cos(new Mul(Number.Two, Variable.X)), Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void TanPartialDerivativeTest1() { var exp = new Tan(new Mul(Variable.X, Variable.Y)); @@ -1077,10 +1077,10 @@ public void TanPartialDerivativeTest1() new Pow(new Cos(new Mul(Variable.X, Variable.Y)), Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void TanPartialDerivativeTest2() { var exp = new Tan(new Mul(Variable.X, Variable.Y)); @@ -1090,19 +1090,19 @@ public void TanPartialDerivativeTest2() new Pow(new Cos(new Mul(Variable.X, Variable.Y)), Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void TanPartialDerivativeTest3() { var exp = new Tan(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void CotDerivativeTest1() { var exp = new Cot(Variable.X); @@ -1111,10 +1111,10 @@ public void CotDerivativeTest1() new Div(Number.One, new Pow(new Sin(Variable.X), Number.Two)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CotDerivativeTest2() { var exp = new Cot(new Mul(Number.Two, Variable.X)); @@ -1126,10 +1126,10 @@ public void CotDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CotPartialDerivativeTest1() { var exp = new Cot(new Mul(Variable.X, Variable.Y)); @@ -1141,10 +1141,10 @@ public void CotPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CotPartialDerivativeTest2() { var exp = new Cot(new Mul(Variable.X, Variable.Y)); @@ -1156,19 +1156,19 @@ public void CotPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CotPartialDerivativeTest3() { var exp = new Cot(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void SecDerivativeTest1() { var exp = new Sec(new Mul(Number.Two, Variable.X)); @@ -1181,19 +1181,19 @@ public void SecDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SecDerivativeZeroTest() { var exp = new Sec(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void CscDerivativeTest() { var exp = new Csc(new Mul(Number.Two, Variable.X)); @@ -1206,10 +1206,10 @@ public void CscDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcsinDerivativeTest1() { var exp = new Arcsin(Variable.X); @@ -1219,10 +1219,10 @@ public void ArcsinDerivativeTest1() new Sqrt(new Sub(Number.One, new Pow(Variable.X, Number.Two))) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcsinDerivativeTest2() { var exp = new Arcsin(new Mul(Number.Two, Variable.X)); @@ -1237,10 +1237,10 @@ public void ArcsinDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcsinPartialDerivativeTest1() { var exp = new Arcsin(new Mul(Variable.X, Variable.Y)); @@ -1255,10 +1255,10 @@ public void ArcsinPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcsinPartialDerivativeTest2() { var exp = new Arcsin(new Mul(Variable.X, Variable.Y)); @@ -1273,19 +1273,19 @@ public void ArcsinPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcsinPartialDerivativeTest3() { var exp = new Arcsin(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArccosDerivativeTest1() { var exp = new Arccos(Variable.X); @@ -1297,10 +1297,10 @@ public void ArccosDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccosDerivativeTest2() { var exp = new Arccos(new Mul(Number.Two, Variable.X)); @@ -1317,10 +1317,10 @@ public void ArccosDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccosPartialDerivativeTest1() { var exp = new Arccos(new Mul(Variable.X, Variable.Y)); @@ -1337,10 +1337,10 @@ public void ArccosPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccosPartialDerivativeTest2() { var exp = new Arccos(new Mul(Variable.X, Variable.Y)); @@ -1356,19 +1356,19 @@ public void ArccosPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccosPartialDerivativeTest3() { var exp = new Arccos(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArctanDerivativeTest1() { var exp = new Arctan(Variable.X); @@ -1378,10 +1378,10 @@ public void ArctanDerivativeTest1() new Add(Number.One, new Pow(Variable.X, Number.Two)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArctanDerivativeTest2() { var exp = new Arctan(new Mul(Number.Two, Variable.X)); @@ -1394,10 +1394,10 @@ public void ArctanDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArctanPartialDerivativeTest1() { var exp = new Arctan(new Mul(Variable.X, Variable.Y)); @@ -1410,10 +1410,10 @@ public void ArctanPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArctanPartialDerivativeTest2() { var exp = new Arctan(new Mul(Variable.X, Variable.Y)); @@ -1426,19 +1426,19 @@ public void ArctanPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArctanPartialDerivativeTest3() { var exp = new Arctan(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArccotDerivativeTest1() { var exp = new Arccot(Variable.X); @@ -1450,10 +1450,10 @@ public void ArccotDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccotDerivativeTest2() { var exp = new Arccot(new Mul(Number.Two, Variable.X)); @@ -1468,10 +1468,10 @@ public void ArccotDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccotPartialDerivativeTest1() { var exp = new Arccot(new Mul(Variable.X, Variable.Y)); @@ -1484,10 +1484,10 @@ public void ArccotPartialDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccotPartialDerivativeTest2() { var exp = new Arccot(new Mul(Variable.X, Variable.Y)); @@ -1502,19 +1502,19 @@ public void ArccotPartialDerivativeTest2() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccotPartialDerivativeTest3() { var exp = new Arccot(Variable.X); var deriv = Differentiate(exp, Variable.Y); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArcsecDerivativeTest1() { var exp = new Arcsec(new Mul(Number.Two, Variable.X)); @@ -1532,19 +1532,19 @@ public void ArcsecDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcsecDerivativeZeroTest() { var exp = new Arcsec(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArccscDerivativeTest1() { var exp = new Arccsc(new Mul(Number.Two, Variable.X)); @@ -1563,23 +1563,23 @@ public void ArccscDerivativeTest1() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArccscDerivativeZeroTest() { var exp = new Arccsc(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } #endregion Trigonometric #region Hyperbolic - [Fact] + [Test] public void SinhDerivativeTest() { var exp = new Sinh(new Mul(Number.Two, Variable.X)); @@ -1589,19 +1589,19 @@ public void SinhDerivativeTest() new Cosh(new Mul(Number.Two, Variable.X)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SinhDerivativeZeroTest() { var exp = new Sinh(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void CoshDerivativeTest() { var exp = new Cosh(new Mul(Number.Two, Variable.X)); @@ -1611,19 +1611,19 @@ public void CoshDerivativeTest() new Sinh(new Mul(Number.Two, Variable.X)) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CoshDerivativeZeroTest() { var exp = new Cosh(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void TanhDerivativeTest() { var exp = new Tanh(new Mul(Number.Two, Variable.X)); @@ -1633,19 +1633,19 @@ public void TanhDerivativeTest() new Pow(new Cosh(new Mul(Number.Two, Variable.X)), Number.Two) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void TanhDerivativeZeroTest() { var exp = new Tanh(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void CothDerivativeTest() { var exp = new Coth(new Mul(Number.Two, Variable.X)); @@ -1657,19 +1657,19 @@ public void CothDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CothDerivativeZeroTest() { var exp = new Coth(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void SechDerivativeTest() { var exp = new Sech(new Mul(Number.Two, Variable.X)); @@ -1684,19 +1684,19 @@ public void SechDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void SechDerivativeZeroTest() { var exp = new Sech(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void CschDerivativeTest() { var exp = new Csch(new Mul(Number.Two, Variable.X)); @@ -1711,19 +1711,19 @@ public void CschDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void CschDerivativeZeroTest() { var exp = new Csch(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArsinehDerivativeTest() { var exp = new Arsinh(new Mul(Number.Two, Variable.X)); @@ -1738,19 +1738,19 @@ public void ArsinehDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArsinehDerivativeZeroTest() { var exp = new Arsinh(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArcoshDerivativeTest() { var exp = new Arcosh(new Mul(Number.Two, Variable.X)); @@ -1765,19 +1765,19 @@ public void ArcoshDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcoshDerivativeZeroTest() { var exp = new Arcosh(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArtanhDerivativeTest() { var exp = new Artanh(new Mul(Number.Two, Variable.X)); @@ -1790,19 +1790,19 @@ public void ArtanhDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArtanhDerivativeZeroTest() { var exp = new Artanh(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArcothDerivativeTest() { var exp = new Arcoth(new Mul(Number.Two, Variable.X)); @@ -1815,19 +1815,19 @@ public void ArcothDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcothDerivativeZeroTest() { var exp = new Arcoth(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void ArsechDerivativeTest() { var exp = new Arsech(new Mul(Number.Two, Variable.X)); @@ -1847,10 +1847,10 @@ public void ArsechDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcschDerivativeTest() { var exp = new Arcsch(new Mul(Number.Two, Variable.X)); @@ -1870,21 +1870,21 @@ public void ArcschDerivativeTest() ) ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void ArcschDerivativeZeroTest() { var exp = new Arcsch(new Mul(Number.Two, new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } #endregion Hyperbolic - [Fact] + [Test] public void DerivSimplify() { var simp = new Simplifier(); @@ -1892,20 +1892,20 @@ public void DerivSimplify() var deriv = Differentiate(exp); var expected = new Mul(new Cos(Variable.X), Number.One); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DerivSimplify2() { var simp = new Simplifier(); var exp = new Simplify(simp, new Sin(new Variable("z"))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void DoubleDiffTest() { var diff = new Differentiator(); @@ -1925,10 +1925,10 @@ public void DoubleDiffTest() new UnaryMinus(new Mul(new Sin(Variable.X), Number.One)), Number.One ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void DoubleDiffNoVarTest() { var diff = new Differentiator(); @@ -1937,10 +1937,10 @@ public void DoubleDiffNoVarTest() var exp = new Derivative(diff, simp, new Derivative(diff, simp, new Sin(Number.One))); var deriv = Differentiate(exp); - Assert.Equal(zero, deriv); + Assert.That(deriv, Is.EqualTo(zero)); } - [Fact] + [Test] public void TripleDiffTest() { var diff = new Differentiator(); @@ -1967,10 +1967,10 @@ public void TripleDiffTest() Number.One ); - Assert.Equal(expected, deriv); + Assert.That(deriv, Is.EqualTo(expected)); } - [Fact] + [Test] public void NotSupportedTest() { Assert.Throws(() => Differentiate(new Fact(Variable.X))); diff --git a/xFunc.Tests/Analyzers/DifferentiatorTests/NullArgumentTest.cs b/xFunc.Tests/Analyzers/DifferentiatorTests/NullArgumentTest.cs index 0e23bed51..6f59c1d26 100644 --- a/xFunc.Tests/Analyzers/DifferentiatorTests/NullArgumentTest.cs +++ b/xFunc.Tests/Analyzers/DifferentiatorTests/NullArgumentTest.cs @@ -3,7 +3,7 @@ using System.Collections.Immutable; using System.Reflection; -using Xunit.Sdk; +using NUnit.Framework.Internal; namespace xFunc.Tests.Analyzers.DifferentiatorTests; @@ -31,88 +31,88 @@ private void TestNullExp(Type type, object exp = null) throw; } - throw new XunitException("The exception is expected."); + throw new NUnitException("The exception is expected."); } - [Theory] - [InlineData(typeof(Abs))] - [InlineData(typeof(Add))] - [InlineData(typeof(Derivative))] - [InlineData(typeof(Div))] - [InlineData(typeof(Exp))] - [InlineData(typeof(Lb))] - [InlineData(typeof(Lg))] - [InlineData(typeof(Ln))] - [InlineData(typeof(Log))] - [InlineData(typeof(Mul))] - [InlineData(typeof(Number))] - [InlineData(typeof(Angle))] - [InlineData(typeof(Pow))] - [InlineData(typeof(Root))] - [InlineData(typeof(Simplify))] - [InlineData(typeof(Sqrt))] - [InlineData(typeof(Sub))] - [InlineData(typeof(UnaryMinus))] - [InlineData(typeof(Variable))] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arctan))] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] - [InlineData(typeof(Arcosh))] - [InlineData(typeof(Arcoth))] - [InlineData(typeof(Arcsch))] - [InlineData(typeof(Arsech))] - [InlineData(typeof(Arsinh))] - [InlineData(typeof(Artanh))] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Sinh))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Abs))] + [TestCase(typeof(Add))] + [TestCase(typeof(Derivative))] + [TestCase(typeof(Div))] + [TestCase(typeof(Exp))] + [TestCase(typeof(Lb))] + [TestCase(typeof(Lg))] + [TestCase(typeof(Ln))] + [TestCase(typeof(Log))] + [TestCase(typeof(Mul))] + [TestCase(typeof(Number))] + [TestCase(typeof(Angle))] + [TestCase(typeof(Pow))] + [TestCase(typeof(Root))] + [TestCase(typeof(Simplify))] + [TestCase(typeof(Sqrt))] + [TestCase(typeof(Sub))] + [TestCase(typeof(UnaryMinus))] + [TestCase(typeof(Variable))] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arctan))] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] + [TestCase(typeof(Arcosh))] + [TestCase(typeof(Arcoth))] + [TestCase(typeof(Arcsch))] + [TestCase(typeof(Arsech))] + [TestCase(typeof(Arsinh))] + [TestCase(typeof(Artanh))] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Sinh))] + [TestCase(typeof(Tanh))] public void TestExpressionNullArgument(Type type) => TestNullExp(type); - [Theory] - [InlineData(typeof(Abs))] - [InlineData(typeof(Exp))] - [InlineData(typeof(Lb))] - [InlineData(typeof(Lg))] - [InlineData(typeof(Ln))] - [InlineData(typeof(Sqrt))] - [InlineData(typeof(UnaryMinus))] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arctan))] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] - [InlineData(typeof(Arcosh))] - [InlineData(typeof(Arcoth))] - [InlineData(typeof(Arcsch))] - [InlineData(typeof(Arsech))] - [InlineData(typeof(Arsinh))] - [InlineData(typeof(Artanh))] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Sinh))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Abs))] + [TestCase(typeof(Exp))] + [TestCase(typeof(Lb))] + [TestCase(typeof(Lg))] + [TestCase(typeof(Ln))] + [TestCase(typeof(Sqrt))] + [TestCase(typeof(UnaryMinus))] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arctan))] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] + [TestCase(typeof(Arcosh))] + [TestCase(typeof(Arcoth))] + [TestCase(typeof(Arcsch))] + [TestCase(typeof(Arsech))] + [TestCase(typeof(Arsinh))] + [TestCase(typeof(Artanh))] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Sinh))] + [TestCase(typeof(Tanh))] public void TestUnaryContextNullArgument(Type type) { var exp = Create(type, Variable.X); @@ -120,14 +120,14 @@ public void TestUnaryContextNullArgument(Type type) Assert.Throws(() => exp.Analyze(differentiator, null)); } - [Theory] - [InlineData(typeof(Add))] - [InlineData(typeof(Div))] - [InlineData(typeof(Log))] - [InlineData(typeof(Mul))] - [InlineData(typeof(Pow))] - [InlineData(typeof(Root))] - [InlineData(typeof(Sub))] + [Test] + [TestCase(typeof(Add))] + [TestCase(typeof(Div))] + [TestCase(typeof(Log))] + [TestCase(typeof(Mul))] + [TestCase(typeof(Pow))] + [TestCase(typeof(Root))] + [TestCase(typeof(Sub))] public void TestBinaryContextNullArgument(Type type) { var exp = Create(type, Variable.X, Variable.X); @@ -135,7 +135,7 @@ public void TestBinaryContextNullArgument(Type type) Assert.Throws(() => exp.Analyze(differentiator, null)); } - [Fact] + [Test] public void DerivContextArgumentTest() { var exp = new Derivative(differentiator, new Simplifier(), Variable.X); @@ -143,7 +143,7 @@ public void DerivContextArgumentTest() Assert.Throws(() => differentiator.Analyze(exp, null)); } - [Fact] + [Test] public void NumberContextArgumentTest() { var exp = Number.One; @@ -151,7 +151,7 @@ public void NumberContextArgumentTest() Assert.Throws(() => differentiator.Analyze(exp, null)); } - [Fact] + [Test] public void AngleContextArgumentTest() { var exp = AngleValue.Degree(10).AsExpression(); @@ -159,7 +159,7 @@ public void AngleContextArgumentTest() Assert.Throws(() => differentiator.Analyze(exp, null)); } - [Fact] + [Test] public void SimplifyContextArgumentTest() { var exp = new Simplify(new Simplifier(), Variable.X); @@ -167,7 +167,7 @@ public void SimplifyContextArgumentTest() Assert.Throws(() => differentiator.Analyze(exp, null)); } - [Fact] + [Test] public void VariableContextArgumentTest() { var exp = Variable.X; @@ -175,7 +175,7 @@ public void VariableContextArgumentTest() Assert.Throws(() => differentiator.Analyze(exp, null)); } - [Fact] + [Test] public void CallExpressionContextNullArgument() { var exp = new CallExpression( @@ -185,7 +185,7 @@ public void CallExpressionContextNullArgument() Assert.Throws(() => exp.Analyze(differentiator, null)); } - [Fact] + [Test] public void LambdaExpressionContextNullArgument() { var exp = Variable.X.ToLambdaExpression(Variable.X.Name); diff --git a/xFunc.Tests/Analyzers/Formatters/CommonFormatterTest.cs b/xFunc.Tests/Analyzers/Formatters/CommonFormatterTest.cs index c93832e1e..da5166d0d 100644 --- a/xFunc.Tests/Analyzers/Formatters/CommonFormatterTest.cs +++ b/xFunc.Tests/Analyzers/Formatters/CommonFormatterTest.cs @@ -11,47 +11,47 @@ public class CommonFormatterTest { #region Common - [Fact] + [Test] public void AbsToStringTest() { var exp = new Abs(new Number(5)); - Assert.Equal("abs(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("abs(5)")); } - [Fact] + [Test] public void AddToStringTest() { var exp = new Add(new Number(5), Number.Zero); - Assert.Equal("5 + 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 + 0")); } - [Fact] + [Test] public void AddToStringBinTest() { var exp = new Mul(Variable.X, new Add(new Number(5), Number.Zero)); - Assert.Equal("x * (5 + 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x * (5 + 0)")); } - [Fact] + [Test] public void CeilToStringTest() { var ceil = new Ceil(new Number(5.55555555)); - Assert.Equal("ceil(5.55555555)", ceil.ToString()); + Assert.That(ceil.ToString(), Is.EqualTo("ceil(5.55555555)")); } - [Fact] + [Test] public void DefineToStringTest() { var exp = new Assign(Variable.X, Number.Zero); - Assert.Equal("x := 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x := 0")); } - [Fact] + [Test] public void DelToStringTest() { var exp = new Del( @@ -66,487 +66,487 @@ public void DelToStringTest() ) ); - Assert.Equal("del(((2 * x1) + (x2 ^ 2)) + (x3 ^ 3))", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("del(((2 * x1) + (x2 ^ 2)) + (x3 ^ 3))")); } - [Fact] + [Test] public void DerivativeToStringExpTest() { var deriv = new Derivative(new Differentiator(), new Simplifier(), new Sin(Variable.X)); - Assert.Equal("deriv(sin(x))", deriv.ToString()); + Assert.That(deriv.ToString(), Is.EqualTo("deriv(sin(x))")); } - [Fact] + [Test] public void DerivativeToStringVarTest() { var deriv = new Derivative(new Differentiator(), new Simplifier(), new Sin(Variable.X), Variable.X); - Assert.Equal("deriv(sin(x), x)", deriv.ToString()); + Assert.That(deriv.ToString(), Is.EqualTo("deriv(sin(x), x)")); } - [Fact] + [Test] public void DerivativeToStringPointTest() { var deriv = new Derivative(new Differentiator(), new Simplifier(), new Sin(Variable.X), Variable.X, Number.One); - Assert.Equal("deriv(sin(x), x, 1)", deriv.ToString()); + Assert.That(deriv.ToString(), Is.EqualTo("deriv(sin(x), x, 1)")); } - [Fact] + [Test] public void DivToStringTest() { var exp = new Div(new Number(5), Number.Zero); - Assert.Equal("5 / 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 / 0")); } - [Fact] + [Test] public void DivToStringBinTest() { var exp = new Mul(Variable.X, new Div(new Number(5), Number.Zero)); - Assert.Equal("x * (5 / 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x * (5 / 0)")); } - [Fact] + [Test] public void ExpToStringTest() { var exp = new Exp(new Number(5)); - Assert.Equal("exp(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("exp(5)")); } - [Fact] + [Test] public void FactToStringTest() { var exp = new Fact(new Number(5)); - Assert.Equal("5!", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5!")); } - [Fact] + [Test] public void FloorToStringTest() { var exp = new Floor(new Number(5.55555555)); - Assert.Equal("floor(5.55555555)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("floor(5.55555555)")); } - [Fact] + [Test] public void TruncToStringTest() { var exp = new Trunc(new Number(5.55555555)); - Assert.Equal("trunc(5.55555555)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("trunc(5.55555555)")); } - [Fact] + [Test] public void FracToStringTest() { var exp = new Frac(new Number(5.55555555)); - Assert.Equal("frac(5.55555555)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("frac(5.55555555)")); } - [Fact] + [Test] public void GCDToStringTest() { var exp = new GCD(new Number(5), Number.Zero); - Assert.Equal("gcd(5, 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("gcd(5, 0)")); } - [Fact] + [Test] public void LCMToStringTest() { var exp = new LCM(new Number(5), Number.Zero); - Assert.Equal("lcm(5, 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("lcm(5, 0)")); } - [Fact] + [Test] public void LbToStringTest() { var exp = new Lb(new Number(5)); - Assert.Equal("lb(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("lb(5)")); } - [Fact] + [Test] public void LgToStringTest() { var exp = new Lg(new Number(5)); - Assert.Equal("lg(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("lg(5)")); } - [Fact] + [Test] public void LnToStringTest() { var exp = new Ln(new Number(5)); - Assert.Equal("ln(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("ln(5)")); } - [Fact] + [Test] public void LogToStringTest() { var exp = new Log(Number.Zero, new Number(5)); - Assert.Equal("log(0, 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("log(0, 5)")); } - [Fact] + [Test] public void ModToStringTest() { var exp = new Mod(new Number(5), Number.Zero); - Assert.Equal("5 % 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 % 0")); } - [Fact] + [Test] public void ModToStringBinTest() { var exp = new Mul(Variable.X, new Mod(new Number(5), Number.Zero)); - Assert.Equal("x * (5 % 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x * (5 % 0)")); } - [Fact] + [Test] public void MulToStringTest() { var exp = new Mul(new Number(5), Number.Zero); - Assert.Equal("5 * 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 * 0")); } - [Fact] + [Test] public void MulToStringAddTest() { var exp = new Add(Variable.X, new Mul(new Number(5), Number.Zero)); - Assert.Equal("x + (5 * 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x + (5 * 0)")); } - [Fact] + [Test] public void MulToStringSubTest() { var exp = new Sub(Variable.X, new Mul(new Number(5), Number.Zero)); - Assert.Equal("x - (5 * 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x - (5 * 0)")); } - [Fact] + [Test] public void MulToStringMulTest() { var exp = new Mul(Variable.X, new Mul(new Number(5), Number.Zero)); - Assert.Equal("x * (5 * 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x * (5 * 0)")); } - [Fact] + [Test] public void MulToStringDivTest() { var exp = new Div(Variable.X, new Mul(new Number(5), Number.Zero)); - Assert.Equal("x / (5 * 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x / (5 * 0)")); } - [Fact] + [Test] public void NumberTest() { var exp = new Number(3.3); - Assert.Equal("3.3", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("3.3")); } - [Fact] + [Test] public void AngleNumberTest() { var exp = AngleValue.Degree(10).AsExpression(); - Assert.Equal("10 degree", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 degree")); } - [Fact] + [Test] public void PowerNumberTest() { var exp = PowerValue.Watt(10).AsExpression(); - Assert.Equal("10 W", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 W")); } - [Fact] + [Test] public void TemperatureNumberTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); - Assert.Equal("10 °C", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 °C")); } - [Fact] + [Test] public void MassNumberTest() { var exp = MassValue.Gram(10).AsExpression(); - Assert.Equal("10 g", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 g")); } - [Fact] + [Test] public void LengthNumberTest() { var exp = LengthValue.Meter(10).AsExpression(); - Assert.Equal("10 m", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 m")); } - [Fact] + [Test] public void TimeNumberTest() { var exp = TimeValue.Second(10).AsExpression(); - Assert.Equal("10 s", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 s")); } - [Fact] + [Test] public void AreaNumberTest() { var exp = AreaValue.Meter(10).AsExpression(); - Assert.Equal("10 m^2", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 m^2")); } - [Fact] + [Test] public void VolumeNumberTest() { var exp = VolumeValue.Meter(10).AsExpression(); - Assert.Equal("10 m^3", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("10 m^3")); } - [Fact] + [Test] public void ToDegreeTest() { var exp = new ToDegree(new Number(10)); - Assert.Equal("todegree(10)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("todegree(10)")); } - [Fact] + [Test] public void ToRadianTest() { var exp = new ToRadian(new Number(10)); - Assert.Equal("toradian(10)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("toradian(10)")); } - [Fact] + [Test] public void ToGradianTest() { var exp = new ToGradian(new Number(10)); - Assert.Equal("togradian(10)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("togradian(10)")); } - [Fact] + [Test] public void ToNumberTest() { var exp = new ToNumber(AngleValue.Degree(10).AsExpression()); - Assert.Equal("tonumber(10 degree)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tonumber(10 degree)")); } - [Fact] + [Test] public void NumberSubTest() { var exp = new Sub(Number.One, new Number(-3.3)); - Assert.Equal("1 - -3.3", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("1 - -3.3")); } - [Fact] + [Test] public void PowToStringTest() { var exp = new Pow(new Number(5), Number.Zero); - Assert.Equal("5 ^ 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 ^ 0")); } - [Fact] + [Test] public void PowToStringAddTest() { var exp = new Add(Variable.X, new Pow(new Number(5), Number.Zero)); - Assert.Equal("x + (5 ^ 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x + (5 ^ 0)")); } - [Fact] + [Test] public void PowToStringSubTest() { var exp = new Sub(Variable.X, new Pow(new Number(5), Number.Zero)); - Assert.Equal("x - (5 ^ 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x - (5 ^ 0)")); } - [Fact] + [Test] public void PowToStringMulTest() { var exp = new Mul(Variable.X, new Pow(new Number(5), Number.Zero)); - Assert.Equal("x * (5 ^ 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x * (5 ^ 0)")); } - [Fact] + [Test] public void PowToStringDivTest() { var exp = new Div(Variable.X, new Pow(new Number(5), Number.Zero)); - Assert.Equal("x / (5 ^ 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x / (5 ^ 0)")); } - [Fact] + [Test] public void RootToStringTest() { var exp = new Root(new Number(5), Number.Zero); - Assert.Equal("root(5, 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("root(5, 0)")); } - [Fact] + [Test] public void RoundToStringTest() { var exp = new Round(new Number(5), Number.Zero); - Assert.Equal("round(5, 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("round(5, 0)")); } - [Fact] + [Test] public void SimplifyToStringTest() { var exp = new Simplify(new Simplifier(), new Sin(Variable.X)); - Assert.Equal("simplify(sin(x))", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("simplify(sin(x))")); } - [Fact] + [Test] public void SqrtToStringTest() { var exp = new Sqrt(new Number(5)); - Assert.Equal("sqrt(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("sqrt(5)")); } - [Fact] + [Test] public void SubToStringTest() { var exp = new Sub(new Number(5), Number.Zero); - Assert.Equal("5 - 0", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 - 0")); } - [Fact] + [Test] public void SubToStringSubTest() { var exp = new Sub(Variable.X, new Sub(new Number(5), Number.Zero)); - Assert.Equal("x - (5 - 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x - (5 - 0)")); } - [Fact] + [Test] public void SubToStringDivTest() { var exp = new Div(Variable.X, new Sub(new Number(5), Number.Zero)); - Assert.Equal("x / (5 - 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x / (5 - 0)")); } - [Fact] + [Test] public void UnaryMinusToStringTest() { var exp = new UnaryMinus(new Number(5)); - Assert.Equal("-5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("-5")); } - [Fact] + [Test] public void UnaryMinusToStringBinTest() { var exp = new UnaryMinus(new Add(new Number(5), Number.Zero)); - Assert.Equal("-(5 + 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("-(5 + 0)")); } - [Fact] + [Test] public void UnaryMinusToStringSubTest() { var exp = new Sub(Number.Zero, new UnaryMinus(new Number(5))); - Assert.Equal("0 - -5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("0 - -5")); } - [Fact] + [Test] public void UndefineToStringTest() { var exp = new Unassign(Variable.X); - Assert.Equal("undef(x)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("undef(x)")); } - [Fact] + [Test] public void LambdaExpressionToStringArgTest() { var exp = new Add(Variable.X, Variable.Y) .ToLambdaExpression(Variable.X, Variable.Y); - Assert.Equal("(x, y) => x + y", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("(x, y) => x + y")); } - [Fact] + [Test] public void CallExpressionToStringArgTest() { var exp = new CallExpression( new Variable("f"), new IExpression[] { new Number(5), Number.Two }.ToImmutableArray()); - Assert.Equal("f(5, 2)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("f(5, 2)")); } - [Fact] + [Test] public void InlineCallExpressionToStringArgTest() { var exp = new CallExpression( Variable.X.ToLambdaExpression(Variable.X.Name), new IExpression[] { new Number(5) }.ToImmutableArray()); - Assert.Equal("((x) => x)(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("((x) => x)(5)")); } - [Fact] + [Test] public void VariableTest() { var exp = Variable.X; - Assert.Equal("x", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x")); } - [Fact] + [Test] public void DelegateExpressionTest() { - var exp = new DelegateExpression(param => 0d); + var exp = new DelegateExpression(_ => 0d); - Assert.Equal("{Delegate Expression}", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("{Delegate Expression}")); } - [Fact] + [Test] public void StringExpressionTest() { var exp = new StringExpression("hello"); - Assert.Equal("'hello'", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("'hello'")); } - [Fact] + [Test] public void ConvertTest() { var exp = new xFunc.Maths.Expressions.Units.Convert( @@ -555,491 +555,491 @@ public void ConvertTest() new StringExpression("rad") ); - Assert.Equal("convert(90 degree, 'rad')", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("convert(90 degree, 'rad')")); } - [Fact] + [Test] public void RationalTest() { var exp = new Rational(Number.One, Number.Two); - Assert.Equal("1 // 2", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("1 // 2")); } - [Fact] + [Test] public void ToRationalTest() { var exp = new ToRational(Number.Two); - Assert.Equal("torational(2)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("torational(2)")); } #endregion Common #region Complex Numbers - [Fact] + [Test] public void ComplexNumberPositiveNegativeToStringTest() { var complex = new ComplexNumber(3, -2); - Assert.Equal("3-2i", complex.ToString()); + Assert.That(complex.ToString(), Is.EqualTo("3-2i")); } - [Fact] + [Test] public void ComplexNumberNegativePositiveToStringTest() { var complex = new ComplexNumber(-3, 2); - Assert.Equal("-3+2i", complex.ToString()); + Assert.That(complex.ToString(), Is.EqualTo("-3+2i")); } - [Fact] + [Test] public void ComplexNumberTwoPositiveToStringTest() { var complex = new ComplexNumber(3, 2); - Assert.Equal("3+2i", complex.ToString()); + Assert.That(complex.ToString(), Is.EqualTo("3+2i")); } - [Fact] + [Test] public void ComplexNumberTwoNegativeToStringTest() { var complex = new ComplexNumber(-3, -2); - Assert.Equal("-3-2i", complex.ToString()); + Assert.That(complex.ToString(), Is.EqualTo("-3-2i")); } - [Fact] + [Test] public void ComplexNumberOnlyRealPartToStringTest() { var complex = new ComplexNumber(-3, 0); - Assert.Equal("-3", complex.ToString()); + Assert.That(complex.ToString(), Is.EqualTo("-3")); } - [Fact] + [Test] public void ComplexNumberOnlyImaginaryPartToStringTest() { var complex = new ComplexNumber(0, -2); - Assert.Equal("-2i", complex.ToString()); + Assert.That(complex.ToString(), Is.EqualTo("-2i")); } - [Fact] + [Test] public void ComplexNumberBinaryToStringTest() { var exp = new Add(new ComplexNumber(3, 2), new ComplexNumber(3, 2)); - Assert.Equal("3+2i + 3+2i", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("3+2i + 3+2i")); } - [Fact] + [Test] public void ComplexNumberAbsToStringTest() { var exp = new Abs(new ComplexNumber(3, 2)); - Assert.Equal("abs(3+2i)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("abs(3+2i)")); } - [Fact] + [Test] public void ComplexNumberIToStringTest() { var exp = new ComplexNumber(0, 1); - Assert.Equal("i", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("i")); } - [Fact] + [Test] public void ComplexNumberNegativeIToStringTest() { var exp = new ComplexNumber(0, -1); - Assert.Equal("-i", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("-i")); } - [Fact] + [Test] public void ConjugateToStringTest() { var complex = new Complex(3.1, 2.5); var exp = new Conjugate(new ComplexNumber(complex)); - Assert.Equal("conjugate(3.1+2.5i)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("conjugate(3.1+2.5i)")); } - [Fact] + [Test] public void ImToStringTest() { var complex = new Complex(3.1, 2.5); var exp = new Im(new ComplexNumber(complex)); - Assert.Equal("im(3.1+2.5i)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("im(3.1+2.5i)")); } - [Fact] + [Test] public void PhaseToStringTest() { var complex = new Complex(3.1, 2.5); var exp = new Phase(new ComplexNumber(complex)); - Assert.Equal("phase(3.1+2.5i)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("phase(3.1+2.5i)")); } - [Fact] + [Test] public void ReciprocalToStringTest() { var complex = new Complex(3.1, 2.5); var exp = new Reciprocal(new ComplexNumber(complex)); - Assert.Equal("reciprocal(3.1+2.5i)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("reciprocal(3.1+2.5i)")); } - [Fact] + [Test] public void ReToStringTest() { var complex = new Complex(3.1, 2.5); var exp = new Re(new ComplexNumber(complex)); - Assert.Equal("re(3.1+2.5i)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("re(3.1+2.5i)")); } - [Fact] + [Test] public void ToComplexToStringTest() { var exp = new ToComplex(Number.Two); - Assert.Equal("tocomplex(2)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tocomplex(2)")); } #endregion #region Trigonometric - [Fact] + [Test] public void ArccosToStringTest() { var exp = new Arccos(new Number(5)); - Assert.Equal("arccos(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arccos(5)")); } - [Fact] + [Test] public void ArccotToStringTest() { var exp = new Arccot(new Number(5)); - Assert.Equal("arccot(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arccot(5)")); } - [Fact] + [Test] public void ArccscToStringTest() { var exp = new Arccsc(new Number(5)); - Assert.Equal("arccsc(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arccsc(5)")); } - [Fact] + [Test] public void ArcsecToStringTest() { var exp = new Arcsec(new Number(5)); - Assert.Equal("arcsec(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arcsec(5)")); } - [Fact] + [Test] public void ArcsinToStringTest() { var exp = new Arcsin(new Number(5)); - Assert.Equal("arcsin(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arcsin(5)")); } - [Fact] + [Test] public void ArctanToStringTest() { var exp = new Arctan(new Number(5)); - Assert.Equal("arctan(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arctan(5)")); } - [Fact] + [Test] public void CosToStringTest() { var exp = new Cos(new Number(5)); - Assert.Equal("cos(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("cos(5)")); } - [Fact] + [Test] public void CotToStringTest() { var exp = new Cot(new Number(5)); - Assert.Equal("cot(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("cot(5)")); } - [Fact] + [Test] public void CscToStringTest() { var exp = new Csc(new Number(5)); - Assert.Equal("csc(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("csc(5)")); } - [Fact] + [Test] public void SecToStringTest() { var exp = new Sec(new Number(5)); - Assert.Equal("sec(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("sec(5)")); } - [Fact] + [Test] public void SinToStringTest() { var exp = new Sin(new Number(5)); - Assert.Equal("sin(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("sin(5)")); } - [Fact] + [Test] public void TanToStringTest() { var exp = new Tan(new Number(5)); - Assert.Equal("tan(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tan(5)")); } #endregion #region Hyperbolic - [Fact] + [Test] public void ArcoshToStringTest() { var exp = new Arcosh(new Number(5)); - Assert.Equal("arcosh(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arcosh(5)")); } - [Fact] + [Test] public void ArcothToStringTest() { var exp = new Arcoth(new Number(5)); - Assert.Equal("arcoth(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arcoth(5)")); } - [Fact] + [Test] public void ArcschToStringTest() { var exp = new Arcsch(new Number(5)); - Assert.Equal("arcsch(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arcsch(5)")); } - [Fact] + [Test] public void ArsechToStringTest() { var exp = new Arsech(new Number(5)); - Assert.Equal("arsech(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arsech(5)")); } - [Fact] + [Test] public void ArsinhToStringTest() { var exp = new Arsinh(new Number(5)); - Assert.Equal("arsinh(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("arsinh(5)")); } - [Fact] + [Test] public void ArtanhToStringTest() { var exp = new Artanh(new Number(5)); - Assert.Equal("artanh(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("artanh(5)")); } - [Fact] + [Test] public void CoshToStringTest() { var exp = new Cosh(new Number(5)); - Assert.Equal("cosh(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("cosh(5)")); } - [Fact] + [Test] public void CothToStringTest() { var exp = new Coth(new Number(5)); - Assert.Equal("coth(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("coth(5)")); } - [Fact] + [Test] public void CschToStringTest() { var exp = new Csch(new Number(5)); - Assert.Equal("csch(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("csch(5)")); } - [Fact] + [Test] public void SechToStringTest() { var exp = new Sech(new Number(5)); - Assert.Equal("sech(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("sech(5)")); } - [Fact] + [Test] public void SinhToStringTest() { var exp = new Sinh(new Number(5)); - Assert.Equal("sinh(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("sinh(5)")); } - [Fact] + [Test] public void TanhToStringTest() { var exp = new Tanh(new Number(5)); - Assert.Equal("tanh(5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tanh(5)")); } #endregion #region Logical and Bitwise - [Fact] + [Test] public void BoolToStringTest() { var exp = Bool.False; - Assert.Equal("False", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("False")); } - [Fact] + [Test] public void AndAndToStringTest() { var exp = new And(Bool.True, new And(Bool.True, Bool.True)); - Assert.Equal("True and (True and True)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True and (True and True)")); } - [Fact] + [Test] public void OrToStringTest() { var exp = new Or(Bool.True, Bool.True); - Assert.Equal("True or True", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True or True")); } - [Fact] + [Test] public void OrOrToStringTest() { var exp = new Or(Bool.True, new Or(Bool.True, Bool.True)); - Assert.Equal("True or (True or True)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True or (True or True)")); } - [Fact] + [Test] public void XOrToStringTest() { var exp = new XOr(Bool.True, Bool.True); - Assert.Equal("True xor True", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True xor True")); } - [Fact] + [Test] public void XOrXOrToStringTest() { var exp = new XOr(Bool.True, new XOr(Bool.True, Bool.True)); - Assert.Equal("True xor (True xor True)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True xor (True xor True)")); } - [Fact] + [Test] public void NotToStringTest() { var exp = new Not(Bool.True); - Assert.Equal("not(True)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("not(True)")); } - [Fact] + [Test] public void EqualityToStringTest1() { var eq = new Equality(Bool.True, Bool.False); - Assert.Equal("True <=> False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("True <=> False")); } - [Fact] + [Test] public void EqualityToStringTest2() { var eq = new And(new Equality(Bool.True, Bool.False), Bool.False); - Assert.Equal("(True <=> False) and False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("(True <=> False) and False")); } - [Fact] + [Test] public void ImplicationToStringTest1() { var eq = new Implication(Bool.True, Bool.False); - Assert.Equal("True => False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("True => False")); } - [Fact] + [Test] public void ImplicationToStringTest2() { var eq = new And(new Implication(Bool.True, Bool.False), Bool.False); - Assert.Equal("(True => False) and False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("(True => False) and False")); } - [Fact] + [Test] public void NAndToStringTest1() { var eq = new NAnd(Bool.True, Bool.False); - Assert.Equal("True nand False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("True nand False")); } - [Fact] + [Test] public void NAndToStringTest2() { var eq = new And(new NAnd(Bool.True, Bool.False), Bool.False); - Assert.Equal("(True nand False) and False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("(True nand False) and False")); } - [Fact] + [Test] public void NOrToStringTest1() { var eq = new NOr(Bool.True, Bool.False); - Assert.Equal("True nor False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("True nor False")); } - [Fact] + [Test] public void NOrToStringTest2() { var eq = new And(new NOr(Bool.True, Bool.False), Bool.False); - Assert.Equal("(True nor False) and False", eq.ToString()); + Assert.That(eq.ToString(), Is.EqualTo("(True nor False) and False")); } #endregion #region Matrix - [Fact] + [Test] public void MatrixToStringTest() { var matrix = new Matrix(new[] @@ -1048,10 +1048,10 @@ public void MatrixToStringTest() new Matrices.Vector(new IExpression[] { new Number(4), Number.Zero }) }); - Assert.Equal("{{1, -2}, {4, 0}}", matrix.ToString()); + Assert.That(matrix.ToString(), Is.EqualTo("{{1, -2}, {4, 0}}")); } - [Fact] + [Test] public void DeterminantToStringTest() { var matrix = new Matrix(new[] @@ -1062,10 +1062,10 @@ public void DeterminantToStringTest() var det = new Determinant(matrix); - Assert.Equal("det({{1, -2}, {4, 0}})", det.ToString()); + Assert.That(det.ToString(), Is.EqualTo("det({{1, -2}, {4, 0}})")); } - [Fact] + [Test] public void InverseToStringTest() { var matrix = new Matrix(new[] @@ -1076,30 +1076,30 @@ public void InverseToStringTest() var exp = new Inverse(matrix); - Assert.Equal("inverse({{1, -2}, {4, 0}})", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("inverse({{1, -2}, {4, 0}})")); } - [Fact] + [Test] public void DotProductToStringTest() { var left = new Matrices.Vector(new IExpression[] { Number.One, new Number(-2) }); var right = new Matrices.Vector(new IExpression[] { new Number(4), Number.Zero }); var exp = new DotProduct(left, right); - Assert.Equal("dotProduct({1, -2}, {4, 0})", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("dotProduct({1, -2}, {4, 0})")); } - [Fact] + [Test] public void CrossProductToStringTest() { var left = new Matrices.Vector(new IExpression[] { Number.One, new Number(-2) }); var right = new Matrices.Vector(new IExpression[] { new Number(4), Number.Zero }); var exp = new CrossProduct(left, right); - Assert.Equal("crossProduct({1, -2}, {4, 0})", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("crossProduct({1, -2}, {4, 0})")); } - [Fact] + [Test] public void TransposeToStringTest() { var matrix = new Matrix(new[] @@ -1110,452 +1110,452 @@ public void TransposeToStringTest() var exp = new Transpose(matrix); - Assert.Equal("transpose({{1, -2}, {4, 0}})", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("transpose({{1, -2}, {4, 0}})")); } #endregion #region Statistical - [Fact] + [Test] public void AvgToStringTest() { var sum = new Avg(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("avg(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("avg(1, 2)")); } - [Fact] + [Test] public void AvgToStringTest2() { var sum = new Avg(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("avg({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("avg({1, 2})")); } - [Fact] + [Test] public void CountToStringTest() { var sum = new Count(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("count(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("count(1, 2)")); } - [Fact] + [Test] public void CountToStringTest2() { var sum = new Count(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("count({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("count({1, 2})")); } - [Fact] + [Test] public void ToStringTest() { var sum = new Max(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("max(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("max(1, 2)")); } - [Fact] + [Test] public void ToStringTest2() { var sum = new Max(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("max({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("max({1, 2})")); } - [Fact] + [Test] public void MinToStringTest() { var sum = new Min(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("min(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("min(1, 2)")); } - [Fact] + [Test] public void MinToStringTest2() { var sum = new Min(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("min({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("min({1, 2})")); } - [Fact] + [Test] public void ProductToStringTest() { var sum = new Product(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("product(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("product(1, 2)")); } - [Fact] + [Test] public void ProductToStringTest2() { var sum = new Product(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("product({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("product({1, 2})")); } - [Fact] + [Test] public void StdevpToStringTest() { var sum = new Stdevp(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("stdevp(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("stdevp(1, 2)")); } - [Fact] + [Test] public void StdevpToStringTest2() { var sum = new Stdevp(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("stdevp({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("stdevp({1, 2})")); } - [Fact] + [Test] public void StdevToStringTest() { var sum = new Stdev(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("stdev(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("stdev(1, 2)")); } - [Fact] + [Test] public void StdevToStringTest2() { var sum = new Stdev(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("stdev({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("stdev({1, 2})")); } - [Fact] + [Test] public void SumToStringTest() { var sum = new Sum(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("sum(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("sum(1, 2)")); } - [Fact] + [Test] public void SumToStringTest2() { var sum = new Sum(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("sum({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("sum({1, 2})")); } - [Fact] + [Test] public void VarpToStringTest() { var sum = new Varp(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("varp(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("varp(1, 2)")); } - [Fact] + [Test] public void VarpToStringTest2() { var sum = new Varp(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("varp({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("varp({1, 2})")); } - [Fact] + [Test] public void VarToStringTest() { var sum = new Var(new IExpression[] { Number.One, Number.Two }); - Assert.Equal("var(1, 2)", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("var(1, 2)")); } - [Fact] + [Test] public void VarToStringTest2() { var sum = new Var(new IExpression[] { new Matrices.Vector(new IExpression[] { Number.One, Number.Two }) }); - Assert.Equal("var({1, 2})", sum.ToString()); + Assert.That(sum.ToString(), Is.EqualTo("var({1, 2})")); } #endregion #region Programming - [Fact] + [Test] public void AddAssignToString() { var exp = new AddAssign(Variable.X, new Number(5)); - Assert.Equal("x += 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x += 5")); } - [Fact] + [Test] public void SubAssignToString() { var exp = new SubAssign(Variable.X, new Number(5)); - Assert.Equal("x -= 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x -= 5")); } - [Fact] + [Test] public void MulAssignToString() { var exp = new MulAssign(Variable.X, new Number(5)); - Assert.Equal("x *= 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x *= 5")); } - [Fact] + [Test] public void DivAssignToString() { var exp = new DivAssign(Variable.X, new Number(5)); - Assert.Equal("x /= 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x /= 5")); } - [Fact] + [Test] public void IncToString() { var exp = new Inc(Variable.X); - Assert.Equal("x++", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x++")); } - [Fact] + [Test] public void DecToString() { var exp = new Dec(Variable.X); - Assert.Equal("x--", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("x--")); } - [Fact] + [Test] public void CondAndToString() { var exp = new ConditionalAnd(Bool.True, Bool.True); - Assert.Equal("True && True", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True && True")); } - [Fact] + [Test] public void CondAndCondAndToString() { var exp = new ConditionalAnd(Bool.True, new ConditionalAnd(Bool.True, Bool.True)); - Assert.Equal("True && (True && True)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True && (True && True)")); } - [Fact] + [Test] public void CondOrToString() { var exp = new ConditionalOr(Bool.True, Bool.True); - Assert.Equal("True || True", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True || True")); } - [Fact] + [Test] public void CondOrCondOrToString() { var exp = new ConditionalOr(Bool.True, new ConditionalOr(Bool.True, Bool.True)); - Assert.Equal("True || (True || True)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True || (True || True)")); } - [Fact] + [Test] public void EqualToString() { var exp = new Equal(new Number(5), new Number(5)); - Assert.Equal("5 == 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 == 5")); } - [Fact] + [Test] public void EqualEqualToString() { var exp = new Equal(Bool.True, new Equal(new Number(5), new Number(5))); - Assert.Equal("True == (5 == 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True == (5 == 5)")); } - [Fact] + [Test] public void NotEqualToString() { var exp = new NotEqual(new Number(5), new Number(5)); - Assert.Equal("5 != 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 != 5")); } - [Fact] + [Test] public void NotEqualNotEqualToString() { var exp = new NotEqual(Bool.True, new NotEqual(new Number(5), new Number(5))); - Assert.Equal("True != (5 != 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True != (5 != 5)")); } - [Fact] + [Test] public void LessToString() { var exp = new LessThan(new Number(5), new Number(5)); - Assert.Equal("5 < 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 < 5")); } - [Fact] + [Test] public void LessLessToString() { var exp = new ConditionalAnd(Bool.True, new LessThan(new Number(5), new Number(5))); - Assert.Equal("True && (5 < 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True && (5 < 5)")); } - [Fact] + [Test] public void LessOrEqualToString() { var exp = new LessOrEqual(new Number(5), new Number(5)); - Assert.Equal("5 <= 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 <= 5")); } - [Fact] + [Test] public void LessOrEqualLessOrEqualToString() { var exp = new ConditionalAnd(Bool.True, new LessOrEqual(new Number(5), new Number(5))); - Assert.Equal("True && (5 <= 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True && (5 <= 5)")); } - [Fact] + [Test] public void GreatToString() { var exp = new GreaterThan(new Number(5), new Number(5)); - Assert.Equal("5 > 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 > 5")); } - [Fact] + [Test] public void GreatGreatToString() { var exp = new ConditionalAnd(Bool.True, new GreaterThan(new Number(5), new Number(5))); - Assert.Equal("True && (5 > 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True && (5 > 5)")); } - [Fact] + [Test] public void GreatOrEqualToString() { var exp = new GreaterOrEqual(new Number(5), new Number(5)); - Assert.Equal("5 >= 5", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("5 >= 5")); } - [Fact] + [Test] public void GreatOrEqualGreatOrEqualToString() { var exp = new ConditionalAnd(Bool.True, new GreaterOrEqual(new Number(5), new Number(5))); - Assert.Equal("True && (5 >= 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("True && (5 >= 5)")); } - [Fact] + [Test] public void IfToString() { var exp = new If(new Equal(new Number(5), new Number(5)), new Number(5)); - Assert.Equal("if(5 == 5, 5)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("if(5 == 5, 5)")); } - [Fact] + [Test] public void IfElseToString() { var exp = new If(new Equal(new Number(5), new Number(5)), new Number(5), Number.Zero); - Assert.Equal("if(5 == 5, 5, 0)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("if(5 == 5, 5, 0)")); } - [Fact] + [Test] public void ForToString() { var exp = new For(new Number(5), new Assign(Variable.X, Number.Zero), new Equal(new Number(5), new Number(5)), new AddAssign(Variable.X, Number.One)); - Assert.Equal("for(5, x := 0, 5 == 5, x += 1)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("for(5, x := 0, 5 == 5, x += 1)")); } - [Fact] + [Test] public void WhileToString() { var exp = new While(new Number(5), new Equal(new Number(5), new Number(5))); - Assert.Equal("while(5, (5 == 5))", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("while(5, (5 == 5))")); } - [Fact] + [Test] public void SignToString() { var exp = new Sign(new Number(-5)); var str = exp.ToString(); - Assert.Equal("sign(-5)", str); + Assert.That(str, Is.EqualTo("sign(-5)")); } - [Fact] + [Test] public void LeftShiftTest() { var exp = new LeftShift(Number.One, new Number(10)); var str = exp.ToString(); - Assert.Equal("1 << 10", str); + Assert.That(str, Is.EqualTo("1 << 10")); } - [Fact] + [Test] public void RightShiftTest() { var exp = new RightShift(Number.One, new Number(10)); var str = exp.ToString(); - Assert.Equal("1 >> 10", str); + Assert.That(str, Is.EqualTo("1 >> 10")); } - [Fact] + [Test] public void LeftShiftAssignTest() { var exp = new LeftShiftAssign(Variable.X, new Number(10)); var str = exp.ToString(); - Assert.Equal("x <<= 10", str); + Assert.That(str, Is.EqualTo("x <<= 10")); } - [Fact] + [Test] public void RightShiftAssignTest() { var exp = new RightShiftAssign(Variable.X, new Number(10)); var str = exp.ToString(); - Assert.Equal("x >>= 10", str); + Assert.That(str, Is.EqualTo("x >>= 10")); } - [Fact] + [Test] public void ToBinTest() { var exp = new ToBin(new Number(10)); - Assert.Equal("tobin(10)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tobin(10)")); } - [Fact] + [Test] public void ToOctTest() { var exp = new ToOct(new Number(10)); - Assert.Equal("tooct(10)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tooct(10)")); } - [Fact] + [Test] public void ToHexTest() { var exp = new ToHex(new Number(10)); - Assert.Equal("tohex(10)", exp.ToString()); + Assert.That(exp.ToString(), Is.EqualTo("tohex(10)")); } #endregion diff --git a/xFunc.Tests/Analyzers/SimplifierTests/AddSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/AddSimplifierTest.cs index ce270ed4d..33d6ff244 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/AddSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/AddSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class AddSimplifierTest : BaseSimplifierTest { - [Fact(DisplayName = "2 + x")] + [Test] public void Order1() { var add = new Add(Number.Two, Variable.X); @@ -14,7 +14,7 @@ public void Order1() SimplifyTest(add, expected); } - [Fact(DisplayName = "0 + 1")] + [Test] public void AddFirstZero() { var add = new Add(Number.Zero, Number.One); @@ -23,7 +23,7 @@ public void AddFirstZero() SimplifyTest(add, expected); } - [Fact(DisplayName = "1 + 0")] + [Test] public void AddSecondZero() { var add = new Add(Number.One, Number.Zero); @@ -32,7 +32,7 @@ public void AddSecondZero() SimplifyTest(add, expected); } - [Fact(DisplayName = "3 + 2")] + [Test] public void AddTwoNumbers() { var add = new Add(new Number(3), Number.Two); @@ -41,7 +41,7 @@ public void AddTwoNumbers() SimplifyTest(add, expected); } - [Fact(DisplayName = "90 + 2 rad")] + [Test] public void AddNumberAngle() { var add = new Add( @@ -53,7 +53,7 @@ public void AddNumberAngle() SimplifyTest(add, expected); } - [Fact(DisplayName = "90 deg + 2")] + [Test] public void AddAngleNumber() { var add = new Add( @@ -65,7 +65,7 @@ public void AddAngleNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "90 deg + 2 rad")] + [Test] public void AddTwoAngles() { var add = new Add( @@ -77,7 +77,7 @@ public void AddTwoAngles() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 W")] + [Test] public void AddNumberAndPower() { var add = new Add( @@ -89,7 +89,7 @@ public void AddNumberAndPower() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 W + 10")] + [Test] public void AddPowerAndNumber() { var add = new Add( @@ -101,7 +101,7 @@ public void AddPowerAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 W + 10 kW")] + [Test] public void AddTwoPowers() { var add = new Add( @@ -113,7 +113,7 @@ public void AddTwoPowers() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 C°")] + [Test] public void AddNumberAndTemperature() { var add = new Add( @@ -125,7 +125,7 @@ public void AddNumberAndTemperature() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 C° + 10")] + [Test] public void AddTemperatureAndNumber() { var add = new Add( @@ -137,7 +137,7 @@ public void AddTemperatureAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 C° + 10 K")] + [Test] public void AddTwoTemperatures() { var add = new Add( @@ -149,7 +149,7 @@ public void AddTwoTemperatures() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 g")] + [Test] public void AddNumberAndMass() { var add = new Add( @@ -161,7 +161,7 @@ public void AddNumberAndMass() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 g + 10")] + [Test] public void AddMassAndNumber() { var add = new Add( @@ -173,7 +173,7 @@ public void AddMassAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 g + 10 kg")] + [Test] public void AddTwoMasses() { var add = new Add( @@ -185,7 +185,7 @@ public void AddTwoMasses() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 m")] + [Test] public void AddNumberAndLength() { var add = new Add( @@ -197,7 +197,7 @@ public void AddNumberAndLength() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 m + 10")] + [Test] public void AddLengthAndNumber() { var add = new Add( @@ -209,7 +209,7 @@ public void AddLengthAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 km + 10 m")] + [Test] public void AddTwoLengths() { var add = new Add( @@ -221,7 +221,7 @@ public void AddTwoLengths() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 s")] + [Test] public void AddNumberAndTime() { var add = new Add( @@ -233,7 +233,7 @@ public void AddNumberAndTime() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 s + 10")] + [Test] public void AddTimeAndNumber() { var add = new Add( @@ -245,7 +245,7 @@ public void AddTimeAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 min + 10 s")] + [Test] public void AddTwoTimeValues() { var add = new Add( @@ -257,7 +257,7 @@ public void AddTwoTimeValues() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 m^2")] + [Test] public void AddNumberAndArea() { var add = new Add( @@ -269,7 +269,7 @@ public void AddNumberAndArea() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 m^2 + 10")] + [Test] public void AddAreaAndNumber() { var add = new Add( @@ -281,7 +281,7 @@ public void AddAreaAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 km^2 + 500000 m^2")] + [Test] public void AddTwoAreaValues() { var add = new Add( @@ -293,7 +293,7 @@ public void AddTwoAreaValues() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 + 10 m^3")] + [Test] public void AddNumberAndVolume() { var add = new Add( @@ -305,7 +305,7 @@ public void AddNumberAndVolume() SimplifyTest(add, expected); } - [Fact(DisplayName = "10 m^3 + 10")] + [Test] public void AddVolumeAndNumber() { var add = new Add( @@ -317,7 +317,7 @@ public void AddVolumeAndNumber() SimplifyTest(add, expected); } - [Fact(DisplayName = "1 m^3 + 500000 cm^3")] + [Test] public void AddTwoVolumeValues() { var add = new Add( @@ -329,7 +329,7 @@ public void AddTwoVolumeValues() SimplifyTest(add, expected); } - [Fact(DisplayName = "-x + 2")] + [Test] public void AddFirstUnaryMinus() { var add = new Add(new UnaryMinus(Variable.X), Number.Two); @@ -338,7 +338,7 @@ public void AddFirstUnaryMinus() SimplifyTest(add, expected); } - [Fact(DisplayName = "2 + (-x)")] + [Test] public void AddSecondUnaryMinus() { var add = new Add(Number.Two, new UnaryMinus(Variable.X)); @@ -347,7 +347,7 @@ public void AddSecondUnaryMinus() SimplifyTest(add, expected); } - [Fact(DisplayName = "2 + (2 + x)")] + [Test] public void AddDiffNumAdd_NumAddVar_() { var add = new Add(Number.Two, new Add(Number.Two, Variable.X)); @@ -356,7 +356,7 @@ public void AddDiffNumAdd_NumAddVar_() SimplifyTest(add, expected); } - [Fact(DisplayName = "2 + (x + 2)")] + [Test] public void AddDiffNumAdd_VarAddNum_() { var add = new Add(Number.Two, new Add(Variable.X, Number.Two)); @@ -365,7 +365,7 @@ public void AddDiffNumAdd_VarAddNum_() SimplifyTest(add, expected); } - [Fact(DisplayName = "(2 + x) + 2")] + [Test] public void AddDiff_NumAddVar_AddNum() { var add = new Add(new Add(Number.Two, Variable.X), Number.Two); @@ -374,7 +374,7 @@ public void AddDiff_NumAddVar_AddNum() SimplifyTest(add, expected); } - [Fact(DisplayName = "(x + 2) + 2")] + [Test] public void AddDiff_VarAddNum_AddNum() { var add = new Add(new Add(Variable.X, Number.Two), Number.Two); @@ -383,7 +383,7 @@ public void AddDiff_VarAddNum_AddNum() SimplifyTest(add, expected); } - [Fact(DisplayName = "2 + (2 - x)")] + [Test] public void AddDiffNum_NumSubVar_() { var add = new Add(Number.Two, new Sub(Number.Two, Variable.X)); @@ -392,7 +392,7 @@ public void AddDiffNum_NumSubVar_() SimplifyTest(add, expected); } - [Fact(DisplayName = "2 + (x - 2)")] + [Test] public void AddDiffNum_VarSubNum_() { var add = new Add(Number.Two, new Sub(Variable.X, Number.Two)); @@ -401,7 +401,7 @@ public void AddDiffNum_VarSubNum_() SimplifyTest(add, expected); } - [Fact(DisplayName = "(2 - x) + 2")] + [Test] public void AddDiff_NumSubVar_AddNum() { var add = new Add(new Sub(Number.Two, Variable.X), Number.Two); @@ -410,7 +410,7 @@ public void AddDiff_NumSubVar_AddNum() SimplifyTest(add, expected); } - [Fact(DisplayName = "(x - 2) + 2")] + [Test] public void AddDiff_VarSubNum_AddNum() { var add = new Add(new Sub(Variable.X, Number.Two), Number.Two); @@ -419,7 +419,7 @@ public void AddDiff_VarSubNum_AddNum() SimplifyTest(add, expected); } - [Fact(DisplayName = "x + x")] + [Test] public void AddSaveVars1() { var exp = new Add(Variable.X, Variable.X); @@ -428,7 +428,7 @@ public void AddSaveVars1() SimplifyTest(exp, expected); } - [Fact(DisplayName = "2x + x")] + [Test] public void AddSaveVars2() { var exp = new Add(new Mul(Number.Two, Variable.X), Variable.X); @@ -437,7 +437,7 @@ public void AddSaveVars2() SimplifyTest(exp, expected); } - [Fact(DisplayName = "2 * (x + y) + (x + y)")] + [Test] public void AddComplexX() { var exp = new Add( @@ -448,7 +448,7 @@ public void AddComplexX() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x + 2x")] + [Test] public void AddSaveVars3() { var exp = new Add(Variable.X, new Mul(Number.Two, Variable.X)); @@ -457,7 +457,7 @@ public void AddSaveVars3() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x + x * 2")] + [Test] public void AddSaveVars4() { var exp = new Add(Variable.X, new Mul(Variable.X, Number.Two)); @@ -466,7 +466,7 @@ public void AddSaveVars4() SimplifyTest(exp, expected); } - [Fact(DisplayName = "2x + 3x")] + [Test] public void AddSaveVars5() { var exp = new Add( @@ -478,7 +478,7 @@ public void AddSaveVars5() SimplifyTest(exp, expected); } - [Fact(DisplayName = "2 * (x + y) + 3 * (x + y)")] + [Test] public void AddComplexX2() { var exp = new Add( @@ -493,7 +493,7 @@ public void AddComplexX2() SimplifyTest(exp, expected); } - [Fact(DisplayName = "-x + x")] + [Test] public void AddSaveVars6() { var exp = new Add(new UnaryMinus(Variable.X), Variable.X); @@ -502,7 +502,7 @@ public void AddSaveVars6() SimplifyTest(exp, expected); } - [Fact(DisplayName = "-x + 2x")] + [Test] public void AddSaveVars7() { var exp = new Add( @@ -514,7 +514,7 @@ public void AddSaveVars7() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x * 2 + x")] + [Test] public void AddSaveVars8() { var exp = new Add(new Mul(Variable.X, Number.Two), Variable.X); @@ -523,7 +523,7 @@ public void AddSaveVars8() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x * 2 + x * 3")] + [Test] public void AddSaveVars9() { var exp = new Add( @@ -535,7 +535,7 @@ public void AddSaveVars9() SimplifyTest(exp, expected); } - [Fact(DisplayName = "3x + -2x")] + [Test] public void AddSaveVars10() { var exp = new Add( @@ -547,7 +547,7 @@ public void AddSaveVars10() SimplifyTest(exp, expected); } - [Fact(DisplayName = "3x + -4x")] + [Test] public void AddSaveVars11() { var exp = new Add( @@ -559,7 +559,7 @@ public void AddSaveVars11() SimplifyTest(exp, expected); } - [Fact(DisplayName = "-2x + x * 3")] + [Test] public void AddSameVars12() { var exp = new Add( @@ -571,7 +571,7 @@ public void AddSameVars12() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x * 3 + -2x")] + [Test] public void AddSameVars13() { var exp = new Add( @@ -583,7 +583,7 @@ public void AddSameVars13() SimplifyTest(exp, expected); } - [Fact] + [Test] public void AddArgumentSimplified() { var exp = new Add( diff --git a/xFunc.Tests/Analyzers/SimplifierTests/AngleSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/AngleSimplifierTest.cs index 1674b73c0..667b94ace 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/AngleSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/AngleSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class AngleSimplifierTest : BaseSimplifierTest { - [Fact] + [Test] public void ToDegreeNumber() { var exp = new ToDegree(new Number(10)); @@ -14,7 +14,7 @@ public void ToDegreeNumber() SimplifyTest(exp, expected); } - [Fact] + [Test] public void DegreeToDegree() { var exp = new ToDegree(AngleValue.Degree(10).AsExpression()); @@ -23,7 +23,7 @@ public void DegreeToDegree() SimplifyTest(exp, expected); } - [Fact] + [Test] public void RadianToDegree() { var exp = new ToDegree(AngleValue.Radian(Math.PI).AsExpression()); @@ -32,7 +32,7 @@ public void RadianToDegree() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToDegreeArgumentSimplified() { var exp = new ToDegree( @@ -45,7 +45,7 @@ public void ToDegreeArgumentSimplified() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToDegreeNotSimplified() { var exp = new ToDegree(Variable.X); @@ -53,7 +53,7 @@ public void ToDegreeNotSimplified() SimplifyTest(exp, exp); } - [Fact] + [Test] public void ToRadianNumber() { var exp = new ToRadian(new Number(10)); @@ -62,7 +62,7 @@ public void ToRadianNumber() SimplifyTest(exp, expected); } - [Fact] + [Test] public void RadianToRadian() { var exp = new ToRadian(AngleValue.Radian(10).AsExpression()); @@ -71,7 +71,7 @@ public void RadianToRadian() SimplifyTest(exp, expected); } - [Fact] + [Test] public void DegreeToRadian() { var exp = new ToRadian(AngleValue.Degree(180).AsExpression()); @@ -80,7 +80,7 @@ public void DegreeToRadian() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToRadianArgumentSimplified() { var exp = new ToRadian( @@ -93,7 +93,7 @@ public void ToRadianArgumentSimplified() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToRadianNotSimplified() { var exp = new ToRadian(Variable.X); @@ -101,7 +101,7 @@ public void ToRadianNotSimplified() SimplifyTest(exp, exp); } - [Fact] + [Test] public void ToGradianNumber() { var exp = new ToGradian(new Number(10)); @@ -110,7 +110,7 @@ public void ToGradianNumber() SimplifyTest(exp, expected); } - [Fact] + [Test] public void GradianToGradian() { var exp = new ToGradian(AngleValue.Gradian(10).AsExpression()); @@ -119,7 +119,7 @@ public void GradianToGradian() SimplifyTest(exp, expected); } - [Fact] + [Test] public void DegreeToGradian() { var exp = new ToGradian(AngleValue.Degree(180).AsExpression()); @@ -128,7 +128,7 @@ public void DegreeToGradian() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToGradianArgumentSimplified() { var exp = new ToGradian( @@ -141,7 +141,7 @@ public void ToGradianArgumentSimplified() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToGradianNotSimplified() { var exp = new ToGradian(Variable.X); diff --git a/xFunc.Tests/Analyzers/SimplifierTests/BaseSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/BaseSimplifierTest.cs index 1e0c3ddf2..4a8790223 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/BaseSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/BaseSimplifierTest.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Reflection; -using Xunit.Sdk; +using NUnit.Framework.Internal; namespace xFunc.Tests.Analyzers.SimplifierTests; @@ -19,7 +19,7 @@ protected void SimplifyTest(IExpression exp, IExpression expected) { var simple = exp.Analyze(simplifier); - Assert.Equal(expected, simple); + Assert.That(simple, Is.EqualTo(expected)); } protected void TestNullExp(Type type) @@ -38,6 +38,6 @@ protected void TestNullExp(Type type) throw; } - throw new XunitException("The exception is expected."); + throw new NUnitException("The exception is expected."); } } \ No newline at end of file diff --git a/xFunc.Tests/Analyzers/SimplifierTests/DivSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/DivSimplifierTest.cs index b60ea0f5e..73a8382c3 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/DivSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/DivSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class DivSimplifierTest : BaseSimplifierTest { - [Fact(DisplayName = "0 / x")] + [Test] public void DivZero() { var div = new Div(Number.Zero, Variable.X); @@ -14,7 +14,7 @@ public void DivZero() SimplifyTest(div, expected); } - [Fact(DisplayName = "x / 0")] + [Test] public void DivByZero() { var div = new Div(Variable.X, Number.Zero); @@ -22,7 +22,7 @@ public void DivByZero() Assert.Throws(() => SimplifyTest(div, null)); } - [Fact(DisplayName = "0 / 0")] + [Test] public void ZeroDivByZero() { var div = new Div(Number.Zero, Number.Zero); @@ -31,7 +31,7 @@ public void ZeroDivByZero() Assert.True(actual.Value.IsNaN); } - [Fact(DisplayName = "x / 1")] + [Test] public void DivByOne() { var div = new Div(Variable.X, Number.One); @@ -40,7 +40,7 @@ public void DivByOne() SimplifyTest(div, expected); } - [Fact(DisplayName = "8 / 2")] + [Test] public void DivTwoNumbers() { var div = new Div(new Number(8), Number.Two); @@ -49,7 +49,7 @@ public void DivTwoNumbers() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 deg / 2")] + [Test] public void DivAngleNumber() { var div = new Div( @@ -61,7 +61,7 @@ public void DivAngleNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 W / 2")] + [Test] public void DivPowerByNumber() { var div = new Div( @@ -73,7 +73,7 @@ public void DivPowerByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 C° / 2")] + [Test] public void DivTemperatureByNumber() { var div = new Div( @@ -85,7 +85,7 @@ public void DivTemperatureByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 g / 2")] + [Test] public void DivMassByNumber() { var div = new Div( @@ -97,7 +97,7 @@ public void DivMassByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 m / 2")] + [Test] public void DivLengthByNumber() { var div = new Div( @@ -109,7 +109,7 @@ public void DivLengthByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 s / 2")] + [Test] public void DivTimeByNumber() { var div = new Div( @@ -121,7 +121,7 @@ public void DivTimeByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 m^2 / 2")] + [Test] public void DivAreaByNumber() { var div = new Div( @@ -133,7 +133,7 @@ public void DivAreaByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "90 m^3 / 2")] + [Test] public void DivVolumeByNumber() { var div = new Div( @@ -145,7 +145,7 @@ public void DivVolumeByNumber() SimplifyTest(div, expected); } - [Fact(DisplayName = "(2 * x) / 4")] + [Test] public void DivDiff_NumMulVar_DivNum() { var div = new Div(new Mul(Number.Two, Variable.X), new Number(4)); @@ -154,7 +154,7 @@ public void DivDiff_NumMulVar_DivNum() SimplifyTest(div, expected); } - [Fact(DisplayName = "(x * 2) / 4")] + [Test] public void DivDiff_VarMulNum_DivNum() { var div = new Div(new Mul(Variable.X, Number.Two), new Number(4)); @@ -163,7 +163,7 @@ public void DivDiff_VarMulNum_DivNum() SimplifyTest(div, expected); } - [Fact(DisplayName = "2 / (2 * x)")] + [Test] public void DivDiffNumDiv_NumMulVar_() { var div = new Div(Number.Two, new Mul(Number.Two, Variable.X)); @@ -172,7 +172,7 @@ public void DivDiffNumDiv_NumMulVar_() SimplifyTest(div, expected); } - [Fact(DisplayName = "2 / (2 * x)")] + [Test] public void DivDiffNumDiv_VarMulNum_() { var div = new Div(Number.Two, new Mul(Variable.X, Number.Two)); @@ -181,7 +181,7 @@ public void DivDiffNumDiv_VarMulNum_() SimplifyTest(div, expected); } - [Fact(DisplayName = "(2 / x) / 2")] + [Test] public void DivDiff_NumDivVar_DivNum() { var div = new Div(new Div(Number.Two, Variable.X), Number.Two); @@ -190,7 +190,7 @@ public void DivDiff_NumDivVar_DivNum() SimplifyTest(div, expected); } - [Fact(DisplayName = "(x / 2) / 2")] + [Test] public void DivDiff_VarDivNum_DivNum() { var div = new Div(new Div(Variable.X, Number.Two), Number.Two); @@ -199,7 +199,7 @@ public void DivDiff_VarDivNum_DivNum() SimplifyTest(div, expected); } - [Fact(DisplayName = "2 / (2 / x)")] + [Test] public void DivDiffNumDiv_NumDivVar_() { var div = new Div(Number.Two, new Div(Number.Two, Variable.X)); @@ -208,7 +208,7 @@ public void DivDiffNumDiv_NumDivVar_() SimplifyTest(div, expected); } - [Fact(DisplayName = "2 / (x / 2)")] + [Test] public void DivDiffNumDiv_VarDivNum_() { var div = new Div(Number.Two, new Div(Variable.X, Number.Two)); @@ -217,7 +217,7 @@ public void DivDiffNumDiv_VarDivNum_() SimplifyTest(div, expected); } - [Fact(DisplayName = "x / x")] + [Test] public void DivSameVars() { var div = new Div(Variable.X, Variable.X); @@ -226,7 +226,7 @@ public void DivSameVars() SimplifyTest(div, expected); } - [Fact] + [Test] public void DivArgumentSimplified() { var exp = new Div( diff --git a/xFunc.Tests/Analyzers/SimplifierTests/LogSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/LogSimplifierTest.cs index 46d41b06d..41e8f7569 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/LogSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/LogSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class LogSimplifierTest : BaseSimplifierTest { - [Fact] + [Test] public void Log() { var log = new Log(Variable.X, Variable.X); @@ -14,7 +14,7 @@ public void Log() SimplifyTest(log, expected); } - [Fact] + [Test] public void LogNotSimplified() { var log = new Log(new Number(3), new Number(11)); @@ -22,7 +22,7 @@ public void LogNotSimplified() SimplifyTest(log, log); } - [Fact] + [Test] public void LogArgumentSimplified() { var log = new Log(Variable.X, new Add(Number.One, Number.One)); @@ -31,7 +31,7 @@ public void LogArgumentSimplified() SimplifyTest(log, expected); } - [Fact] + [Test] public void Ln() { var ln = new Ln(new Variable("e")); @@ -40,7 +40,7 @@ public void Ln() SimplifyTest(ln, expected); } - [Fact] + [Test] public void LnArgumentSimplified() { var log = new Ln(new Add(Number.Two, Number.Two)); @@ -49,7 +49,7 @@ public void LnArgumentSimplified() SimplifyTest(log, expected); } - [Fact] + [Test] public void LnNotSimplified() { var ln = new Ln(new Variable("z")); @@ -57,7 +57,7 @@ public void LnNotSimplified() SimplifyTest(ln, ln); } - [Fact] + [Test] public void Lg() { var log = new Lg(new Number(10)); @@ -66,7 +66,7 @@ public void Lg() SimplifyTest(log, expected); } - [Fact] + [Test] public void LgArgumentSimplified() { var log = new Lg(new Add(Number.Two, Number.Two)); @@ -75,7 +75,7 @@ public void LgArgumentSimplified() SimplifyTest(log, expected); } - [Fact] + [Test] public void LgNotSimplified() { var log = new Lg(new Number(101)); @@ -83,7 +83,7 @@ public void LgNotSimplified() SimplifyTest(log, log); } - [Fact] + [Test] public void Lb() { var log = new Lb(Number.Two); @@ -92,7 +92,7 @@ public void Lb() SimplifyTest(log, expected); } - [Fact] + [Test] public void LbArgumentSimplified() { var log = new Lb(new Add(Number.Two, Number.Two)); @@ -101,7 +101,7 @@ public void LbArgumentSimplified() SimplifyTest(log, expected); } - [Fact] + [Test] public void LbNotSimplified() { var log = new Lb(new Number(3)); diff --git a/xFunc.Tests/Analyzers/SimplifierTests/MulSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/MulSimplifierTest.cs index e2f33b51c..268560345 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/MulSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/MulSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class MulSimplifierTest : BaseSimplifierTest { - [Fact(DisplayName = "x * 2")] + [Test] public void Order1() { var add = new Mul(Variable.X, Number.Two); @@ -14,7 +14,7 @@ public void Order1() SimplifyTest(add, expected); } - [Fact(DisplayName = "0 * 10")] + [Test] public void MulByFirstZero() { var mul = new Mul(Number.Zero, new Number(10)); @@ -23,7 +23,7 @@ public void MulByFirstZero() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 0")] + [Test] public void MulBySecondZero() { var mul = new Mul(new Number(10), Number.Zero); @@ -32,7 +32,7 @@ public void MulBySecondZero() SimplifyTest(mul, expected); } - [Fact(DisplayName = "1 * 10")] + [Test] public void MulFirstOne() { var mul = new Mul(Number.One, new Number(10)); @@ -41,7 +41,7 @@ public void MulFirstOne() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 1")] + [Test] public void MulSecondOne() { var mul = new Mul(new Number(10), Number.One); @@ -50,7 +50,7 @@ public void MulSecondOne() SimplifyTest(mul, expected); } - [Fact(DisplayName = "-1 * 10")] + [Test] public void MulFirstMinusOne() { var mul = new Mul(new Number(-1), new Number(10)); @@ -59,7 +59,7 @@ public void MulFirstMinusOne() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * -1")] + [Test] public void MulSecondMinusOne() { var mul = new Mul(new Number(10), new Number(-1)); @@ -68,7 +68,7 @@ public void MulSecondMinusOne() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * 3")] + [Test] public void MulTwoNumbers() { var mul = new Mul(Number.Two, new Number(3)); @@ -77,7 +77,7 @@ public void MulTwoNumbers() SimplifyTest(mul, expected); } - [Fact(DisplayName = "90 * 2 deg")] + [Test] public void MulNumberAngle() { var mul = new Mul( @@ -89,7 +89,7 @@ public void MulNumberAngle() SimplifyTest(mul, expected); } - [Fact(DisplayName = "90 deg * 2")] + [Test] public void MulAngleNumber() { var mul = new Mul( @@ -101,7 +101,7 @@ public void MulAngleNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 W")] + [Test] public void MulNumberByPower() { var mul = new Mul( @@ -113,7 +113,7 @@ public void MulNumberByPower() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 W * 10")] + [Test] public void MulPowerByNumber() { var mul = new Mul( @@ -125,7 +125,7 @@ public void MulPowerByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 C°")] + [Test] public void MulNumberByTemperature() { var mul = new Mul( @@ -137,7 +137,7 @@ public void MulNumberByTemperature() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 C° * 10")] + [Test] public void MulTemperatureByNumber() { var mul = new Mul( @@ -149,7 +149,7 @@ public void MulTemperatureByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 g")] + [Test] public void MulNumberByMass() { var mul = new Mul( @@ -161,7 +161,7 @@ public void MulNumberByMass() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 g * 10")] + [Test] public void MulMassByNumber() { var mul = new Mul( @@ -173,7 +173,7 @@ public void MulMassByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 m")] + [Test] public void MulNumberByLength() { var mul = new Mul( @@ -185,7 +185,7 @@ public void MulNumberByLength() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 m * 10")] + [Test] public void MulLengthByNumber() { var mul = new Mul( @@ -197,7 +197,7 @@ public void MulLengthByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 m * 2 m")] + [Test] public void MulLengthByLength() { var mul = new Mul( @@ -209,7 +209,7 @@ public void MulLengthByLength() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 m^2 * 2 m")] + [Test] public void MulAreaByLength() { var mul = new Mul( @@ -221,7 +221,7 @@ public void MulAreaByLength() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 m * 2 m^2")] + [Test] public void MulLengthByArea() { var mul = new Mul( @@ -233,7 +233,7 @@ public void MulLengthByArea() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 s")] + [Test] public void MulNumberByTime() { var mul = new Mul( @@ -245,7 +245,7 @@ public void MulNumberByTime() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 s * 10")] + [Test] public void MulTimeByNumber() { var mul = new Mul( @@ -257,7 +257,7 @@ public void MulTimeByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 m^2")] + [Test] public void MulNumberByArea() { var mul = new Mul( @@ -269,7 +269,7 @@ public void MulNumberByArea() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 m^2 * 10")] + [Test] public void MulAreaByNumber() { var mul = new Mul( @@ -281,7 +281,7 @@ public void MulAreaByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "10 * 2 m^3")] + [Test] public void MulNumberByVolume() { var mul = new Mul( @@ -293,7 +293,7 @@ public void MulNumberByVolume() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 m^3 * 10")] + [Test] public void MulVolumeByNumber() { var mul = new Mul( @@ -305,7 +305,7 @@ public void MulVolumeByNumber() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * (2 * x)")] + [Test] public void MulDiffNumMul_NumMulVar_() { var mul = new Mul(Number.Two, new Mul(Number.Two, Variable.X)); @@ -314,7 +314,7 @@ public void MulDiffNumMul_NumMulVar_() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * (x * 2)")] + [Test] public void MulDiffNumMul_VarMulNum_() { var mul = new Mul(Number.Two, new Mul(Variable.X, Number.Two)); @@ -323,7 +323,7 @@ public void MulDiffNumMul_VarMulNum_() SimplifyTest(mul, expected); } - [Fact(DisplayName = "(2 * x) * 2")] + [Test] public void MulDiff_NumMulVar_MulNum() { var mul = new Mul(new Mul(Number.Two, Variable.X), Number.Two); @@ -332,7 +332,7 @@ public void MulDiff_NumMulVar_MulNum() SimplifyTest(mul, expected); } - [Fact(DisplayName = "(x * 2) * 2")] + [Test] public void MulDiff_VarMulNum_MulNum() { var mul = new Mul(new Mul(Variable.X, Number.Two), Number.Two); @@ -341,7 +341,7 @@ public void MulDiff_VarMulNum_MulNum() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * (2 / x)")] + [Test] public void MulDiffNumMul_NumDivVar_() { var mul = new Mul(Number.Two, new Div(Number.Two, Variable.X)); @@ -350,7 +350,7 @@ public void MulDiffNumMul_NumDivVar_() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * (x / 2)")] + [Test] public void MulDiffNumMul_VarDivNum_() { var mul = new Mul(Number.Two, new Div(Variable.X, Number.Two)); @@ -359,7 +359,7 @@ public void MulDiffNumMul_VarDivNum_() SimplifyTest(mul, expected); } - [Fact(DisplayName = "(2 / x) * 2")] + [Test] public void MulDiff_NumDivVar_MulNum() { var mul = new Mul(new Div(Number.Two, Variable.X), Number.Two); @@ -368,7 +368,7 @@ public void MulDiff_NumDivVar_MulNum() SimplifyTest(mul, expected); } - [Fact(DisplayName = "(x / 2) * 2")] + [Test] public void MulDiff_VarDivNum_MulNum() { var mul = new Mul(new Div(Variable.X, Number.Two), Number.Two); @@ -377,7 +377,7 @@ public void MulDiff_VarDivNum_MulNum() SimplifyTest(mul, expected); } - [Fact(DisplayName = "x * x")] + [Test] public void MulSameVar1() { var mul = new Mul(Variable.X, Variable.X); @@ -386,7 +386,7 @@ public void MulSameVar1() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * x")] + [Test] public void MulSameVar2() { var mul = new Mul(new Mul(Number.Two, Variable.X), Variable.X); @@ -395,7 +395,7 @@ public void MulSameVar2() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * (x + y) * (x + y)")] + [Test] public void MulComplexX() { var mul = new Mul( @@ -410,7 +410,7 @@ public void MulComplexX() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * 3x")] + [Test] public void MulSameVar3() { var mul = new Mul( @@ -422,7 +422,7 @@ public void MulSameVar3() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2 * (x + y) * 3 * (x + y)")] + [Test] public void MulComplexX2() { var mul = new Mul( @@ -437,7 +437,7 @@ public void MulComplexX2() SimplifyTest(mul, expected); } - [Fact(DisplayName = "x * 2x")] + [Test] public void MulSameVar4() { var mul = new Mul(Variable.X, new Mul(Number.Two, Variable.X)); @@ -446,7 +446,7 @@ public void MulSameVar4() SimplifyTest(mul, expected); } - [Fact(DisplayName = "x * (x * 2)")] + [Test] public void MulSameVar5() { var mul = new Mul(Variable.X, new Mul(Variable.X, Number.Two)); @@ -455,7 +455,7 @@ public void MulSameVar5() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * x")] + [Test] public void MulSameVar6() { var mul = new Mul(new Mul(Number.Two, Variable.X), Variable.X); @@ -464,7 +464,7 @@ public void MulSameVar6() SimplifyTest(mul, expected); } - [Fact(DisplayName = "(x * 2) * x")] + [Test] public void MulSameVar7() { var mul = new Mul(new Mul(Variable.X, Number.Two), Variable.X); @@ -473,7 +473,7 @@ public void MulSameVar7() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * 3x")] + [Test] public void MulSameVar8() { var mul = new Mul( @@ -485,7 +485,7 @@ public void MulSameVar8() SimplifyTest(mul, expected); } - [Fact(DisplayName = "(x * 2) * (x * 3)")] + [Test] public void MulSameVar9() { var mul = new Mul( @@ -497,7 +497,7 @@ public void MulSameVar9() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * -2x")] + [Test] public void MulSameVar10() { var mul = new Mul( @@ -509,7 +509,7 @@ public void MulSameVar10() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * -3x")] + [Test] public void MulSameVar11() { var mul = new Mul( @@ -521,7 +521,7 @@ public void MulSameVar11() SimplifyTest(mul, expected); } - [Fact(DisplayName = "2x * x * (-3)")] + [Test] public void MulSameVar12() { var mul = new Mul( @@ -533,7 +533,7 @@ public void MulSameVar12() SimplifyTest(mul, expected); } - [Fact(DisplayName = "x * 2 * -3x")] + [Test] public void MulSameVar13() { var mul = new Mul( @@ -545,7 +545,7 @@ public void MulSameVar13() SimplifyTest(mul, expected); } - [Fact(DisplayName = "cos(cos(x)) * -sin(x)")] + [Test] public void MulNegativeRightParamTest1() { var mul = new Mul( @@ -560,7 +560,7 @@ public void MulNegativeRightParamTest1() SimplifyTest(mul, expected); } - [Fact] + [Test] public void MulArgumentSimplified() { var exp = new Mul( @@ -572,7 +572,7 @@ public void MulArgumentSimplified() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x * (1 / x)")] + [Test] public void MulDiv1() { var exp = new Mul( @@ -584,7 +584,7 @@ public void MulDiv1() SimplifyTest(exp, expected); } - [Fact(DisplayName = "(2 * x) * (1 / x)")] + [Test] public void MulDiv2() { var exp = new Mul( @@ -596,7 +596,7 @@ public void MulDiv2() SimplifyTest(exp, expected); } - [Fact(DisplayName = "(x * 2) * (1 / x)")] + [Test] public void MulDiv3() { var exp = new Mul( diff --git a/xFunc.Tests/Analyzers/SimplifierTests/PowerSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/PowerSimplifierTest.cs index 87a4bd681..616d55e2d 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/PowerSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/PowerSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class PowerSimplifierTest : BaseSimplifierTest { - [Fact] + [Test] public void PowerXZero() { var pow = new Pow(Variable.X, Number.Zero); @@ -14,7 +14,7 @@ public void PowerXZero() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowerZeroX() { var pow = new Pow(Number.Zero, Variable.X); @@ -23,7 +23,7 @@ public void PowerZeroX() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowerOne() { var pow = new Pow(Variable.X, Number.One); @@ -32,7 +32,7 @@ public void PowerOne() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowerArgumentSimplified() { var pow = new Pow(Variable.X, new Add(Number.One, Number.One)); @@ -41,7 +41,7 @@ public void PowerArgumentSimplified() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowerNotSimplified() { var pow = new Pow(Variable.X, Variable.X); @@ -49,7 +49,7 @@ public void PowerNotSimplified() SimplifyTest(pow, pow); } - [Fact] + [Test] public void PowLog() { var pow = new Pow( @@ -60,7 +60,7 @@ public void PowLog() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowLg() { var pow = new Pow( @@ -71,7 +71,7 @@ public void PowLg() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowLn() { var pow = new Pow( @@ -82,7 +82,7 @@ public void PowLn() SimplifyTest(pow, expected); } - [Fact] + [Test] public void PowLb() { var pow = new Pow( @@ -93,7 +93,7 @@ public void PowLb() SimplifyTest(pow, expected); } - [Fact] + [Test] public void RootOne() { var root = new Root(Variable.X, Number.One); @@ -102,7 +102,7 @@ public void RootOne() SimplifyTest(root, expected); } - [Fact] + [Test] public void RootArgumentSimplified() { var root = new Root(Variable.X, new Add(Number.One, Number.One)); @@ -111,7 +111,7 @@ public void RootArgumentSimplified() SimplifyTest(root, expected); } - [Fact] + [Test] public void RootNotSimplified() { var root = new Root(Variable.X, new Number(5)); @@ -119,7 +119,7 @@ public void RootNotSimplified() SimplifyTest(root, root); } - [Fact] + [Test] public void Exp() { var exp = new Exp(new Number(30)); @@ -127,7 +127,7 @@ public void Exp() SimplifyTest(exp, exp); } - [Fact] + [Test] public void ExpLn() { var exp = new Exp(new Ln(new Number(30))); @@ -136,7 +136,7 @@ public void ExpLn() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ExpArgumentSimplified() { var exp = new Exp(new Add(Number.One, Number.One)); diff --git a/xFunc.Tests/Analyzers/SimplifierTests/SimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/SimplifierTest.cs index 18c48f882..5bd9c7204 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/SimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/SimplifierTest.cs @@ -7,7 +7,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class SimplifierTest : BaseSimplifierTest { - [Fact] + [Test] public void DoubleUnary() { var un = new UnaryMinus(new UnaryMinus(Variable.X)); @@ -16,7 +16,7 @@ public void DoubleUnary() SimplifyTest(un, expected); } - [Fact] + [Test] public void UnaryNumber() { var un = new UnaryMinus(Number.One); @@ -25,7 +25,7 @@ public void UnaryNumber() SimplifyTest(un, expected); } - [Fact] + [Test] public void UnaryNumberArgumentSimplified() { var un = new UnaryMinus( @@ -38,7 +38,7 @@ public void UnaryNumberArgumentSimplified() SimplifyTest(un, expected); } - [Fact] + [Test] public void UnaryNumberNotSimplified() { var un = new UnaryMinus(Variable.X); @@ -46,7 +46,7 @@ public void UnaryNumberNotSimplified() SimplifyTest(un, un); } - [Fact] + [Test] public void Define() { var define = new Assign(Variable.X, new Add(Number.Two, Number.Two)); @@ -55,7 +55,7 @@ public void Define() SimplifyTest(define, expected); } - [Fact] + [Test] public void DefineNotSimplifierTest() { var define = new Assign(Variable.X, Number.Two); @@ -63,7 +63,7 @@ public void DefineNotSimplifierTest() SimplifyTest(define, define); } - [Fact] + [Test] public void Simplify() { var simp = new Simplify(simplifier, new Pow(Variable.X, Number.Zero)); @@ -72,7 +72,7 @@ public void Simplify() SimplifyTest(simp, expected); } - [Fact] + [Test] public void Deriv() { var diff = new Differentiator(); @@ -83,7 +83,7 @@ public void Deriv() SimplifyTest(simp, expected); } - [Fact] + [Test] public void DerivNotSimplifiedTest() { var differentiator = new Differentiator(); @@ -93,7 +93,7 @@ public void DerivNotSimplifiedTest() SimplifyTest(exp, exp); } - [Fact] + [Test] public void DiffTest() { var exp = new Count(new IExpression[] { new Add(Number.Two, Number.Two) }); @@ -102,7 +102,7 @@ public void DiffTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void UnaryMinusNumberTest() { var exp = new Abs(new UnaryMinus(Variable.X)); @@ -111,7 +111,7 @@ public void UnaryMinusNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void AbsAbsTest() { var exp = new Abs(new Abs(Variable.X)); @@ -120,7 +120,7 @@ public void AbsAbsTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void AbsAbsAbsTest() { var exp = new Abs(new Abs(new Abs(Variable.X))); @@ -129,7 +129,7 @@ public void AbsAbsAbsTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void AbsArgumentSimplifiedTest() { var exp = new Abs(new Add(Number.One, Number.One)); @@ -138,7 +138,7 @@ public void AbsArgumentSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void MatrixTest() { var exp = new Matrix(new[] @@ -159,7 +159,7 @@ public void MatrixTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void MatrixNotSimplifiedTest() { var exp = new Matrix(new[] @@ -170,7 +170,7 @@ public void MatrixNotSimplifiedTest() SimplifyTest(exp, exp); } - [Fact] + [Test] public void AddAssignTest() { var exp = new AddAssign(Variable.X, new Add(Number.One, Number.Two)); @@ -179,7 +179,7 @@ public void AddAssignTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void AddAssignNotSimplifiedTest() { var exp = new AddAssign(Variable.X, Number.One); @@ -187,7 +187,7 @@ public void AddAssignNotSimplifiedTest() SimplifyTest(exp, exp); } - [Fact] + [Test] public void CeilArgumentSimplifiedTest() { var exp = new Ceil(new Add(Number.One, Number.One)); @@ -196,7 +196,7 @@ public void CeilArgumentSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void CeilNotSimplifiedTest() { var exp = new Ceil(Number.One); @@ -204,7 +204,7 @@ public void CeilNotSimplifiedTest() SimplifyTest(exp, exp); } - [Fact] + [Test] public void ModLeftSimplifiedTest() { var exp = new Mod(new Add(Number.One, Number.One), Number.One); @@ -213,7 +213,7 @@ public void ModLeftSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ModRightSimplifiedTest() { var exp = new Mod(Number.One, new Add(Number.One, Number.One)); @@ -222,7 +222,7 @@ public void ModRightSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ModNotSimplifiedTest() { var exp = new Mod(Number.One, Number.One); @@ -230,7 +230,7 @@ public void ModNotSimplifiedTest() SimplifyTest(exp, exp); } - [Fact] + [Test] public void CallExpressionSimplifiedTest() { var exp = new CallExpression( @@ -243,7 +243,7 @@ public void CallExpressionSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void CallExpressionNotSimplifiedTest() { var exp = new CallExpression( @@ -253,7 +253,7 @@ public void CallExpressionNotSimplifiedTest() SimplifyTest(exp, exp); } - [Fact] + [Test] public void LambdaExpressionSimplifiedTest() { var exp = new Lambda(new[] { "x" }, new Add(Variable.X, Number.Zero)).AsExpression(); @@ -262,7 +262,7 @@ public void LambdaExpressionSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void LambdaExpressionNotSimplifiedTest() { var exp = new Lambda(new[] { "x" }, Variable.X).AsExpression(); @@ -270,11 +270,11 @@ public void LambdaExpressionNotSimplifiedTest() SimplifyTest(exp, exp); } - [Theory] - [ClassData(typeof(AllExpressionsData))] + [Test] + [TestCaseSource(typeof(AllExpressionsData))] public void TestNullException(Type type) => TestNullExp(type); - [Fact] + [Test] public void MulOrderingTest() { // 2 * (1 * (3 * (x ^ (3 - 1)))) diff --git a/xFunc.Tests/Analyzers/SimplifierTests/SubSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/SubSimplifierTest.cs index 12d17a137..feb5c047c 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/SubSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/SubSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class SubSimplifierTest : BaseSimplifierTest { - [Fact(DisplayName = "0 - x")] + [Test] public void SubFirstZero() { var sub = new Sub(Number.Zero, Variable.X); @@ -14,7 +14,7 @@ public void SubFirstZero() SimplifyTest(sub, expected); } - [Fact(DisplayName = "x - 0")] + [Test] public void SubSecondZero() { var sub = new Sub(Variable.X, Number.Zero); @@ -23,7 +23,7 @@ public void SubSecondZero() SimplifyTest(sub, expected); } - [Fact(DisplayName = "3 - 2")] + [Test] public void SubTwoNumbers() { var sub = new Sub(new Number(3), Number.Two); @@ -32,7 +32,7 @@ public void SubTwoNumbers() SimplifyTest(sub, expected); } - [Fact(DisplayName = "90 - 2 deg")] + [Test] public void SubNumberAngle() { var sub = new Sub( @@ -44,7 +44,7 @@ public void SubNumberAngle() SimplifyTest(sub, expected); } - [Fact(DisplayName = "90 deg - 2")] + [Test] public void SubAngleNumber() { var sub = new Sub( @@ -56,7 +56,7 @@ public void SubAngleNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 rad - 90 deg")] + [Test] public void SubTwoAngles() { var sub = new Sub( @@ -68,7 +68,7 @@ public void SubTwoAngles() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 W")] + [Test] public void SubPowerFromNumber() { var sub = new Sub( @@ -80,7 +80,7 @@ public void SubPowerFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 W - 10")] + [Test] public void SubNumberFromPower() { var sub = new Sub( @@ -92,7 +92,7 @@ public void SubNumberFromPower() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 kW - 10 W")] + [Test] public void SubPowerFromPower() { var sub = new Sub( @@ -104,7 +104,7 @@ public void SubPowerFromPower() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 C°")] + [Test] public void SubTemperatureFromNumber() { var sub = new Sub( @@ -116,7 +116,7 @@ public void SubTemperatureFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 C° - 10")] + [Test] public void SubNumberFromTemperature() { var sub = new Sub( @@ -128,7 +128,7 @@ public void SubNumberFromTemperature() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 K - 10 C°")] + [Test] public void SubTemperatureFromTemperature() { var sub = new Sub( @@ -140,7 +140,7 @@ public void SubTemperatureFromTemperature() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 g")] + [Test] public void SubMassFromNumber() { var sub = new Sub( @@ -152,7 +152,7 @@ public void SubMassFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 g - 10")] + [Test] public void SubNumberFromMass() { var sub = new Sub( @@ -164,7 +164,7 @@ public void SubNumberFromMass() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 kg - 10 g")] + [Test] public void SubMassFromMass() { var sub = new Sub( @@ -176,7 +176,7 @@ public void SubMassFromMass() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 m")] + [Test] public void SubLengthFromNumber() { var sub = new Sub( @@ -188,7 +188,7 @@ public void SubLengthFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 m - 10")] + [Test] public void SubNumberFromLength() { var sub = new Sub( @@ -200,7 +200,7 @@ public void SubNumberFromLength() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 km - 10 m")] + [Test] public void SubLengthFromLength() { var sub = new Sub( @@ -212,7 +212,7 @@ public void SubLengthFromLength() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 s")] + [Test] public void SubTimeFromNumber() { var sub = new Sub( @@ -224,7 +224,7 @@ public void SubTimeFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 s - 10")] + [Test] public void SubNumberFromTime() { var sub = new Sub( @@ -236,7 +236,7 @@ public void SubNumberFromTime() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 min - 10 s")] + [Test] public void SubTimeFromTime() { var sub = new Sub( @@ -248,7 +248,7 @@ public void SubTimeFromTime() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 m^2")] + [Test] public void SubAreaFromNumber() { var sub = new Sub( @@ -260,7 +260,7 @@ public void SubAreaFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 m^2 - 10")] + [Test] public void SubNumberFromArea() { var sub = new Sub( @@ -272,7 +272,7 @@ public void SubNumberFromArea() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 km^2 - 10 m^2")] + [Test] public void SubAreaFromArea() { var sub = new Sub( @@ -284,7 +284,7 @@ public void SubAreaFromArea() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 - 10 m^3")] + [Test] public void SubVolumeFromNumber() { var sub = new Sub( @@ -296,7 +296,7 @@ public void SubVolumeFromNumber() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 m^3 - 10")] + [Test] public void SubNumberFromVolume() { var sub = new Sub( @@ -308,7 +308,7 @@ public void SubNumberFromVolume() SimplifyTest(sub, expected); } - [Fact(DisplayName = "20 m^3 - 10 cm^3")] + [Test] public void SubVolumeAndVolume() { var sub = new Sub( @@ -320,7 +320,7 @@ public void SubVolumeAndVolume() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 - -x")] + [Test] public void SubSecondUnaryMinus() { var sub = new Sub(Number.Two, new UnaryMinus(Variable.X)); @@ -329,7 +329,7 @@ public void SubSecondUnaryMinus() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(2 + x) - 2")] + [Test] public void SubDiff_NumAddVar_SubNum() { var sub = new Sub(new Add(Number.Two, Variable.X), Number.Two); @@ -338,7 +338,7 @@ public void SubDiff_NumAddVar_SubNum() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x + 2) - 2")] + [Test] public void SubDiff_VarAddNum_SubNum() { var sub = new Sub(new Add(Variable.X, Number.Two), Number.Two); @@ -347,7 +347,7 @@ public void SubDiff_VarAddNum_SubNum() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 - (2 + x)")] + [Test] public void SubDiffNumSub_NumAddVar_() { var sub = new Sub(Number.Two, new Add(Number.Two, Variable.X)); @@ -356,7 +356,7 @@ public void SubDiffNumSub_NumAddVar_() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 - (x + 2)")] + [Test] public void SubDiffNumSub_VarAddNum_() { var sub = new Sub(Number.Two, new Add(Variable.X, Number.Two)); @@ -365,7 +365,7 @@ public void SubDiffNumSub_VarAddNum_() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(2 - x) - 2")] + [Test] public void SubDiff_NumSubVar_SubNum() { var sub = new Sub(new Sub(Number.Two, Variable.X), Number.Two); @@ -374,7 +374,7 @@ public void SubDiff_NumSubVar_SubNum() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x - 2) - 2")] + [Test] public void SubDiff_VarSubNum_SubNum() { var sub = new Sub(new Sub(Variable.X, Number.Two), Number.Two); @@ -383,7 +383,7 @@ public void SubDiff_VarSubNum_SubNum() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 - (2 - x)")] + [Test] public void SubDiffNumSub_NumSubVar_() { var sub = new Sub(Number.Two, new Sub(Number.Two, Variable.X)); @@ -392,7 +392,7 @@ public void SubDiffNumSub_NumSubVar_() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 - (x - 2)")] + [Test] public void SubDiffNumSub_VarSubNum_() { var sub = new Sub(Number.Two, new Sub(Variable.X, Number.Two)); @@ -401,7 +401,7 @@ public void SubDiffNumSub_VarSubNum_() SimplifyTest(sub, expected); } - [Fact(DisplayName = "x - x")] + [Test] public void SubSameVars1() { var sub = new Sub(Variable.X, Variable.X); @@ -410,7 +410,7 @@ public void SubSameVars1() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x - x) - x")] + [Test] public void SubSameVars2() { var sub = new Sub(new Sub(Variable.X, Variable.X), Variable.X); @@ -419,7 +419,7 @@ public void SubSameVars2() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2x - x")] + [Test] public void SubSameVars3() { var sub = new Sub(new Mul(Number.Two, Variable.X), Variable.X); @@ -428,7 +428,7 @@ public void SubSameVars3() SimplifyTest(sub, expected); } - [Fact(DisplayName = "x - 2x")] + [Test] public void SubSameVars4() { var sub = new Sub(Variable.X, new Mul(Number.Two, Variable.X)); @@ -437,7 +437,7 @@ public void SubSameVars4() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x + y) - 2 * (x + y)")] + [Test] public void SubComplexX() { var sub = new Sub( @@ -449,7 +449,7 @@ public void SubComplexX() SimplifyTest(sub, expected); } - [Fact(DisplayName = "x - (x * 2)")] + [Test] public void SubSameVars5() { var sub = new Sub(Variable.X, new Mul(Variable.X, Number.Two)); @@ -458,7 +458,7 @@ public void SubSameVars5() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2 * (x + y) - (x + y)")] + [Test] public void SubComplexX2() { var sub = new Sub( @@ -470,7 +470,7 @@ public void SubComplexX2() SimplifyTest(sub, expected); } - [Fact(DisplayName = "2x - x")] + [Test] public void SubSameVars6() { var sub = new Sub(new Mul(Number.Two, Variable.X), Variable.X); @@ -479,7 +479,7 @@ public void SubSameVars6() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x * 2) - x")] + [Test] public void SubSameVars7() { var sub = new Sub(new Mul(Variable.X, Number.Two), Variable.X); @@ -488,7 +488,7 @@ public void SubSameVars7() SimplifyTest(sub, expected); } - [Fact(DisplayName = "3x - 2x")] + [Test] public void SubSameVars8() { var sub = new Sub( @@ -500,7 +500,7 @@ public void SubSameVars8() SimplifyTest(sub, expected); } - [Fact(DisplayName = "3 * (x + y) - 2 * (x + y)")] + [Test] public void SubComplexX3() { var sub = new Sub( @@ -512,7 +512,7 @@ public void SubComplexX3() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x * 3) - (x * 2)")] + [Test] public void SubSameVars9() { var sub = new Sub( @@ -524,7 +524,7 @@ public void SubSameVars9() SimplifyTest(sub, expected); } - [Fact(DisplayName = "(x * 4) - (x * 2)")] + [Test] public void SubSameVars10() { var sub = new Sub( @@ -536,7 +536,7 @@ public void SubSameVars10() SimplifyTest(sub, expected); } - [Fact(DisplayName = "3x - x * 2")] + [Test] public void AddSameVars11() { var exp = new Sub( @@ -548,7 +548,7 @@ public void AddSameVars11() SimplifyTest(exp, expected); } - [Fact(DisplayName = "x * 3 - 2x")] + [Test] public void AddSameVars12() { var exp = new Sub( @@ -560,7 +560,7 @@ public void AddSameVars12() SimplifyTest(exp, expected); } - [Fact] + [Test] public void SubArgumentSimplified() { var exp = new Sub( diff --git a/xFunc.Tests/Analyzers/SimplifierTests/ToNumberSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/ToNumberSimplifierTest.cs index c43feab4e..507845ed3 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/ToNumberSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/ToNumberSimplifierTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class ToNumberSimplifierTest : BaseSimplifierTest { - [Fact] + [Test] public void AngleToNumberTest() { var exp = new ToNumber(AngleValue.Degree(10).AsExpression()); @@ -14,7 +14,7 @@ public void AngleToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void PowerToNumberTest() { var exp = new ToNumber(PowerValue.Watt(10).AsExpression()); @@ -23,7 +23,7 @@ public void PowerToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void TemperatureToNumberTest() { var exp = new ToNumber(TemperatureValue.Celsius(10).AsExpression()); @@ -32,7 +32,7 @@ public void TemperatureToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void MassToNumberTest() { var exp = new ToNumber(MassValue.Gram(10).AsExpression()); @@ -41,7 +41,7 @@ public void MassToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void LengthToNumberTest() { var exp = new ToNumber(LengthValue.Meter(10).AsExpression()); @@ -50,7 +50,7 @@ public void LengthToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void TimeToNumberTest() { var exp = new ToNumber(TimeValue.Second(10).AsExpression()); @@ -59,7 +59,7 @@ public void TimeToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void AreaToNumberTest() { var exp = new ToNumber(AreaValue.Meter(10).AsExpression()); @@ -68,7 +68,7 @@ public void AreaToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void VolumeToNumberTest() { var exp = new ToNumber(VolumeValue.Meter(10).AsExpression()); @@ -77,7 +77,7 @@ public void VolumeToNumberTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToNumberArgumentSimplifiedTest() { var exp = new ToNumber(new Add(Number.One, Number.One)); @@ -86,7 +86,7 @@ public void ToNumberArgumentSimplifiedTest() SimplifyTest(exp, expected); } - [Fact] + [Test] public void ToNumberNotSimplifiedTest() { var exp = new ToNumber(Variable.X); diff --git a/xFunc.Tests/Analyzers/SimplifierTests/TrigonometricSimplifierTest.cs b/xFunc.Tests/Analyzers/SimplifierTests/TrigonometricSimplifierTest.cs index 25899bd9e..808cce38e 100644 --- a/xFunc.Tests/Analyzers/SimplifierTests/TrigonometricSimplifierTest.cs +++ b/xFunc.Tests/Analyzers/SimplifierTests/TrigonometricSimplifierTest.cs @@ -5,22 +5,22 @@ namespace xFunc.Tests.Analyzers.SimplifierTests; public class TrigonometricSimplifierTest : BaseSimplifierTest { - [Theory] - [InlineData(typeof(Arcsin), typeof(Sin))] - [InlineData(typeof(Arccos), typeof(Cos))] - [InlineData(typeof(Arctan), typeof(Tan))] - [InlineData(typeof(Arccot), typeof(Cot))] - [InlineData(typeof(Arcsec), typeof(Sec))] - [InlineData(typeof(Arccsc), typeof(Csc))] - [InlineData(typeof(Tan), typeof(Arctan))] - [InlineData(typeof(Cot), typeof(Arccot))] - [InlineData(typeof(Arsinh), typeof(Sinh))] - [InlineData(typeof(Arcosh), typeof(Cosh))] - [InlineData(typeof(Artanh), typeof(Tanh))] - [InlineData(typeof(Arcoth), typeof(Coth))] - [InlineData(typeof(Arsech), typeof(Sech))] - [InlineData(typeof(Arcsch), typeof(Csch))] - [InlineData(typeof(Sinh), typeof(Arsinh))] + [Test] + [TestCase(typeof(Arcsin), typeof(Sin))] + [TestCase(typeof(Arccos), typeof(Cos))] + [TestCase(typeof(Arctan), typeof(Tan))] + [TestCase(typeof(Arccot), typeof(Cot))] + [TestCase(typeof(Arcsec), typeof(Sec))] + [TestCase(typeof(Arccsc), typeof(Csc))] + [TestCase(typeof(Tan), typeof(Arctan))] + [TestCase(typeof(Cot), typeof(Arccot))] + [TestCase(typeof(Arsinh), typeof(Sinh))] + [TestCase(typeof(Arcosh), typeof(Cosh))] + [TestCase(typeof(Artanh), typeof(Tanh))] + [TestCase(typeof(Arcoth), typeof(Coth))] + [TestCase(typeof(Arsech), typeof(Sech))] + [TestCase(typeof(Arcsch), typeof(Csch))] + [TestCase(typeof(Sinh), typeof(Arsinh))] public void InverseFunctionsTest(Type outer, Type inner) { var innerFunction = Create(inner, Variable.X); @@ -85,24 +85,24 @@ public static IEnumerable GetInverseDomainTestData() yield return new object[] { new Coth(new Arcoth(Number.Two)), Number.Two }; } - [Theory] - [MemberData(nameof(GetInverseDomainTestData))] + [Test] + [TestCaseSource(nameof(GetInverseDomainTestData))] public void InverseDomainTest(IExpression exp, IExpression expected) => SimplifyTest(exp, expected); - [Theory] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arctan))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Cos))] - [InlineData(typeof(Tan))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Csc))] + [Test] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arctan))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Cos))] + [TestCase(typeof(Tan))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Csc))] public void SimplifyArgumentTest(Type type) { var exp = Create(type, new Add(Number.One, Number.Two)); @@ -111,12 +111,12 @@ public void SimplifyArgumentTest(Type type) SimplifyTest(exp, expected); } - [Theory] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Tanh))] public void CoshCopy(Type expType) { var exp = Create(expType, new Add(Number.One, Number.One)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/AbsTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/AbsTests.cs index f746d582f..fa69c83c1 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/AbsTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/AbsTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class AbsTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestAbsNumber() { var exp = new Abs(new Number(-2)); @@ -13,7 +13,7 @@ public void TestAbsNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestAbsAngleNumber() { var exp = new Abs(AngleValue.Degree(1).AsExpression()); @@ -21,7 +21,7 @@ public void TestAbsAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestAbsPowerNumber() { var exp = new Abs(PowerValue.Watt(1).AsExpression()); @@ -29,7 +29,7 @@ public void TestAbsPowerNumber() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestAbsTemperatureNumber() { var exp = new Abs(TemperatureValue.Celsius(1).AsExpression()); @@ -37,7 +37,7 @@ public void TestAbsTemperatureNumber() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestAbsMassNumber() { var exp = new Abs(MassValue.Gram(1).AsExpression()); @@ -45,7 +45,7 @@ public void TestAbsMassNumber() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestAbsLengthNumber() { var exp = new Abs(LengthValue.Meter(1).AsExpression()); @@ -53,7 +53,7 @@ public void TestAbsLengthNumber() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestAbsTimeNumber() { var exp = new Abs(TimeValue.Second(1).AsExpression()); @@ -61,7 +61,7 @@ public void TestAbsTimeNumber() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestAbsAreaNumber() { var exp = new Abs(AreaValue.Meter(1).AsExpression()); @@ -69,7 +69,7 @@ public void TestAbsAreaNumber() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestAbsVolumeNumber() { var exp = new Abs(VolumeValue.Meter(1).AsExpression()); @@ -77,7 +77,7 @@ public void TestAbsVolumeNumber() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestAbsComplexNumber() { var exp = new Abs(new ComplexNumber(2, 2)); @@ -85,7 +85,7 @@ public void TestAbsComplexNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestAbsVariable() { var exp = new Abs(Variable.X); @@ -93,7 +93,7 @@ public void TestAbsVariable() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAbsVector() { var exp = new Abs(new Vector(new IExpression[] { Number.One })); @@ -101,7 +101,7 @@ public void TestAbsVector() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestAbsRational() { var exp = new Abs(new Rational(new Number(1), new Number(2))); @@ -109,7 +109,7 @@ public void TestAbsRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestAbsException() { var exp = new Abs(Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/AddTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/AddTests.cs index 10dc39045..c3686339e 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/AddTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/AddTests.cs @@ -7,7 +7,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class AddTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestAddTwoNumberTest() { var add = new Add(Number.One, Number.Two); @@ -15,7 +15,7 @@ public void TestAddTwoNumberTest() Test(add, ResultTypes.Number); } - [Fact] + [Test] public void TestAddNumberVarTest() { var add = new Add(Number.One, Variable.X); @@ -23,7 +23,7 @@ public void TestAddNumberVarTest() Test(add, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddComplicatedTest() { var add = new Add(new Mul(Number.One, Number.Two), Variable.X); @@ -31,7 +31,7 @@ public void TestAddComplicatedTest() Test(add, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddTwoVectorTest() { var add = new Add( @@ -42,7 +42,7 @@ public void TestAddTwoVectorTest() Test(add, ResultTypes.Vector); } - [Fact] + [Test] public void TestAddTwoMatrixTest() { var add = new Add( @@ -53,7 +53,7 @@ public void TestAddTwoMatrixTest() Test(add, ResultTypes.Matrix); } - [Fact] + [Test] public void TestAddNumberVectorTest() { var exp = new Add( @@ -64,7 +64,7 @@ public void TestAddNumberVectorTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddBoolVectorException() { var exp = new Add(Bool.True, new Vector(new IExpression[] { Number.One })); @@ -72,7 +72,7 @@ public void TestAddBoolVectorException() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddVectorNumberTest() { var exp = new Add(new Vector(new IExpression[] { Number.One }), Bool.True); @@ -80,7 +80,7 @@ public void TestAddVectorNumberTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddNumberMatrixTest() { var exp = new Add( @@ -91,7 +91,7 @@ public void TestAddNumberMatrixTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddMatrixNumberTest() { var exp = new Add( @@ -102,7 +102,7 @@ public void TestAddMatrixNumberTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddVectorMatrixTest() { var exp = new Add( @@ -113,7 +113,7 @@ public void TestAddVectorMatrixTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddMatrixVectorTest() { var exp = new Add( @@ -124,7 +124,7 @@ public void TestAddMatrixVectorTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddNumberComplexNumberTest() { var add = new Add(Number.One, new ComplexNumber(2, 1)); @@ -132,7 +132,7 @@ public void TestAddNumberComplexNumberTest() Test(add, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestAddBoolComplexNumberException() { var add = new Add(Bool.True, new ComplexNumber(2, 1)); @@ -140,7 +140,7 @@ public void TestAddBoolComplexNumberException() TestBinaryException(add); } - [Fact] + [Test] public void TestAddComplexNumberNumberTest() { var add = new Add(new ComplexNumber(1, 3), Number.Two); @@ -148,7 +148,7 @@ public void TestAddComplexNumberNumberTest() Test(add, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestAddComplexNumberBoolException() { var add = new Add(new ComplexNumber(1, 3), Bool.True); @@ -156,7 +156,7 @@ public void TestAddComplexNumberBoolException() TestBinaryException(add); } - [Fact] + [Test] public void TestAddComplexNumberComplexNumberTest() { var add = new Add(new ComplexNumber(1, 3), new ComplexNumber(2, 5)); @@ -164,7 +164,7 @@ public void TestAddComplexNumberComplexNumberTest() Test(add, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestAddNumberAllTest() { var exp = new Add( @@ -176,7 +176,7 @@ public void TestAddNumberAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddComplexNumberAllTest() { var exp = new Add( @@ -188,7 +188,7 @@ public void TestAddComplexNumberAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddVectorAllTest() { var exp = new Add( @@ -200,7 +200,7 @@ public void TestAddVectorAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddMatrixAllTest() { var matrix = new Matrix(new[] @@ -216,7 +216,7 @@ public void TestAddMatrixAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddBoolAndMatrixTest() { var matrix = new Matrix(new[] @@ -228,7 +228,7 @@ public void TestAddBoolAndMatrixTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddMatrixAndBoolTest() { var matrix = new Matrix(new[] @@ -240,7 +240,7 @@ public void TestAddMatrixAndBoolTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestAddNumberSqrtComplexTest() { var exp = new Add(Number.Two, new Sqrt(new Number(-9))); @@ -248,7 +248,7 @@ public void TestAddNumberSqrtComplexTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddTwoVarTest() { var exp = new Add(Variable.X, Variable.X); @@ -256,7 +256,7 @@ public void TestAddTwoVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddThreeVarTest() { var exp = new Add(new Add(Variable.X, Variable.X), Variable.X); @@ -264,7 +264,7 @@ public void TestAddThreeVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAddException() { var exp = new Add(Bool.False, Bool.False); @@ -272,7 +272,7 @@ public void TestAddException() TestException(exp); } - [Fact] + [Test] public void TestAddNumberAngle() { var exp = new Add( @@ -283,7 +283,7 @@ public void TestAddNumberAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestAddAngleNumber() { var exp = new Add( @@ -294,7 +294,7 @@ public void TestAddAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestAddAngleAngle() { var exp = new Add( @@ -305,7 +305,7 @@ public void TestAddAngleAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestAddNumberPower() { var exp = new Add( @@ -316,7 +316,7 @@ public void TestAddNumberPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestAddPowerNumber() { var exp = new Add( @@ -327,7 +327,7 @@ public void TestAddPowerNumber() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestAddPowerPower() { var exp = new Add( @@ -338,7 +338,7 @@ public void TestAddPowerPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestAddNumberTemperature() { var exp = new Add( @@ -349,7 +349,7 @@ public void TestAddNumberTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestAddTemperatureNumber() { var exp = new Add( @@ -360,7 +360,7 @@ public void TestAddTemperatureNumber() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestAddTemperatureTemperature() { var exp = new Add( @@ -371,7 +371,7 @@ public void TestAddTemperatureTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestAddNumberAndMass() { var exp = new Add( @@ -382,7 +382,7 @@ public void TestAddNumberAndMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestAddMassAndNumber() { var exp = new Add( @@ -393,7 +393,7 @@ public void TestAddMassAndNumber() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestAddMassAndMass() { var exp = new Add( @@ -404,7 +404,7 @@ public void TestAddMassAndMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestAddNumberAndLength() { var exp = new Add( @@ -415,7 +415,7 @@ public void TestAddNumberAndLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestAddLengthAndNumber() { var exp = new Add( @@ -426,7 +426,7 @@ public void TestAddLengthAndNumber() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestAddLengthAndLength() { var exp = new Add( @@ -437,7 +437,7 @@ public void TestAddLengthAndLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestAddNumberAndTime() { var exp = new Add( @@ -448,7 +448,7 @@ public void TestAddNumberAndTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestAddTimeAndNumber() { var exp = new Add( @@ -459,7 +459,7 @@ public void TestAddTimeAndNumber() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestAddTimeAndTime() { var exp = new Add( @@ -470,7 +470,7 @@ public void TestAddTimeAndTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestAddNumberAndArea() { var exp = new Add( @@ -481,7 +481,7 @@ public void TestAddNumberAndArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestAddAreaAndNumber() { var exp = new Add( @@ -492,7 +492,7 @@ public void TestAddAreaAndNumber() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestAddAreaAndArea() { var exp = new Add( @@ -503,7 +503,7 @@ public void TestAddAreaAndArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestAddNumberAndVolume() { var exp = new Add( @@ -514,7 +514,7 @@ public void TestAddNumberAndVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestAddVolumeAndNumber() { var exp = new Add( @@ -525,7 +525,7 @@ public void TestAddVolumeAndNumber() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestAddVolumeAndVolume() { var exp = new Add( @@ -536,7 +536,7 @@ public void TestAddVolumeAndVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestAddRationalAndRational() { var exp = new Add( @@ -547,7 +547,7 @@ public void TestAddRationalAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestAddNumberAndRational() { var exp = new Add( @@ -558,7 +558,7 @@ public void TestAddNumberAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestAddRationalAndNumber() { var exp = new Add( @@ -569,7 +569,7 @@ public void TestAddRationalAndNumber() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestAddStringToString() { var exp = new Add( @@ -580,7 +580,7 @@ public void TestAddStringToString() Test(exp, ResultTypes.String); } - [Fact] + [Test] public void TestAddStringToNumber() { var exp = new Add( @@ -591,7 +591,7 @@ public void TestAddStringToNumber() Test(exp, ResultTypes.String); } - [Fact] + [Test] public void TestAddNumberToString() { var exp = new Add( @@ -629,8 +629,8 @@ public static IEnumerable GetDataForTestAddAngleAndBoolTest() yield return new object[] { Bool.False, VolumeValue.Meter(90).AsExpression() }; } - [Theory] - [MemberData(nameof(GetDataForTestAddAngleAndBoolTest))] + [Test] + [TestCaseSource(nameof(GetDataForTestAddAngleAndBoolTest))] public void TestAddAngleAndBoolTest(IExpression left, IExpression right) { var exp = new Add(left, right); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/CeilTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/CeilTests.cs index ee69ae955..d8a968cb3 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/CeilTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/CeilTests.cs @@ -2,7 +2,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class CeilTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestCeilNumber() { var exp = new Ceil(new Number(-2)); @@ -10,7 +10,7 @@ public void TestCeilNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestCeilAngle() { var exp = new Ceil(AngleValue.Degree(5.5).AsExpression()); @@ -18,7 +18,7 @@ public void TestCeilAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestCeilPower() { var exp = new Ceil(PowerValue.Watt(5.5).AsExpression()); @@ -26,7 +26,7 @@ public void TestCeilPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestCeilTemperature() { var exp = new Ceil(TemperatureValue.Celsius(5.5).AsExpression()); @@ -34,7 +34,7 @@ public void TestCeilTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestCeilMass() { var exp = new Ceil(MassValue.Gram(5.5).AsExpression()); @@ -42,7 +42,7 @@ public void TestCeilMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestCeilLength() { var exp = new Ceil(LengthValue.Meter(5.5).AsExpression()); @@ -50,7 +50,7 @@ public void TestCeilLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestCeilTime() { var exp = new Ceil(TimeValue.Second(5.5).AsExpression()); @@ -58,7 +58,7 @@ public void TestCeilTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestCeilArea() { var exp = new Ceil(AreaValue.Meter(5.5).AsExpression()); @@ -66,7 +66,7 @@ public void TestCeilArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestCeilVolume() { var exp = new Ceil(VolumeValue.Meter(5.5).AsExpression()); @@ -74,7 +74,7 @@ public void TestCeilVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestCeilVariable() { var exp = new Ceil(Variable.X); @@ -82,7 +82,7 @@ public void TestCeilVariable() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestCeilException() { var exp = new Ceil(Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ComplexNumberTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ComplexNumberTests.cs index 4287e41c5..acfdd86ae 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ComplexNumberTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ComplexNumberTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class ComplexNumberTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestComplexNumber() { var exp = new ComplexNumber(2, 2); @@ -13,7 +13,7 @@ public void TestComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestConjugateUndefined() { var exp = new Conjugate(Variable.X); @@ -21,7 +21,7 @@ public void TestConjugateUndefined() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestConjugateComplexNumber() { var exp = new Conjugate(new ComplexNumber(2, 3)); @@ -29,7 +29,7 @@ public void TestConjugateComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestConjugateException() { var exp = new Conjugate(Number.Two); @@ -37,7 +37,7 @@ public void TestConjugateException() TestException(exp); } - [Fact] + [Test] public void TestImUndefined() { var exp = new Im(Variable.X); @@ -45,7 +45,7 @@ public void TestImUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestImComplexNumber() { var exp = new Im(new ComplexNumber(2, 3)); @@ -53,7 +53,7 @@ public void TestImComplexNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestImException() { var exp = new Im(Number.Two); @@ -61,7 +61,7 @@ public void TestImException() TestException(exp); } - [Fact] + [Test] public void TestPhaseUndefined() { var exp = new Phase(Variable.X); @@ -69,7 +69,7 @@ public void TestPhaseUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestPhaseComplexNumber() { var exp = new Phase(new ComplexNumber(2, 3)); @@ -77,7 +77,7 @@ public void TestPhaseComplexNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestPhaseException() { var exp = new Phase(Number.Two); @@ -85,7 +85,7 @@ public void TestPhaseException() TestException(exp); } - [Fact] + [Test] public void TestReUndefined() { var exp = new Re(Variable.X); @@ -93,7 +93,7 @@ public void TestReUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestReComplexNumber() { var exp = new Re(new ComplexNumber(2, 3)); @@ -101,7 +101,7 @@ public void TestReComplexNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestReException() { var exp = new Re(Number.Two); @@ -109,7 +109,7 @@ public void TestReException() TestException(exp); } - [Fact] + [Test] public void TestReciprocalUndefined() { var exp = new Reciprocal(Variable.X); @@ -117,7 +117,7 @@ public void TestReciprocalUndefined() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestReciprocalComplexNumber() { var exp = new Reciprocal(new ComplexNumber(2, 3)); @@ -125,7 +125,7 @@ public void TestReciprocalComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestReciprocalException() { var exp = new Reciprocal(Number.Two); @@ -133,15 +133,15 @@ public void TestReciprocalException() TestException(exp); } - [Fact] + [Test] public void ToComplexUndefined() => Test(new ToComplex(Variable.X), ResultTypes.ComplexNumber); - [Fact] + [Test] public void ToComplexNubmer() => Test(new ToComplex(Number.One), ResultTypes.ComplexNumber); - [Fact] + [Test] public void ToComplexException() => TestException(new ToComplex(Bool.False)); } \ No newline at end of file diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/DivTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/DivTests.cs index a022214e6..e7c082261 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/DivTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/DivTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class DivTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestDivNumberNumberTest() { var exp = new Div(Number.One, Number.Two); @@ -13,7 +13,7 @@ public void TestDivNumberNumberTest() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestDivComplexNumberComplexNumberTest() { var exp = new Div(new ComplexNumber(3, 2), new ComplexNumber(2, 4)); @@ -21,7 +21,7 @@ public void TestDivComplexNumberComplexNumberTest() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestDivNumberComplexNumberTest() { var exp = new Div(new Number(3), new ComplexNumber(2, 4)); @@ -29,7 +29,7 @@ public void TestDivNumberComplexNumberTest() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestDivComplexNumberNumberTest() { var exp = new Div(new ComplexNumber(3, 2), Number.Two); @@ -37,7 +37,7 @@ public void TestDivComplexNumberNumberTest() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestDivComplexNumberBoolException() { var exp = new Div(new ComplexNumber(3, 2), Bool.True); @@ -45,7 +45,7 @@ public void TestDivComplexNumberBoolException() TestBinaryException(exp); } - [Fact] + [Test] public void TestDivBoolComplexNumberException() { var exp = new Div(Bool.True, new ComplexNumber(3, 2)); @@ -53,7 +53,7 @@ public void TestDivBoolComplexNumberException() TestBinaryException(exp); } - [Fact] + [Test] public void TestDivNumberBoolException() { var exp = new Div(new Number(3), Bool.True); @@ -61,7 +61,7 @@ public void TestDivNumberBoolException() TestBinaryException(exp); } - [Fact] + [Test] public void TestDivBoolNumberException() { var exp = new Div(Bool.True, new Number(3)); @@ -69,7 +69,7 @@ public void TestDivBoolNumberException() TestBinaryException(exp); } - [Fact] + [Test] public void TestDivNumberSqrtComplexTest() { var exp = new Div(new Sqrt(new Number(-16)), Number.Two); @@ -77,7 +77,7 @@ public void TestDivNumberSqrtComplexTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestDivTwoVarTest() { var exp = new Div(Variable.X, Variable.X); @@ -85,7 +85,7 @@ public void TestDivTwoVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestDivNumberAndVarTest() { var exp = new Div(Number.One, Variable.X); @@ -93,7 +93,7 @@ public void TestDivNumberAndVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestDivThreeVarTest() { var exp = new Div(new Add(Variable.X, Variable.X), Variable.X); @@ -101,7 +101,7 @@ public void TestDivThreeVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestDivException() { var exp = new Div(Bool.False, Bool.False); @@ -109,7 +109,7 @@ public void TestDivException() TestException(exp); } - [Fact] + [Test] public void TestDivAngleNumber() { var exp = new Div( @@ -120,7 +120,7 @@ public void TestDivAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestDivPowerNumber() { var exp = new Div( @@ -131,7 +131,7 @@ public void TestDivPowerNumber() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestDivTemperatureNumber() { var exp = new Div( @@ -142,7 +142,7 @@ public void TestDivTemperatureNumber() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestDivMassNumber() { var exp = new Div( @@ -153,7 +153,7 @@ public void TestDivMassNumber() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestDivLengthNumber() { var exp = new Div( @@ -164,7 +164,7 @@ public void TestDivLengthNumber() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestDivTimeNumber() { var exp = new Div( @@ -175,7 +175,7 @@ public void TestDivTimeNumber() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestDivAreaNumber() { var exp = new Div( @@ -186,7 +186,7 @@ public void TestDivAreaNumber() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestDivVolumeNumber() { var exp = new Div( @@ -197,7 +197,7 @@ public void TestDivVolumeNumber() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestDivRationalAndRational() { var exp = new Div( @@ -208,7 +208,7 @@ public void TestDivRationalAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestDivNumberAndRational() { var exp = new Div( @@ -219,7 +219,7 @@ public void TestDivNumberAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestDivRationalAndNumber() { var exp = new Div( @@ -242,8 +242,8 @@ public static IEnumerable GetDataForTestDivAngleAndBoolTest() yield return new object[] { VolumeValue.Meter(90).AsExpression() }; } - [Theory] - [MemberData(nameof(GetDataForTestDivAngleAndBoolTest))] + [Test] + [TestCaseSource(nameof(GetDataForTestDivAngleAndBoolTest))] public void TestDivAngleAndBoolTest(IExpression left) { var exp = new Div(left, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/FloorTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/FloorTests.cs index a06c6feda..0d9a64f88 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/FloorTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/FloorTests.cs @@ -2,7 +2,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class FloorTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestFloorUndefined() { var exp = new Floor(Variable.X); @@ -10,7 +10,7 @@ public void TestFloorUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestFloorNumber() { var exp = new Floor(new Number(10)); @@ -18,7 +18,7 @@ public void TestFloorNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestFloorAngle() { var exp = new Floor(AngleValue.Degree(5.5).AsExpression()); @@ -26,7 +26,7 @@ public void TestFloorAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestFloorPower() { var exp = new Floor(PowerValue.Watt(5.5).AsExpression()); @@ -34,7 +34,7 @@ public void TestFloorPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestFloorTemperature() { var exp = new Floor(TemperatureValue.Celsius(5.5).AsExpression()); @@ -42,7 +42,7 @@ public void TestFloorTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestFloorMass() { var exp = new Floor(MassValue.Gram(5.5).AsExpression()); @@ -50,7 +50,7 @@ public void TestFloorMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestFloorLength() { var exp = new Floor(LengthValue.Meter(5.5).AsExpression()); @@ -58,7 +58,7 @@ public void TestFloorLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestFloorTime() { var exp = new Floor(TimeValue.Second(5.5).AsExpression()); @@ -66,7 +66,7 @@ public void TestFloorTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestFloorArea() { var exp = new Floor(AreaValue.Meter(5.5).AsExpression()); @@ -74,7 +74,7 @@ public void TestFloorArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestFloorVolume() { var exp = new Floor(VolumeValue.Meter(5.5).AsExpression()); @@ -82,7 +82,7 @@ public void TestFloorVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestFloorException() { var exp = new Floor(Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/FracTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/FracTests.cs index 05f1c63d0..f9e096c89 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/FracTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/FracTests.cs @@ -2,7 +2,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class FracTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestFracUndefined() { var exp = new Frac(Variable.X); @@ -10,7 +10,7 @@ public void TestFracUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestFracNumber() { var exp = new Frac(new Number(10)); @@ -18,7 +18,7 @@ public void TestFracNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestFracAngle() { var exp = new Frac(AngleValue.Degree(5.5).AsExpression()); @@ -26,7 +26,7 @@ public void TestFracAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestFracPower() { var exp = new Frac(PowerValue.Watt(5.5).AsExpression()); @@ -34,7 +34,7 @@ public void TestFracPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestFracTemperature() { var exp = new Frac(TemperatureValue.Celsius(5.5).AsExpression()); @@ -42,7 +42,7 @@ public void TestFracTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestFracMass() { var exp = new Frac(MassValue.Gram(5.5).AsExpression()); @@ -50,7 +50,7 @@ public void TestFracMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestFracLength() { var exp = new Frac(LengthValue.Meter(5.5).AsExpression()); @@ -58,7 +58,7 @@ public void TestFracLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestFracTime() { var exp = new Frac(TimeValue.Second(5.5).AsExpression()); @@ -66,7 +66,7 @@ public void TestFracTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestFracArea() { var exp = new Frac(AreaValue.Meter(5.5).AsExpression()); @@ -74,7 +74,7 @@ public void TestFracArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestFracVolume() { var exp = new Frac(VolumeValue.Meter(5.5).AsExpression()); @@ -82,7 +82,7 @@ public void TestFracVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestFracException() { var exp = new Frac(Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/HyperbolicTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/HyperbolicTests.cs index 00ca6ab36..eace92892 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/HyperbolicTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/HyperbolicTests.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class HyperbolicTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(Arcosh))] - [InlineData(typeof(Arcoth))] - [InlineData(typeof(Arcsch))] - [InlineData(typeof(Arsech))] - [InlineData(typeof(Arsinh))] - [InlineData(typeof(Artanh))] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Sinh))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Arcosh))] + [TestCase(typeof(Arcoth))] + [TestCase(typeof(Arcsch))] + [TestCase(typeof(Arsech))] + [TestCase(typeof(Arsinh))] + [TestCase(typeof(Artanh))] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Sinh))] + [TestCase(typeof(Tanh))] public void TestUndefined(Type type) { var exp = Create(type, Variable.X); @@ -25,13 +25,13 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Undefined); } - [Theory] - [InlineData(typeof(Arcosh))] - [InlineData(typeof(Arcoth))] - [InlineData(typeof(Arcsch))] - [InlineData(typeof(Arsech))] - [InlineData(typeof(Arsinh))] - [InlineData(typeof(Artanh))] + [Test] + [TestCase(typeof(Arcosh))] + [TestCase(typeof(Arcoth))] + [TestCase(typeof(Arcsch))] + [TestCase(typeof(Arsech))] + [TestCase(typeof(Arsinh))] + [TestCase(typeof(Artanh))] public void TestAngleNumber(Type type) { var exp = Create(type, Number.Two); @@ -39,13 +39,13 @@ public void TestAngleNumber(Type type) Test(exp, ResultTypes.AngleNumber); } - [Theory] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Sinh))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Sinh))] + [TestCase(typeof(Tanh))] public void TestNumber(Type type) { var exp = Create(type, Number.Two); @@ -53,19 +53,19 @@ public void TestNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(Arcosh))] - [InlineData(typeof(Arcoth))] - [InlineData(typeof(Arcsch))] - [InlineData(typeof(Arsech))] - [InlineData(typeof(Arsinh))] - [InlineData(typeof(Artanh))] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Sinh))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Arcosh))] + [TestCase(typeof(Arcoth))] + [TestCase(typeof(Arcsch))] + [TestCase(typeof(Arsech))] + [TestCase(typeof(Arsinh))] + [TestCase(typeof(Artanh))] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Sinh))] + [TestCase(typeof(Tanh))] public void TestComplexNumber(Type type) { var exp = Create(type, new ComplexNumber(2, 2)); @@ -73,19 +73,19 @@ public void TestComplexNumber(Type type) Test(exp, ResultTypes.ComplexNumber); } - [Theory] - [InlineData(typeof(Arcosh))] - [InlineData(typeof(Arcoth))] - [InlineData(typeof(Arcsch))] - [InlineData(typeof(Arsech))] - [InlineData(typeof(Arsinh))] - [InlineData(typeof(Artanh))] - [InlineData(typeof(Cosh))] - [InlineData(typeof(Coth))] - [InlineData(typeof(Csch))] - [InlineData(typeof(Sech))] - [InlineData(typeof(Sinh))] - [InlineData(typeof(Tanh))] + [Test] + [TestCase(typeof(Arcosh))] + [TestCase(typeof(Arcoth))] + [TestCase(typeof(Arcsch))] + [TestCase(typeof(Arsech))] + [TestCase(typeof(Arsinh))] + [TestCase(typeof(Artanh))] + [TestCase(typeof(Cosh))] + [TestCase(typeof(Coth))] + [TestCase(typeof(Csch))] + [TestCase(typeof(Sech))] + [TestCase(typeof(Sinh))] + [TestCase(typeof(Tanh))] public void TestParameterException(Type type) { var exp = Create(type, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogTests.cs index a4ce30489..bd0725ebb 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class LogTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestLbUndefined() { var exp = new Lb(Variable.X); @@ -13,7 +13,7 @@ public void TestLbUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLbNumber() { var exp = new Lb(new Number(10)); @@ -21,7 +21,7 @@ public void TestLbNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLbRational() { var exp = new Lb(new Rational(new Number(2), new Number(3))); @@ -29,7 +29,7 @@ public void TestLbRational() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLbException() { var exp = new Lb(Bool.False); @@ -37,7 +37,7 @@ public void TestLbException() TestException(exp); } - [Fact] + [Test] public void TestLgUndefined() { var exp = new Lg(Variable.X); @@ -45,7 +45,7 @@ public void TestLgUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestLgNumber() { var exp = new Lg(new Number(10)); @@ -53,7 +53,7 @@ public void TestLgNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLgComplexNumber() { var exp = new Lg(new ComplexNumber(10, 10)); @@ -61,7 +61,7 @@ public void TestLgComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestLgRational() { var exp = new Lg(new Rational(new Number(2), new Number(3))); @@ -69,7 +69,7 @@ public void TestLgRational() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLgException() { var exp = new Lg(Bool.False); @@ -77,7 +77,7 @@ public void TestLgException() TestException(exp); } - [Fact] + [Test] public void TestLnUndefined() { var exp = new Ln(Variable.X); @@ -85,7 +85,7 @@ public void TestLnUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestLnNumber() { var exp = new Ln(new Number(10)); @@ -93,7 +93,7 @@ public void TestLnNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLnComplexNumber() { var exp = new Ln(new ComplexNumber(10, 10)); @@ -101,7 +101,7 @@ public void TestLnComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestLnRational() { var exp = new Ln(new Rational(new Number(2), new Number(3))); @@ -109,7 +109,7 @@ public void TestLnRational() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLnException() { var exp = new Ln(Bool.False); @@ -117,7 +117,7 @@ public void TestLnException() TestException(exp); } - [Fact] + [Test] public void TestLogNumberAndUndefined() { var exp = new Log(Number.Two, Variable.X); @@ -125,7 +125,7 @@ public void TestLogNumberAndUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestLogUndefinedAndNumber() { var exp = new Log(Variable.X, Number.Two); @@ -133,7 +133,7 @@ public void TestLogUndefinedAndNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestLogNumber() { var exp = new Log(Number.Two, new Number(4)); @@ -141,7 +141,7 @@ public void TestLogNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLogComplexNumber() { var exp = new Log(Number.Two, new ComplexNumber(8, 3)); @@ -149,7 +149,7 @@ public void TestLogComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestLogRational() { var exp = new Log(new Number(3), new Rational(new Number(2), new Number(3))); @@ -157,7 +157,7 @@ public void TestLogRational() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLogException() { var exp = new Log(Number.Two, Bool.False); @@ -165,7 +165,7 @@ public void TestLogException() TestBinaryException(exp); } - [Fact] + [Test] public void TestLogBaseIsNotNumber() { var exp = new Log(Bool.False, Number.Two); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalBitwiseTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalBitwiseTests.cs index 0725d4880..a8f28926f 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalBitwiseTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalBitwiseTests.cs @@ -5,10 +5,10 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class LogicalBitwiseTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestLeftUndefined(Type type) { var exp = Create(type, Variable.X, Number.One); @@ -16,10 +16,10 @@ public void TestLeftUndefined(Type type) Test(exp, ResultTypes.Undefined); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestRightUndefined(Type type) { var exp = Create(type, Number.One, Variable.X); @@ -27,10 +27,10 @@ public void TestRightUndefined(Type type) Test(exp, ResultTypes.Undefined); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestNumber(Type type) { var exp = Create(type, Number.One, Number.One); @@ -38,10 +38,10 @@ public void TestNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestBool(Type type) { var exp = Create(type, Bool.True, Bool.True); @@ -49,10 +49,10 @@ public void TestBool(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestComplexAndNumber(Type type) { var exp = CreateBinary(type, new ComplexNumber(3, 2), Number.One); @@ -60,10 +60,10 @@ public void TestComplexAndNumber(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestNumberAndComplex(Type type) { var exp = CreateBinary(type, Number.One, new ComplexNumber(3, 2)); @@ -71,10 +71,10 @@ public void TestNumberAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestComplexAndBool(Type type) { var exp = CreateBinary(type, new ComplexNumber(3, 2), Bool.False); @@ -82,10 +82,10 @@ public void TestComplexAndBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestBoolAndComplex(Type type) { var exp = CreateBinary(type, Bool.False, new ComplexNumber(3, 2)); @@ -93,10 +93,10 @@ public void TestBoolAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(And))] - [InlineData(typeof(Or))] - [InlineData(typeof(XOr))] + [Test] + [TestCase(typeof(And))] + [TestCase(typeof(Or))] + [TestCase(typeof(XOr))] public void TestParamTypeException(Type type) { var exp = Create(type, new ComplexNumber(3, 2), new ComplexNumber(3, 2)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalTests.cs index 0c61e14b9..1e7a34b34 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/LogicalTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class LogicalTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestBoolValue() { var exp = Bool.False; @@ -13,11 +13,11 @@ public void TestBoolValue() Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestUndefined(Type type) { var exp = CreateBinary(type, Variable.X, Variable.X); @@ -25,11 +25,11 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestBoolUndefined(Type type) { var exp = CreateBinary(type, Bool.True, Variable.X); @@ -37,11 +37,11 @@ public void TestBoolUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestUndefinedBool(Type type) { var exp = CreateBinary(type, Variable.X, Bool.True); @@ -49,11 +49,11 @@ public void TestUndefinedBool(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestBool(Type type) { var exp = CreateBinary(type, Bool.False, Bool.True); @@ -61,11 +61,11 @@ public void TestBool(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestComplexBool(Type type) { var exp = CreateBinary(type, new ComplexNumber(2, 3), Bool.False); @@ -73,11 +73,11 @@ public void TestComplexBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestBoolComplex(Type type) { var exp = CreateBinary(type, Bool.False, new ComplexNumber(2, 3)); @@ -85,11 +85,11 @@ public void TestBoolComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equality))] - [InlineData(typeof(Implication))] - [InlineData(typeof(NAnd))] - [InlineData(typeof(NOr))] + [Test] + [TestCase(typeof(Equality))] + [TestCase(typeof(Implication))] + [TestCase(typeof(NAnd))] + [TestCase(typeof(NOr))] public void TestParamTypeException(Type type) { var exp = CreateBinary(type, new ComplexNumber(2, 3), new ComplexNumber(2, 3)); @@ -97,7 +97,7 @@ public void TestParamTypeException(Type type) TestException(exp); } - [Fact] + [Test] public void TestNotUndefined() { var exp = new Not(Variable.X); @@ -105,7 +105,7 @@ public void TestNotUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestNotNumber() { var exp = new Not(Number.One); @@ -113,7 +113,7 @@ public void TestNotNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestNotBoolean() { var exp = new Not(Bool.True); @@ -121,7 +121,7 @@ public void TestNotBoolean() Test(exp, ResultTypes.Boolean); } - [Fact] + [Test] public void TestNotException() { var exp = new Not(new ComplexNumber(1, 2)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/MatrixTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/MatrixTests.cs index b3df9b955..536d5c8a1 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/MatrixTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/MatrixTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class MatrixTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestVectorUndefined() { var exp = new Vector(new IExpression[] { new Number(10), Variable.X }); @@ -13,7 +13,7 @@ public void TestVectorUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestVectorNumber() { var exp = new Vector(new IExpression[] { new Number(10), new Number(10), new Number(10) }); @@ -21,7 +21,7 @@ public void TestVectorNumber() Test(exp, ResultTypes.Vector); } - [Fact] + [Test] public void TestVectorException() { var exp = new Vector(new IExpression[] { new ComplexNumber(10), new Number(10) }); @@ -29,7 +29,7 @@ public void TestVectorException() TestDiffParamException(exp); } - [Fact] + [Test] public void TestMatrixVector() { var exp = new Matrix(new[] @@ -41,7 +41,7 @@ public void TestMatrixVector() Test(exp, ResultTypes.Matrix); } - [Fact] + [Test] public void TestMatrixVectorUndefined() { var exp = new Matrix(new[] @@ -52,7 +52,7 @@ public void TestMatrixVectorUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestDeterminantUndefined() { var exp = new Determinant(Variable.X); @@ -60,7 +60,7 @@ public void TestDeterminantUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestDeterminantMatrix() { var matrix = new Matrix(new[] @@ -73,7 +73,7 @@ public void TestDeterminantMatrix() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestDeterminantException() { var exp = new Determinant(new ComplexNumber(2, 2)); @@ -81,7 +81,7 @@ public void TestDeterminantException() TestException(exp); } - [Fact] + [Test] public void TestDeterminantsException2() { var exp = new Determinant( @@ -96,7 +96,7 @@ public void TestDeterminantsException2() TestException(exp); } - [Fact] + [Test] public void TestInverseUndefined() { var exp = new Inverse(Variable.X); @@ -104,7 +104,7 @@ public void TestInverseUndefined() Test(exp, ResultTypes.Matrix); } - [Fact] + [Test] public void TestInverseMatrix() { var matrix = new Matrix(new[] @@ -117,7 +117,7 @@ public void TestInverseMatrix() Test(exp, ResultTypes.Matrix); } - [Fact] + [Test] public void TestInverseException() { var exp = new Inverse(new ComplexNumber(2, 2)); @@ -125,7 +125,7 @@ public void TestInverseException() TestException(exp); } - [Fact] + [Test] public void TestInverseException2() { var exp = new Inverse( @@ -140,7 +140,7 @@ public void TestInverseException2() TestException(exp); } - [Fact] + [Test] public void DotProductUndefined() { var exp = new DotProduct(Variable.X, Variable.X); @@ -148,7 +148,7 @@ public void DotProductUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void DotProductLeftUndefined() { var exp = new DotProduct(Variable.X, new Vector(new IExpression[] { Number.One })); @@ -156,7 +156,7 @@ public void DotProductLeftUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void DotProductRightUndefined() { var exp = new DotProduct(new Vector(new IExpression[] { Number.One }), Variable.X); @@ -164,7 +164,7 @@ public void DotProductRightUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void DotProduct() { var exp = new DotProduct( @@ -174,7 +174,7 @@ public void DotProduct() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void DotProductLeftException() { var exp = new DotProduct( @@ -184,7 +184,7 @@ public void DotProductLeftException() TestBinaryException(exp); } - [Fact] + [Test] public void DotProductRightException() { var exp = new DotProduct( @@ -194,7 +194,7 @@ public void DotProductRightException() TestBinaryException(exp); } - [Fact] + [Test] public void CrossProductUndefined() { var exp = new CrossProduct(Variable.X, Variable.X); @@ -202,7 +202,7 @@ public void CrossProductUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void CrossProductLeftUndefined() { var exp = new CrossProduct(Variable.X, new Vector(new IExpression[] { Number.One })); @@ -210,7 +210,7 @@ public void CrossProductLeftUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void CrossProductRightUndefined() { var exp = new CrossProduct(new Vector(new IExpression[] { Number.One }), Variable.X); @@ -218,7 +218,7 @@ public void CrossProductRightUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void CrossProduct() { var exp = new CrossProduct( @@ -228,7 +228,7 @@ public void CrossProduct() Test(exp, ResultTypes.Vector); } - [Fact] + [Test] public void CrossProductLeftException() { var exp = new CrossProduct( @@ -238,7 +238,7 @@ public void CrossProductLeftException() TestBinaryException(exp); } - [Fact] + [Test] public void CrossProductRightException() { var exp = new CrossProduct( @@ -248,7 +248,7 @@ public void CrossProductRightException() TestBinaryException(exp); } - [Fact] + [Test] public void TestTransposeUndefined() { var exp = new Transpose(Variable.X); @@ -256,7 +256,7 @@ public void TestTransposeUndefined() Test(exp, ResultTypes.Matrix); } - [Fact] + [Test] public void TestTransposeMatrix() { var matrix = new Matrix(new[] @@ -269,7 +269,7 @@ public void TestTransposeMatrix() Test(exp, ResultTypes.Matrix); } - [Fact] + [Test] public void TestTransposeException() { var exp = new Transpose(new ComplexNumber(2, 2)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/MulTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/MulTests.cs index aa6cc498e..1da13000b 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/MulTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/MulTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class MulTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestMulTwoNumberTest() { var mul = new Mul(Number.One, Number.Two); @@ -13,7 +13,7 @@ public void TestMulTwoNumberTest() Test(mul, ResultTypes.Number); } - [Fact] + [Test] public void TestMulNumberVarTest() { var mul = new Mul(Number.One, Variable.X); @@ -21,7 +21,7 @@ public void TestMulNumberVarTest() Test(mul, ResultTypes.Undefined); } - [Fact] + [Test] public void TestMulNumberBoolTest() { var mul = new Mul(Number.One, Bool.True); @@ -29,7 +29,7 @@ public void TestMulNumberBoolTest() TestBinaryException(mul); } - [Fact] + [Test] public void TestMulBoolNumberTest() { var mul = new Mul(Bool.True, Number.One); @@ -37,7 +37,7 @@ public void TestMulBoolNumberTest() TestBinaryException(mul); } - [Fact] + [Test] public void TestMulVarNumberTest() { var mul = new Mul(Variable.X, Number.One); @@ -45,7 +45,7 @@ public void TestMulVarNumberTest() Test(mul, ResultTypes.Undefined); } - [Fact] + [Test] public void TestMulTwoMatrixTest() { var mul = new Mul( @@ -56,7 +56,7 @@ public void TestMulTwoMatrixTest() Test(mul, ResultTypes.Matrix); } - [Fact] + [Test] public void TestMulLeftMatrixRightException() { var mul = new Mul( @@ -67,7 +67,7 @@ public void TestMulLeftMatrixRightException() TestBinaryException(mul); } - [Fact] + [Test] public void TestMulRightMatrixLeftException() { var mul = new Mul( @@ -78,7 +78,7 @@ public void TestMulRightMatrixLeftException() TestBinaryException(mul); } - [Fact] + [Test] public void TestMulNumberVectorTest() { var mul = new Mul( @@ -89,7 +89,7 @@ public void TestMulNumberVectorTest() Test(mul, ResultTypes.Vector); } - [Fact] + [Test] public void TestMulVectorNumber() { var mul = new Mul( @@ -100,7 +100,7 @@ public void TestMulVectorNumber() Test(mul, ResultTypes.Vector); } - [Fact] + [Test] public void TestMulVectors() { var mul = new Mul( @@ -111,7 +111,7 @@ public void TestMulVectors() Test(mul, ResultTypes.Vector); } - [Fact] + [Test] public void TestMulNumberMatrixTest() { var mul = new Mul( @@ -122,7 +122,7 @@ public void TestMulNumberMatrixTest() Test(mul, ResultTypes.Matrix); } - [Fact] + [Test] public void TestMulMatrixAndNumberTest() { var mul = new Mul( @@ -133,7 +133,7 @@ public void TestMulMatrixAndNumberTest() Test(mul, ResultTypes.Matrix); } - [Fact] + [Test] public void TestMulVectorMatrixTest() { var mul = new Mul( @@ -144,7 +144,7 @@ public void TestMulVectorMatrixTest() Test(mul, ResultTypes.Matrix); } - [Fact] + [Test] public void TestMulMatrixAndVectorTest() { var mul = new Mul( @@ -155,7 +155,7 @@ public void TestMulMatrixAndVectorTest() Test(mul, ResultTypes.Matrix); } - [Fact] + [Test] public void TestMulVectorBoolException() { var mul = new Mul(new Vector(new IExpression[] { Number.One }), Bool.False); @@ -163,7 +163,7 @@ public void TestMulVectorBoolException() TestBinaryException(mul); } - [Fact] + [Test] public void TestMulBoolVectorException() { var mul = new Mul(Bool.False, new Vector(new IExpression[] { Number.One })); @@ -171,7 +171,7 @@ public void TestMulBoolVectorException() TestBinaryException(mul); } - [Fact] + [Test] public void TestMulComplexNumberComplexNumberTest() { var exp = new Mul(new ComplexNumber(2, 5), new ComplexNumber(3, 2)); @@ -179,7 +179,7 @@ public void TestMulComplexNumberComplexNumberTest() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestMulComplexNumberNumberTest() { var exp = new Mul(new ComplexNumber(2, 5), Number.Two); @@ -187,7 +187,7 @@ public void TestMulComplexNumberNumberTest() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestMulComplexNumberBoolTest() { var exp = new Mul(new ComplexNumber(2, 5), Bool.True); @@ -195,7 +195,7 @@ public void TestMulComplexNumberBoolTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestMulNumberComplexNumberTest() { var exp = new Mul(Number.Two, new ComplexNumber(3, 2)); @@ -203,7 +203,7 @@ public void TestMulNumberComplexNumberTest() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestMulBoolComplexNumberTest() { var exp = new Mul(Bool.True, new ComplexNumber(2, 5)); @@ -211,7 +211,7 @@ public void TestMulBoolComplexNumberTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestMulException() { var exp = new Mul(Bool.False, Bool.True); @@ -219,7 +219,7 @@ public void TestMulException() TestException(exp); } - [Fact] + [Test] public void TestMulNumberAngle() { var exp = new Mul( @@ -230,7 +230,7 @@ public void TestMulNumberAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestMulAngleNumber() { var exp = new Mul( @@ -241,7 +241,7 @@ public void TestMulAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestMulNumberPower() { var exp = new Mul( @@ -252,7 +252,7 @@ public void TestMulNumberPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestMulPowerNumber() { var exp = new Mul( @@ -263,7 +263,7 @@ public void TestMulPowerNumber() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestMulNumberTemperature() { var exp = new Mul( @@ -274,7 +274,7 @@ public void TestMulNumberTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestMulTemperatureNumber() { var exp = new Mul( @@ -285,7 +285,7 @@ public void TestMulTemperatureNumber() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestMulNumberAndMass() { var exp = new Mul( @@ -296,7 +296,7 @@ public void TestMulNumberAndMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestMulMassAndNumber() { var exp = new Mul( @@ -307,7 +307,7 @@ public void TestMulMassAndNumber() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestMulNumberAndLength() { var exp = new Mul( @@ -318,7 +318,7 @@ public void TestMulNumberAndLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestMulLengthAndNumber() { var exp = new Mul( @@ -329,7 +329,7 @@ public void TestMulLengthAndNumber() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestMulLengthAndLength() { var exp = new Mul( @@ -340,7 +340,7 @@ public void TestMulLengthAndLength() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestMulAreaAndLength() { var exp = new Mul( @@ -351,7 +351,7 @@ public void TestMulAreaAndLength() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestMulLengthAndArea() { var exp = new Mul( @@ -362,7 +362,7 @@ public void TestMulLengthAndArea() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestMulNumberAndTime() { var exp = new Mul( @@ -373,7 +373,7 @@ public void TestMulNumberAndTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestMulTimeAndNumber() { var exp = new Mul( @@ -384,7 +384,7 @@ public void TestMulTimeAndNumber() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestMulNumberAndArea() { var exp = new Mul( @@ -395,7 +395,7 @@ public void TestMulNumberAndArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestMulAreaAndNumber() { var exp = new Mul( @@ -406,7 +406,7 @@ public void TestMulAreaAndNumber() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestMulNumberAndVolume() { var exp = new Mul( @@ -417,7 +417,7 @@ public void TestMulNumberAndVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestMulVolumeAndNumber() { var exp = new Mul( @@ -428,7 +428,7 @@ public void TestMulVolumeAndNumber() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestMulRationalAndRational() { var exp = new Mul( @@ -439,7 +439,7 @@ public void TestMulRationalAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestMulNumberAndRational() { var exp = new Mul( @@ -450,7 +450,7 @@ public void TestMulNumberAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestMulRationalAndNumber() { var exp = new Mul( @@ -488,8 +488,8 @@ public static IEnumerable GetDataForTestMulAngleAndBoolTest() yield return new object[] { Bool.False, VolumeValue.Meter(90).AsExpression() }; } - [Theory] - [MemberData(nameof(GetDataForTestMulAngleAndBoolTest))] + [Test] + [TestCaseSource(nameof(GetDataForTestMulAngleAndBoolTest))] public void TestMulAngleAndBoolTest(IExpression left, IExpression right) { var exp = new Mul(left, right); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/NumericConvertionTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/NumericConvertionTests.cs index a6d04629d..da8d9cb8f 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/NumericConvertionTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/NumericConvertionTests.cs @@ -5,10 +5,10 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class NumericConvertionTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(ToBin))] - [InlineData(typeof(ToOct))] - [InlineData(typeof(ToHex))] + [Test] + [TestCase(typeof(ToBin))] + [TestCase(typeof(ToOct))] + [TestCase(typeof(ToHex))] public void UndefinedTest(Type type) { var exp = Create(type, Variable.X); @@ -16,10 +16,10 @@ public void UndefinedTest(Type type) Test(exp, ResultTypes.String); } - [Theory] - [InlineData(typeof(ToBin))] - [InlineData(typeof(ToOct))] - [InlineData(typeof(ToHex))] + [Test] + [TestCase(typeof(ToBin))] + [TestCase(typeof(ToOct))] + [TestCase(typeof(ToHex))] public void NumberTest(Type type) { var exp = Create(type, new Number(10)); @@ -27,10 +27,10 @@ public void NumberTest(Type type) Test(exp, ResultTypes.String); } - [Theory] - [InlineData(typeof(ToBin))] - [InlineData(typeof(ToOct))] - [InlineData(typeof(ToHex))] + [Test] + [TestCase(typeof(ToBin))] + [TestCase(typeof(ToOct))] + [TestCase(typeof(ToHex))] public void BoolTest(Type type) { var exp = Create(type, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/PowTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/PowTests.cs index a84829da6..2d205a295 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/PowTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/PowTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class PowTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestPowComplexAndUndefined() { var exp = new Pow(new ComplexNumber(2, 2), Variable.X); @@ -13,7 +13,7 @@ public void TestPowComplexAndUndefined() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestPowComplexAndNumber() { var exp = new Pow(new ComplexNumber(2, 4), new Number(4)); @@ -21,7 +21,7 @@ public void TestPowComplexAndNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestPowComplexAndComplex() { var exp = new Pow(new ComplexNumber(4, 2), new ComplexNumber(2, 4)); @@ -29,7 +29,7 @@ public void TestPowComplexAndComplex() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestPowUndefinedAndNumber() { var exp = new Pow(Variable.X, Number.Two); @@ -37,7 +37,7 @@ public void TestPowUndefinedAndNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestPowNumberAndUndefined() { var exp = new Pow(Number.Two, Variable.X); @@ -45,7 +45,7 @@ public void TestPowNumberAndUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestPowNumber() { var exp = new Pow(new Number(4), Number.Two); @@ -53,7 +53,7 @@ public void TestPowNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestNumberAndComplex() { var exp = new Pow(Number.Two, new ComplexNumber(2, 4)); @@ -61,7 +61,7 @@ public void TestNumberAndComplex() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestRationalAndNumber() { var exp = new Pow( @@ -71,7 +71,7 @@ public void TestRationalAndNumber() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestPowException() { var exp = new Pow(Bool.False, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/AssignmentOperatorsTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/AssignmentOperatorsTests.cs index b161a4ae2..76b21bb0d 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/AssignmentOperatorsTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/AssignmentOperatorsTests.cs @@ -5,13 +5,13 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests.ProgrammingTests; public class AssignmentOperatorsTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(AddAssign))] - [InlineData(typeof(SubAssign))] - [InlineData(typeof(MulAssign))] - [InlineData(typeof(DivAssign))] - [InlineData(typeof(LeftShiftAssign))] - [InlineData(typeof(RightShiftAssign))] + [Test] + [TestCase(typeof(AddAssign))] + [TestCase(typeof(SubAssign))] + [TestCase(typeof(MulAssign))] + [TestCase(typeof(DivAssign))] + [TestCase(typeof(LeftShiftAssign))] + [TestCase(typeof(RightShiftAssign))] public void TestAssignUndefined(Type type) { var exp = Create(type, Variable.X, Variable.X); @@ -19,13 +19,13 @@ public void TestAssignUndefined(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(AddAssign))] - [InlineData(typeof(SubAssign))] - [InlineData(typeof(MulAssign))] - [InlineData(typeof(DivAssign))] - [InlineData(typeof(LeftShiftAssign))] - [InlineData(typeof(RightShiftAssign))] + [Test] + [TestCase(typeof(AddAssign))] + [TestCase(typeof(SubAssign))] + [TestCase(typeof(MulAssign))] + [TestCase(typeof(DivAssign))] + [TestCase(typeof(LeftShiftAssign))] + [TestCase(typeof(RightShiftAssign))] public void TestAssignNumber(Type type) { var exp = Create(type, Variable.X, new Number(10)); @@ -33,13 +33,13 @@ public void TestAssignNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(AddAssign))] - [InlineData(typeof(SubAssign))] - [InlineData(typeof(MulAssign))] - [InlineData(typeof(DivAssign))] - [InlineData(typeof(LeftShiftAssign))] - [InlineData(typeof(RightShiftAssign))] + [Test] + [TestCase(typeof(AddAssign))] + [TestCase(typeof(SubAssign))] + [TestCase(typeof(MulAssign))] + [TestCase(typeof(DivAssign))] + [TestCase(typeof(LeftShiftAssign))] + [TestCase(typeof(RightShiftAssign))] public void TestAssignException(Type type) { var exp = Create(type, Variable.X, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ConditionalOperatorsTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ConditionalOperatorsTests.cs index b6073e401..8f54a4dfe 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ConditionalOperatorsTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ConditionalOperatorsTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests.ProgrammingTests; public class ConditionalOperatorsTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestUndefined(Type type) { var exp = CreateBinary(type, Variable.X, Variable.X); @@ -15,9 +15,9 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestBoolUndefined(Type type) { var exp = CreateBinary(type, Bool.True, Variable.X); @@ -25,9 +25,9 @@ public void TestBoolUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestUndefinedBool(Type type) { var exp = CreateBinary(type, Variable.X, Bool.True); @@ -35,9 +35,9 @@ public void TestUndefinedBool(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestBool(Type type) { var exp = CreateBinary(type, Bool.False, Bool.True); @@ -45,9 +45,9 @@ public void TestBool(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestComplexBool(Type type) { var exp = CreateBinary(type, new ComplexNumber(2, 3), Bool.False); @@ -55,9 +55,9 @@ public void TestComplexBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestBoolComplex(Type type) { var exp = CreateBinary(type, Bool.False, new ComplexNumber(2, 3)); @@ -65,9 +65,9 @@ public void TestBoolComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(ConditionalAnd))] - [InlineData(typeof(ConditionalOr))] + [Test] + [TestCase(typeof(ConditionalAnd))] + [TestCase(typeof(ConditionalOr))] public void TestConditionalException(Type type) { var exp = CreateBinary(type, new ComplexNumber(2, 3), new ComplexNumber(2, 3)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/EqualityOperatorsTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/EqualityOperatorsTests.cs index 6ae79d88f..181cf56c6 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/EqualityOperatorsTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/EqualityOperatorsTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests.ProgrammingTests; public class EqualityOperatorsTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefined(Type type) { var exp = Create(type, Variable.X, Variable.X); @@ -15,9 +15,9 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestNumberAndUndefined(Type type) { var exp = Create(type, Number.One, Variable.X); @@ -25,9 +25,9 @@ public void TestNumberAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndNumber(Type type) { var exp = Create(type, Variable.X, Number.One); @@ -35,9 +35,9 @@ public void TestUndefinedAndNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestBoolAndUndefined(Type type) { var exp = Create(type, Bool.True, Variable.X); @@ -45,9 +45,9 @@ public void TestBoolAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndBool(Type type) { var exp = Create(type, Variable.X, Bool.True); @@ -55,9 +55,9 @@ public void TestUndefinedAndBool(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestAngleAndUndefined(Type type) { var exp = Create(type, AngleValue.Degree(1).AsExpression(), Variable.X); @@ -65,9 +65,9 @@ public void TestAngleAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndAngle(Type type) { var exp = Create(type, Variable.X, AngleValue.Degree(1).AsExpression()); @@ -75,9 +75,9 @@ public void TestUndefinedAndAngle(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestPowerAndUndefined(Type type) { var exp = Create(type, PowerValue.Watt(1).AsExpression(), Variable.X); @@ -85,9 +85,9 @@ public void TestPowerAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndPower(Type type) { var exp = Create(type, Variable.X, PowerValue.Watt(1).AsExpression()); @@ -95,9 +95,9 @@ public void TestUndefinedAndPower(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestTemperatureAndUndefined(Type type) { var exp = Create(type, TemperatureValue.Celsius(1).AsExpression(), Variable.X); @@ -105,9 +105,9 @@ public void TestTemperatureAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndTemperature(Type type) { var exp = Create(type, Variable.X, TemperatureValue.Celsius(1).AsExpression()); @@ -115,9 +115,9 @@ public void TestUndefinedAndTemperature(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestMassAndUndefined(Type type) { var exp = Create(type, MassValue.Gram(1).AsExpression(), Variable.X); @@ -125,9 +125,9 @@ public void TestMassAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndMass(Type type) { var exp = Create(type, Variable.X, MassValue.Gram(1).AsExpression()); @@ -135,9 +135,9 @@ public void TestUndefinedAndMass(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestLengthAndUndefined(Type type) { var exp = Create(type, LengthValue.Centimeter(1).AsExpression(), Variable.X); @@ -145,9 +145,9 @@ public void TestLengthAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndLength(Type type) { var exp = Create(type, Variable.X, LengthValue.Centimeter(1).AsExpression()); @@ -155,9 +155,9 @@ public void TestUndefinedAndLength(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestTimeAndUndefined(Type type) { var exp = Create(type, TimeValue.Second(1).AsExpression(), Variable.X); @@ -165,9 +165,9 @@ public void TestTimeAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndTime(Type type) { var exp = Create(type, Variable.X, TimeValue.Second(1).AsExpression()); @@ -175,9 +175,9 @@ public void TestUndefinedAndTime(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestAreaAndUndefined(Type type) { var exp = Create(type, AreaValue.Meter(1).AsExpression(), Variable.X); @@ -185,9 +185,9 @@ public void TestAreaAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndArea(Type type) { var exp = Create(type, Variable.X, AreaValue.Meter(1).AsExpression()); @@ -195,9 +195,9 @@ public void TestUndefinedAndArea(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestVolumeAndUndefined(Type type) { var exp = Create(type, VolumeValue.Meter(1).AsExpression(), Variable.X); @@ -205,9 +205,9 @@ public void TestVolumeAndUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestUndefinedAndVolume(Type type) { var exp = Create(type, Variable.X, VolumeValue.Meter(1).AsExpression()); @@ -215,9 +215,9 @@ public void TestUndefinedAndVolume(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestNumber(Type type) { var exp = Create(type, new Number(20), new Number(10)); @@ -225,9 +225,9 @@ public void TestNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestBoolean(Type type) { var exp = Create(type, Bool.False, Bool.True); @@ -235,9 +235,9 @@ public void TestBoolean(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestAngleNumber(Type type) { var exp = Create(type, @@ -248,9 +248,9 @@ public void TestAngleNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestPowerNumber(Type type) { var exp = Create(type, @@ -261,9 +261,9 @@ public void TestPowerNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestTemperatureNumber(Type type) { var exp = Create(type, @@ -274,9 +274,9 @@ public void TestTemperatureNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestMassNumber(Type type) { var exp = Create(type, @@ -287,9 +287,9 @@ public void TestMassNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestLengthNumber(Type type) { var exp = Create(type, @@ -300,9 +300,9 @@ public void TestLengthNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestTimeNumber(Type type) { var exp = Create(type, @@ -313,9 +313,9 @@ public void TestTimeNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestAreaNumber(Type type) { var exp = Create(type, @@ -326,9 +326,9 @@ public void TestAreaNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestVolumeNumber(Type type) { var exp = Create(type, @@ -339,9 +339,9 @@ public void TestVolumeNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndNumber(Type type) { var exp = CreateBinary(type, new ComplexNumber(1, 2), new Number(20)); @@ -349,9 +349,9 @@ public void TestComplexAndNumber(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestNumberAndComplex(Type type) { var exp = CreateBinary(type, new Number(20), new ComplexNumber(1, 2)); @@ -359,9 +359,9 @@ public void TestNumberAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndBool(Type type) { var exp = CreateBinary(type, new ComplexNumber(1, 2), Bool.True); @@ -369,9 +369,9 @@ public void TestComplexAndBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestBoolAndComplex(Type type) { var exp = CreateBinary(type, Bool.False, new ComplexNumber(1, 2)); @@ -379,9 +379,9 @@ public void TestBoolAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndAngle(Type type) { var exp = CreateBinary(type, @@ -392,9 +392,9 @@ public void TestComplexAndAngle(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestAngleAndComplex(Type type) { var exp = CreateBinary(type, @@ -405,9 +405,9 @@ public void TestAngleAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndPower(Type type) { var exp = CreateBinary(type, @@ -418,9 +418,9 @@ public void TestComplexAndPower(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestPowerAndComplex(Type type) { var exp = CreateBinary(type, @@ -431,9 +431,9 @@ public void TestPowerAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndTemperature(Type type) { var exp = CreateBinary(type, @@ -444,9 +444,9 @@ public void TestComplexAndTemperature(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestTemperatureAndComplex(Type type) { var exp = CreateBinary(type, @@ -457,9 +457,9 @@ public void TestTemperatureAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndMass(Type type) { var exp = CreateBinary(type, @@ -470,9 +470,9 @@ public void TestComplexAndMass(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestMassAndComplex(Type type) { var exp = CreateBinary(type, @@ -483,9 +483,9 @@ public void TestMassAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndLength(Type type) { var exp = CreateBinary(type, @@ -496,9 +496,9 @@ public void TestComplexAndLength(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestLengthAndComplex(Type type) { var exp = CreateBinary(type, @@ -509,9 +509,9 @@ public void TestLengthAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndTime(Type type) { var exp = CreateBinary(type, @@ -522,9 +522,9 @@ public void TestComplexAndTime(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestTimeAndComplex(Type type) { var exp = CreateBinary(type, @@ -535,9 +535,9 @@ public void TestTimeAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndArea(Type type) { var exp = CreateBinary(type, @@ -548,9 +548,9 @@ public void TestComplexAndArea(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestAreaAndComplex(Type type) { var exp = CreateBinary(type, @@ -561,9 +561,9 @@ public void TestAreaAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestComplexAndVolume(Type type) { var exp = CreateBinary(type, @@ -574,9 +574,9 @@ public void TestComplexAndVolume(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestVolumeAndComplex(Type type) { var exp = CreateBinary(type, @@ -587,9 +587,9 @@ public void TestVolumeAndComplex(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(Equal))] - [InlineData(typeof(NotEqual))] + [Test] + [TestCase(typeof(Equal))] + [TestCase(typeof(NotEqual))] public void TestInvalidArgsException(Type type) { var exp = Create(type, new ComplexNumber(2, 3), new ComplexNumber(2, 3)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ProgrammingTest.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ProgrammingTest.cs index c44735d82..8f4de714a 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ProgrammingTest.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ProgrammingTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests.ProgrammingTests; public class ProgrammingTest : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestDec() { var exp = new Dec(Variable.X); @@ -13,7 +13,7 @@ public void TestDec() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestForUndefined() { var exp = new For(Variable.X, Variable.X, Variable.X, Variable.X); @@ -21,7 +21,7 @@ public void TestForUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestForNumber() { var exp = new For(Variable.X, Variable.X, Bool.False, Variable.X); @@ -29,7 +29,7 @@ public void TestForNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestForException() { var exp = new For(Variable.X, Variable.X, new ComplexNumber(2, 3), Variable.X); @@ -37,7 +37,7 @@ public void TestForException() TestException(exp); } - [Fact] + [Test] public void TestIfUndefined() { var exp = new If(Variable.X, new Number(10)); @@ -45,7 +45,7 @@ public void TestIfUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestIfBool() { var exp = new If(Bool.False, new Number(10)); @@ -53,7 +53,7 @@ public void TestIfBool() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestIfElseBool() { var exp = new If(Bool.False, new Number(10), Number.Two); @@ -61,7 +61,7 @@ public void TestIfElseBool() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestIfException() { var exp = new If(new ComplexNumber(2, 4), new Number(10)); @@ -69,7 +69,7 @@ public void TestIfException() TestDiffParamException(exp); } - [Fact] + [Test] public void TestInc() { var exp = new Inc(Variable.X); @@ -78,7 +78,7 @@ public void TestInc() } - [Fact] + [Test] public void TestWhileUndefined() { var exp = new While(Variable.X, Variable.X); @@ -86,7 +86,7 @@ public void TestWhileUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestWhileNumber() { var exp = new While(Variable.X, Bool.False); @@ -94,7 +94,7 @@ public void TestWhileNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestWhileException() { var exp = new While(Variable.X, Number.One); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/RelationalOperatorsTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/RelationalOperatorsTests.cs index 41b561303..8ad336fa4 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/RelationalOperatorsTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/RelationalOperatorsTests.cs @@ -5,11 +5,11 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests.ProgrammingTests; public class GreaterOrEqualTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestUndefined(Type type) { var exp = CreateBinary(type, Variable.X, Variable.X); @@ -17,11 +17,11 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestNumberUndefined(Type type) { var exp = CreateBinary(type, Number.One, Variable.X); @@ -29,11 +29,11 @@ public void TestNumberUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestUndefinedNumber(Type type) { var exp = CreateBinary(type, Variable.X, Number.One); @@ -41,11 +41,11 @@ public void TestUndefinedNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestAngleUndefined(Type type) { var exp = CreateBinary(type, AngleValue.Degree(1).AsExpression(), Variable.X); @@ -53,11 +53,11 @@ public void TestAngleUndefined(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestGUndefinedAngle(Type type) { var exp = CreateBinary(type, Variable.X, AngleValue.Degree(1).AsExpression()); @@ -65,11 +65,11 @@ public void TestGUndefinedAngle(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestNumber(Type type) { var exp = CreateBinary(type, new Number(10), new Number(10)); @@ -77,11 +77,11 @@ public void TestNumber(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestAngle(Type type) { var exp = CreateBinary(type, @@ -92,11 +92,11 @@ public void TestAngle(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestPower(Type type) { var exp = CreateBinary(type, @@ -107,11 +107,11 @@ public void TestPower(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestTemperature(Type type) { var exp = CreateBinary(type, @@ -122,11 +122,11 @@ public void TestTemperature(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestMass(Type type) { var exp = CreateBinary(type, @@ -137,11 +137,11 @@ public void TestMass(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestLength(Type type) { var exp = CreateBinary(type, @@ -152,11 +152,11 @@ public void TestLength(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestTime(Type type) { var exp = CreateBinary(type, @@ -167,11 +167,11 @@ public void TestTime(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestArea(Type type) { var exp = CreateBinary(type, @@ -182,11 +182,11 @@ public void TestArea(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestVolume(Type type) { var exp = CreateBinary(type, @@ -197,11 +197,11 @@ public void TestVolume(Type type) Test(exp, ResultTypes.Boolean); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolNumberException(Type type) { var exp = CreateBinary(type, Bool.True, new Number(10)); @@ -209,11 +209,11 @@ public void TestBoolNumberException(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestNumberBoolException(Type type) { var exp = CreateBinary(type, new Number(10), Bool.True); @@ -221,11 +221,11 @@ public void TestNumberBoolException(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolAngle(Type type) { var exp = CreateBinary(type, @@ -236,11 +236,11 @@ public void TestBoolAngle(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestAngleBool(Type type) { var exp = CreateBinary(type, @@ -251,11 +251,11 @@ public void TestAngleBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolPower(Type type) { var exp = CreateBinary(type, @@ -266,11 +266,11 @@ public void TestBoolPower(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestPowerBool(Type type) { var exp = CreateBinary(type, @@ -281,11 +281,11 @@ public void TestPowerBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolTemperature(Type type) { var exp = CreateBinary(type, @@ -296,11 +296,11 @@ public void TestBoolTemperature(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestTemperatureBool(Type type) { var exp = CreateBinary(type, @@ -311,11 +311,11 @@ public void TestTemperatureBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolMass(Type type) { var exp = CreateBinary(type, @@ -326,11 +326,11 @@ public void TestBoolMass(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestMassBool(Type type) { var exp = CreateBinary(type, @@ -341,11 +341,11 @@ public void TestMassBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolLength(Type type) { var exp = CreateBinary(type, @@ -356,11 +356,11 @@ public void TestBoolLength(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestLengthBool(Type type) { var exp = CreateBinary(type, @@ -371,11 +371,11 @@ public void TestLengthBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolTime(Type type) { var exp = CreateBinary(type, @@ -386,11 +386,11 @@ public void TestBoolTime(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestTimeBool(Type type) { var exp = CreateBinary(type, @@ -401,11 +401,11 @@ public void TestTimeBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolArea(Type type) { var exp = CreateBinary(type, @@ -416,11 +416,11 @@ public void TestBoolArea(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestAreaBool(Type type) { var exp = CreateBinary(type, @@ -431,11 +431,11 @@ public void TestAreaBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestBoolVolume(Type type) { var exp = CreateBinary(type, @@ -446,11 +446,11 @@ public void TestBoolVolume(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestVolumeBool(Type type) { var exp = CreateBinary(type, @@ -461,11 +461,11 @@ public void TestVolumeBool(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(GreaterThan))] - [InlineData(typeof(GreaterOrEqual))] - [InlineData(typeof(LessThan))] - [InlineData(typeof(LessOrEqual))] + [Test] + [TestCase(typeof(GreaterThan))] + [TestCase(typeof(GreaterOrEqual))] + [TestCase(typeof(LessThan))] + [TestCase(typeof(LessOrEqual))] public void TestRelationalOperatorException(Type type) { var exp = CreateBinary(type, Bool.True, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ShiftOperatorsTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ShiftOperatorsTests.cs index 0dbc2e374..1bbae8751 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ShiftOperatorsTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ProgrammingTests/ShiftOperatorsTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests.ProgrammingTests; public class ShiftOperatorsTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignUndefined(Type type) { var exp = Create(type, Variable.X, Variable.X); @@ -15,9 +15,9 @@ public void TestAssignUndefined(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignUndefinedNumber(Type type) { var exp = Create(type, Variable.X, Number.One); @@ -25,9 +25,9 @@ public void TestAssignUndefinedNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignNumberUndefined(Type type) { var exp = Create(type, Number.One, Variable.X); @@ -35,9 +35,9 @@ public void TestAssignNumberUndefined(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignNumbers(Type type) { var exp = Create(type, Number.One, Number.One); @@ -45,9 +45,9 @@ public void TestAssignNumbers(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignLeftException(Type type) { var exp = CreateBinary(type, Bool.False, Number.One); @@ -55,9 +55,9 @@ public void TestAssignLeftException(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignRightException(Type type) { var exp = CreateBinary(type, Number.One, Bool.False); @@ -65,9 +65,9 @@ public void TestAssignRightException(Type type) TestBinaryException(exp); } - [Theory] - [InlineData(typeof(LeftShift))] - [InlineData(typeof(RightShift))] + [Test] + [TestCase(typeof(LeftShift))] + [TestCase(typeof(RightShift))] public void TestAssignException(Type type) { var exp = Create(type, Bool.False, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/RootTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/RootTests.cs index 143e9b369..563f32fd8 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/RootTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/RootTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class RootTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestRootUndefined() { var exp = new Root(Variable.X, Variable.X); @@ -13,7 +13,7 @@ public void TestRootUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRootUndefinedAndNumber() { var exp = new Root(Variable.X, Number.Two); @@ -21,7 +21,7 @@ public void TestRootUndefinedAndNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRootNumberAndUndefined() { var exp = new Root(Number.Two, Variable.X); @@ -29,7 +29,7 @@ public void TestRootNumberAndUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRootNumber() { var exp = new Root(new Number(4), Number.Two); @@ -37,7 +37,7 @@ public void TestRootNumber() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRootUndefinedAndBool() { var exp = new Root(Variable.X, Bool.False); @@ -45,7 +45,7 @@ public void TestRootUndefinedAndBool() TestBinaryException(exp); } - [Fact] + [Test] public void TestRootBoolAndUndefined() { var exp = new Root(Bool.False, Variable.X); @@ -53,7 +53,7 @@ public void TestRootBoolAndUndefined() TestBinaryException(exp); } - [Fact] + [Test] public void TestRootNumberAndBool() { var exp = new Root(Number.Two, Bool.False); @@ -61,7 +61,7 @@ public void TestRootNumberAndBool() TestBinaryException(exp); } - [Fact] + [Test] public void TestRootBoolAndNumber() { var exp = new Root(Bool.False, Number.Two); @@ -69,7 +69,7 @@ public void TestRootBoolAndNumber() TestBinaryException(exp); } - [Fact] + [Test] public void TestRootInvalidArgsException() { var exp = new Root(Bool.False, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/RoundTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/RoundTests.cs index 4e76413e2..7b8df23c1 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/RoundTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/RoundTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class RoundTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestRoundVariable() { var exp = new Round(Variable.X, new Number(10)); @@ -13,7 +13,7 @@ public void TestRoundVariable() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRoundNumber() { var exp = new Round(new Number(10), new Number(10)); @@ -21,7 +21,7 @@ public void TestRoundNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestRoundAngleNumber() { var exp = new Round(AngleValue.Degree(10).AsExpression(), new Number(10)); @@ -29,7 +29,7 @@ public void TestRoundAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestRoundPowerNumber() { var exp = new Round(PowerValue.Watt(10).AsExpression(), new Number(10)); @@ -37,7 +37,7 @@ public void TestRoundPowerNumber() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestRoundTemperatureNumber() { var exp = new Round(TemperatureValue.Celsius(10).AsExpression(), new Number(10)); @@ -45,7 +45,7 @@ public void TestRoundTemperatureNumber() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestRoundMassNumber() { var exp = new Round(MassValue.Gram(10).AsExpression(), new Number(10)); @@ -53,7 +53,7 @@ public void TestRoundMassNumber() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestRoundLengthNumber() { var exp = new Round(LengthValue.Meter(10).AsExpression(), new Number(10)); @@ -61,7 +61,7 @@ public void TestRoundLengthNumber() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestRoundTimeNumber() { var exp = new Round(TimeValue.Second(10).AsExpression(), new Number(10)); @@ -69,7 +69,7 @@ public void TestRoundTimeNumber() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestRoundAreaNumber() { var exp = new Round(AreaValue.Meter(10).AsExpression(), new Number(10)); @@ -77,7 +77,7 @@ public void TestRoundAreaNumber() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestRoundVolumeNumber() { var exp = new Round(VolumeValue.Meter(10).AsExpression(), new Number(10)); @@ -85,7 +85,7 @@ public void TestRoundVolumeNumber() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestRoundWithUnsupportedPrecisionException() { var exp = new Round(new Number(10), new ComplexNumber(10)); @@ -93,7 +93,7 @@ public void TestRoundWithUnsupportedPrecisionException() TestDiffParamException(exp); } - [Fact] + [Test] public void TestRoundException() { var exp = new Round(new ComplexNumber(10), new Number(10)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/SignTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/SignTests.cs index e982f2380..024fbb4b6 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/SignTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/SignTests.cs @@ -2,67 +2,67 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class SignTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestSignUndefined() { Test(new Sign(Variable.X), ResultTypes.Undefined); } - [Fact] + [Test] public void TestSignNumber() { Test(new Sign(new Number(-5)), ResultTypes.Number); } - [Fact] + [Test] public void TestSignAngle() { Test(new Sign(AngleValue.Degree(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignPower() { Test(new Sign(PowerValue.Watt(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignTemperature() { Test(new Sign(TemperatureValue.Celsius(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignMass() { Test(new Sign(MassValue.Gram(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignLength() { Test(new Sign(LengthValue.Meter(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignTime() { Test(new Sign(TimeValue.Second(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignArea() { Test(new Sign(AreaValue.Meter(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignVolume() { Test(new Sign(VolumeValue.Meter(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestSignException() { TestException(new Sign(Bool.False)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/StandardTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/StandardTests.cs index 0d3aaf52b..999dc2196 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/StandardTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/StandardTests.cs @@ -8,7 +8,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class StandardTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestDefineUndefined() { var exp = new Assign(Variable.X, new Number(-2)); @@ -16,7 +16,7 @@ public void TestDefineUndefined() Test(exp, ResultTypes.String); } - [Fact] + [Test] public void TestDelVector() { var diff = new Differentiator(); @@ -26,7 +26,7 @@ public void TestDelVector() Test(exp, ResultTypes.Function); } - [Fact] + [Test] public void TestDerivExpression() { var diff = new Differentiator(); @@ -36,7 +36,7 @@ public void TestDerivExpression() Test(exp, ResultTypes.Function); } - [Fact] + [Test] public void TestDerivExpressionWithVar() { var diff = new Differentiator(); @@ -46,7 +46,7 @@ public void TestDerivExpressionWithVar() Test(exp, ResultTypes.Function); } - [Fact] + [Test] public void TestDerivNumber() { var diff = new Differentiator(); @@ -56,7 +56,7 @@ public void TestDerivNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestExpUndefined() { var exp = new Exp(Variable.X); @@ -64,7 +64,7 @@ public void TestExpUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestExpNumber() { var exp = new Exp(new Number(10)); @@ -72,7 +72,7 @@ public void TestExpNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestExpComplexNumber() { var exp = new Exp(new ComplexNumber(10, 10)); @@ -80,7 +80,7 @@ public void TestExpComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestExpException() { var exp = new Exp(Bool.False); @@ -88,7 +88,7 @@ public void TestExpException() TestException(exp); } - [Fact] + [Test] public void TestFactUndefined() { var exp = new Fact(Variable.X); @@ -96,7 +96,7 @@ public void TestFactUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestFactNumber() { var exp = new Fact(new Number(10)); @@ -104,7 +104,7 @@ public void TestFactNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestFactException() { var exp = new Fact(Bool.False); @@ -112,7 +112,7 @@ public void TestFactException() TestException(exp); } - [Fact] + [Test] public void TestGCDUndefined() { var exp = new GCD(new Number(10), Variable.X); @@ -120,7 +120,7 @@ public void TestGCDUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestGCDNumber() { var exp = new GCD(new IExpression[] @@ -131,7 +131,7 @@ public void TestGCDNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestGCDException() { var exp = new GCD(new ComplexNumber(10), new Number(10)); @@ -139,7 +139,7 @@ public void TestGCDException() TestDiffParamException(exp); } - [Fact] + [Test] public void TestLCMUndefined() { var exp = new LCM(new Number(10), Variable.X); @@ -147,7 +147,7 @@ public void TestLCMUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestLCMNumber() { var exp = new LCM(new IExpression[] @@ -158,7 +158,7 @@ public void TestLCMNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestLCMException() { var exp = new LCM(new ComplexNumber(10), new Number(10)); @@ -166,7 +166,7 @@ public void TestLCMException() TestDiffParamException(exp); } - [Fact] + [Test] public void TestModUndefined() { var exp = new Mod(Variable.X, Variable.X); @@ -174,7 +174,7 @@ public void TestModUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestModUndefinedAndNumber() { var exp = new Mod(Variable.X, Number.Two); @@ -182,7 +182,7 @@ public void TestModUndefinedAndNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestModNumberAndUndefined() { var exp = new Mod(Number.Two, Variable.X); @@ -190,7 +190,7 @@ public void TestModNumberAndUndefined() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestModNumber() { var exp = new Mod(new Number(4), Number.Two); @@ -198,7 +198,7 @@ public void TestModNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestModNumberAndBool() { var exp = new Mod(new Number(4), Bool.True); @@ -206,7 +206,7 @@ public void TestModNumberAndBool() TestBinaryException(exp); } - [Fact] + [Test] public void TestModBoolAndNumber() { var exp = new Mod(Bool.False, Number.Two); @@ -214,7 +214,7 @@ public void TestModBoolAndNumber() TestBinaryException(exp); } - [Fact] + [Test] public void TestModUndefinedAndBool() { var exp = new Mod(Variable.X, Bool.False); @@ -222,7 +222,7 @@ public void TestModUndefinedAndBool() TestBinaryException(exp); } - [Fact] + [Test] public void TestModBoolAndUndefined() { var exp = new Mod(Bool.False, Variable.X); @@ -230,7 +230,7 @@ public void TestModBoolAndUndefined() TestBinaryException(exp); } - [Fact] + [Test] public void TestModException() { var exp = new Mod(Bool.False, Bool.False); @@ -238,38 +238,38 @@ public void TestModException() TestException(exp); } - [Fact] + [Test] public void TestNumber() { Test(Number.One, ResultTypes.Number); } - [Fact] + [Test] public void TestSimplify() { var simp = new Simplifier(); Test(new Simplify(simp, Variable.X), ResultTypes.Function); } - [Fact] + [Test] public void TestSqrt() { Test(new Sqrt(Variable.X), ResultTypes.Undefined); } - [Fact] + [Test] public void TestUndefine() { Test(new Unassign(Variable.X), ResultTypes.String); } - [Fact] + [Test] public void TestCallExpression() { Test(new CallExpression(new Variable("f"), ImmutableArray.Empty), ResultTypes.Undefined); } - [Fact] + [Test] public void TestLambdaExpression() { var exp = Number.One.ToLambdaExpression(); @@ -277,85 +277,85 @@ public void TestLambdaExpression() Test(exp, ResultTypes.Function); } - [Fact] + [Test] public void TestVariable() { Test(new Sqrt(Variable.X), ResultTypes.Undefined); } - [Fact] + [Test] public void TestDeletageExpression() { Test(new DelegateExpression(_ => null), ResultTypes.Undefined); } - [Fact] + [Test] public void TestAngleNumber() { Test(AngleValue.Degree(10).AsExpression(), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToDegreeUndefined() { Test(new ToDegree(Variable.X), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToDegreeNumber() { Test(new ToDegree(new Number(10)), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToDegreeAngle() { Test(new ToDegree(AngleValue.Radian(10).AsExpression()), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToDegreeException() { TestException(new ToDegree(Bool.True)); } - [Fact] + [Test] public void TestToRadianNumber() { Test(new ToRadian(new Number(10)), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToRadianAngle() { Test(new ToRadian(AngleValue.Degree(10).AsExpression()), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToRadianException() { TestException(new ToRadian(Bool.True)); } - [Fact] + [Test] public void TestToGradianNumber() { Test(new ToGradian(new Number(10)), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToGradianAngle() { Test(new ToGradian(AngleValue.Radian(10).AsExpression()), ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestToGradianException() { TestException(new ToGradian(Bool.True)); } - [Fact] + [Test] public void TestStringExpression() { var exp = new StringExpression("hello"); @@ -363,7 +363,7 @@ public void TestStringExpression() Test(exp, ResultTypes.String); } - [Fact] + [Test] public void TestConvertVariable() { var exp = new Convert( @@ -375,7 +375,7 @@ public void TestConvertVariable() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestConvert() { var exp = new Convert( @@ -387,7 +387,7 @@ public void TestConvert() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestAngleConvert() { var exp = new Convert( @@ -399,7 +399,7 @@ public void TestAngleConvert() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestPowerConvert() { var exp = new Convert( @@ -411,7 +411,7 @@ public void TestPowerConvert() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestTemperatureConvert() { var exp = new Convert( @@ -423,7 +423,7 @@ public void TestTemperatureConvert() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestMassConvert() { var exp = new Convert( @@ -435,7 +435,7 @@ public void TestMassConvert() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestLengthConvert() { var exp = new Convert( @@ -447,7 +447,7 @@ public void TestLengthConvert() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestTimeConvert() { var exp = new Convert( @@ -459,7 +459,7 @@ public void TestTimeConvert() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestAreaConvert() { var exp = new Convert( @@ -471,7 +471,7 @@ public void TestAreaConvert() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestVolumeConvert() { var exp = new Convert( @@ -483,7 +483,7 @@ public void TestVolumeConvert() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestConvertException() { var exp = new Convert( @@ -495,7 +495,7 @@ public void TestConvertException() TestException(exp); } - [Fact] + [Test] public void TestRational() { var exp = new Rational(Number.One, Number.Two); @@ -503,7 +503,7 @@ public void TestRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestRationalLeftUndefined() { var exp = new Rational(Variable.X, Number.Two); @@ -511,7 +511,7 @@ public void TestRationalLeftUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRationalRightUndefined() { var exp = new Rational(Number.One, Variable.X); @@ -519,7 +519,7 @@ public void TestRationalRightUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestRationalException() { var exp = new Rational(Bool.True, Bool.False); @@ -527,7 +527,7 @@ public void TestRationalException() TestException(exp); } - [Fact] + [Test] public void TestRationalLeftException() { var exp = new Rational(Bool.True, Number.Two); @@ -535,7 +535,7 @@ public void TestRationalLeftException() TestBinaryException(exp); } - [Fact] + [Test] public void TestRationalRightException() { var exp = new Rational(Number.One, Bool.False); @@ -543,7 +543,7 @@ public void TestRationalRightException() TestBinaryException(exp); } - [Fact] + [Test] public void TestToRational() { var exp = new ToRational(Number.Two); @@ -551,7 +551,7 @@ public void TestToRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestToRationalUndefined() { var exp = new ToRational(Variable.X); @@ -559,7 +559,7 @@ public void TestToRationalUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestToRationalException() { var exp = new ToRational(Bool.False); @@ -567,7 +567,7 @@ public void TestToRationalException() TestException(exp); } - [Theory] - [ClassData(typeof(AllExpressionsData))] + [Test] + [TestCaseSource(typeof(AllExpressionsData))] public void TestNullException(Type type) => TestNullExp(type); } \ No newline at end of file diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/StatisticalTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/StatisticalTests.cs index b66c38509..2f139fa11 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/StatisticalTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/StatisticalTests.cs @@ -5,17 +5,17 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class StatisticalTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void TestUndefined(Type type) { var exp = Create(type, new IExpression[] { Variable.X, Variable.Y }); @@ -23,17 +23,17 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Undefined); } - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void TestAvgNumber(Type type) { var exp = Create(type, new IExpression[] { new Number(3), Number.Two }); @@ -41,17 +41,17 @@ public void TestAvgNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void TestVector(Type type) { var arguments = new IExpression[] @@ -63,17 +63,17 @@ public void TestVector(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void TestOneParamException(Type type) { var exp = CreateDiff(type, new IExpression[] { Bool.False }); @@ -81,17 +81,17 @@ public void TestOneParamException(Type type) TestDiffParamException(exp); } - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void TestParamException(Type type) { var exp = CreateDiff(type, new IExpression[] { Bool.False, Bool.False }); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/SubTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/SubTests.cs index 91261d3c8..8007147d1 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/SubTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/SubTests.cs @@ -7,7 +7,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class SubTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void SubTwoNumberTest() { var sub = new Sub(Number.One, Number.Two); @@ -15,7 +15,7 @@ public void SubTwoNumberTest() Test(sub, ResultTypes.Number); } - [Fact] + [Test] public void SubNumberVarTest() { var sub = new Sub(Number.One, Variable.X); @@ -23,7 +23,7 @@ public void SubNumberVarTest() Test(sub, ResultTypes.Undefined); } - [Fact] + [Test] public void SubComplicatedTest() { var sub = new Sub(new Mul(Number.One, Number.Two), Variable.X); @@ -31,7 +31,7 @@ public void SubComplicatedTest() Test(sub, ResultTypes.Undefined); } - [Fact] + [Test] public void SubTwoVectorTest() { var sub = new Sub( @@ -42,7 +42,7 @@ public void SubTwoVectorTest() Test(sub, ResultTypes.Vector); } - [Fact] + [Test] public void SubTwoMatrixTest() { var sub = new Sub( @@ -53,7 +53,7 @@ public void SubTwoMatrixTest() Test(sub, ResultTypes.Matrix); } - [Fact] + [Test] public void SubNumberVectorTest() { var exp = new Sub( @@ -64,7 +64,7 @@ public void SubNumberVectorTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubVectorNumberTest() { var exp = new Sub( @@ -75,7 +75,7 @@ public void SubVectorNumberTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubNumberMatrixTest() { var exp = new Sub( @@ -86,7 +86,7 @@ public void SubNumberMatrixTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubMatrixNumberTest() { var exp = new Sub( @@ -97,7 +97,7 @@ public void SubMatrixNumberTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubVectorMatrixTest() { var exp = new Sub( @@ -108,7 +108,7 @@ public void SubVectorMatrixTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubMatrixVectorTest() { var exp = new Sub( @@ -119,7 +119,7 @@ public void SubMatrixVectorTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubNumberComplexNumberTest() { var sub = new Sub(Number.One, new ComplexNumber(2, 1)); @@ -127,7 +127,7 @@ public void SubNumberComplexNumberTest() Test(sub, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void SubComplexNumberNumberTest() { var sub = new Sub(new ComplexNumber(1, 3), Number.Two); @@ -135,7 +135,7 @@ public void SubComplexNumberNumberTest() Test(sub, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void SubComplexNumberComplexNumberTest() { var sub = new Sub(new ComplexNumber(1, 3), new ComplexNumber(3, 5)); @@ -143,7 +143,7 @@ public void SubComplexNumberComplexNumberTest() Test(sub, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void SubComplexNumberBoolException() { var sub = new Sub(new ComplexNumber(1, 3), Bool.True); @@ -151,7 +151,7 @@ public void SubComplexNumberBoolException() TestBinaryException(sub); } - [Fact] + [Test] public void SubBoolComplexNumberException() { var sub = new Sub(Bool.True, new ComplexNumber(1, 3)); @@ -159,7 +159,7 @@ public void SubBoolComplexNumberException() TestBinaryException(sub); } - [Fact] + [Test] public void SubNumberAllTest() { var exp = new Sub( @@ -171,7 +171,7 @@ public void SubNumberAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void SubComplexNumberAllTest() { var exp = new Sub( @@ -183,7 +183,7 @@ public void SubComplexNumberAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void SubVectorVectorTest() { var left = new Vector(new IExpression[] { new Number(3) }); @@ -193,7 +193,7 @@ public void SubVectorVectorTest() Test(exp, ResultTypes.Vector); } - [Fact] + [Test] public void SubVectorBoolTest() { var vector = new Vector(new IExpression[] { Number.One }); @@ -202,7 +202,7 @@ public void SubVectorBoolTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubBoolVectorTest() { var vector = new Vector(new IExpression[] { Number.One }); @@ -211,7 +211,7 @@ public void SubBoolVectorTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubVectorAllTest() { var exp = new Sub( @@ -223,7 +223,7 @@ public void SubVectorAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void SubMatrixAllTest() { var matrix = new Matrix(new[] @@ -239,7 +239,7 @@ public void SubMatrixAllTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestSubBoolAndMatrixTest() { var matrix = new Matrix(new[] @@ -251,7 +251,7 @@ public void TestSubBoolAndMatrixTest() TestBinaryException(exp); } - [Fact] + [Test] public void TestSubMatrixAndBoolTest() { var matrix = new Matrix(new[] @@ -263,7 +263,7 @@ public void TestSubMatrixAndBoolTest() TestBinaryException(exp); } - [Fact] + [Test] public void SubNumberComplexTest() { var exp = new Sub(Number.Two, new Sqrt(new Number(-9))); @@ -271,7 +271,7 @@ public void SubNumberComplexTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void SubTwoVarTest() { var exp = new Sub(Variable.X, Variable.X); @@ -279,7 +279,7 @@ public void SubTwoVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void SubThreeVarTest() { var exp = new Sub(new Add(Variable.X, Variable.X), Variable.X); @@ -287,7 +287,7 @@ public void SubThreeVarTest() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestSubBoolsException() { var exp = new Sub(Bool.False, Bool.False); @@ -295,7 +295,7 @@ public void TestSubBoolsException() TestException(exp); } - [Fact] + [Test] public void TestSubNumberAngle() { var exp = new Sub( @@ -306,7 +306,7 @@ public void TestSubNumberAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestSubAngleNumber() { var exp = new Sub( @@ -317,7 +317,7 @@ public void TestSubAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestSubAngleAngle() { var exp = new Sub( @@ -328,7 +328,7 @@ public void TestSubAngleAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestSubNumberPower() { var exp = new Sub( @@ -339,7 +339,7 @@ public void TestSubNumberPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestSubPowerNumber() { var exp = new Sub( @@ -350,7 +350,7 @@ public void TestSubPowerNumber() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestSubPowerPower() { var exp = new Sub( @@ -361,7 +361,7 @@ public void TestSubPowerPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestSubNumberTemperature() { var exp = new Sub( @@ -372,7 +372,7 @@ public void TestSubNumberTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestSubTemperatureNumber() { var exp = new Sub( @@ -383,7 +383,7 @@ public void TestSubTemperatureNumber() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestSubTemperatureTemperature() { var exp = new Sub( @@ -394,7 +394,7 @@ public void TestSubTemperatureTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestSubNumberAndMass() { var exp = new Sub( @@ -405,7 +405,7 @@ public void TestSubNumberAndMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestSubMassAndNumber() { var exp = new Sub( @@ -416,7 +416,7 @@ public void TestSubMassAndNumber() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestSubMassAndMass() { var exp = new Sub( @@ -427,7 +427,7 @@ public void TestSubMassAndMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestSubNumberAndLength() { var exp = new Sub( @@ -438,7 +438,7 @@ public void TestSubNumberAndLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestSubLengthAndNumber() { var exp = new Sub( @@ -449,7 +449,7 @@ public void TestSubLengthAndNumber() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestSubLengthAndLength() { var exp = new Sub( @@ -460,7 +460,7 @@ public void TestSubLengthAndLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestSubNumberAndTime() { var exp = new Sub( @@ -471,7 +471,7 @@ public void TestSubNumberAndTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestSubTimeAndNumber() { var exp = new Sub( @@ -482,7 +482,7 @@ public void TestSubTimeAndNumber() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestSubTimeAndTime() { var exp = new Sub( @@ -493,7 +493,7 @@ public void TestSubTimeAndTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestSubNumberAndArea() { var exp = new Sub( @@ -504,7 +504,7 @@ public void TestSubNumberAndArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestSubAreaAndNumber() { var exp = new Sub( @@ -515,7 +515,7 @@ public void TestSubAreaAndNumber() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestSubAreaAndArea() { var exp = new Sub( @@ -526,7 +526,7 @@ public void TestSubAreaAndArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestSubNumberAndVolume() { var exp = new Sub( @@ -537,7 +537,7 @@ public void TestSubNumberAndVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestSubVolumeAndNumber() { var exp = new Sub( @@ -548,7 +548,7 @@ public void TestSubVolumeAndNumber() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestSubVolumeAndVolume() { var exp = new Sub( @@ -559,7 +559,7 @@ public void TestSubVolumeAndVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestSubRationalAndRational() { var exp = new Sub( @@ -570,7 +570,7 @@ public void TestSubRationalAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestSubNumberAndRational() { var exp = new Sub( @@ -581,7 +581,7 @@ public void TestSubNumberAndRational() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestSubRationalAndNumber() { var exp = new Sub( @@ -619,8 +619,8 @@ public static IEnumerable GetDataForTestSubAngleAndBoolTest() yield return new object[] { Bool.False, VolumeValue.Meter(90).AsExpression() }; } - [Theory] - [MemberData(nameof(GetDataForTestSubAngleAndBoolTest))] + [Test] + [TestCaseSource(nameof(GetDataForTestSubAngleAndBoolTest))] public void TestSubAngleAndBoolTest(IExpression left, IExpression right) { var exp = new Sub(left, right); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ToNumberTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ToNumberTests.cs index 75bf14927..c1a88044c 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/ToNumberTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/ToNumberTests.cs @@ -5,67 +5,67 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class ToNumberTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestToNumberUndefined() { Test(new ToNumber(Variable.X), ResultTypes.Number); } - [Fact] + [Test] public void TestAngleToNumber() { Test(new ToNumber(AngleValue.Degree(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestPowerToNumber() { Test(new ToNumber(PowerValue.Watt(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestTemperatureToNumber() { Test(new ToNumber(TemperatureValue.Celsius(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestMassToNumber() { Test(new ToNumber(MassValue.Gram(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestLengthToNumber() { Test(new ToNumber(LengthValue.Meter(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestTimeToNumber() { Test(new ToNumber(TimeValue.Second(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestAreaToNumber() { Test(new ToNumber(AreaValue.Meter(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestVolumeToNumber() { Test(new ToNumber(VolumeValue.Meter(10).AsExpression()), ResultTypes.Number); } - [Fact] + [Test] public void TestRationalToNumber() { Test(new ToNumber(new Rational(new Number(1), new Number(3))), ResultTypes.Number); } - [Fact] + [Test] public void TestToNumberException() { TestException(new ToNumber(Bool.True)); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/TrigonometricTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/TrigonometricTests.cs index 34a011fd3..1c70b7b72 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/TrigonometricTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/TrigonometricTests.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class TrigonometricTests : TypeAnalyzerBaseTests { - [Theory] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arctan))] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] + [Test] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arctan))] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] public void TestUndefined(Type type) { var exp = Create(type, Variable.X); @@ -25,13 +25,13 @@ public void TestUndefined(Type type) Test(exp, ResultTypes.Undefined); } - [Theory] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arctan))] + [Test] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arctan))] public void TestReserveNumber(Type type) { var exp = Create(type, Number.Two); @@ -39,13 +39,13 @@ public void TestReserveNumber(Type type) Test(exp, ResultTypes.AngleNumber); } - [Theory] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] + [Test] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] public void TestNumber(Type type) { var exp = Create(type, Number.Two); @@ -53,13 +53,13 @@ public void TestNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] + [Test] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] public void TestAngleNumber(Type type) { var exp = Create(type, AngleValue.Degree(10).AsExpression()); @@ -67,19 +67,19 @@ public void TestAngleNumber(Type type) Test(exp, ResultTypes.Number); } - [Theory] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arctan))] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] + [Test] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arctan))] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] public void TestComplexNumber(Type type) { var exp = Create(type, new ComplexNumber(2, 2)); @@ -87,19 +87,19 @@ public void TestComplexNumber(Type type) Test(exp, ResultTypes.ComplexNumber); } - [Theory] - [InlineData(typeof(Arccos))] - [InlineData(typeof(Arccot))] - [InlineData(typeof(Arccsc))] - [InlineData(typeof(Arcsec))] - [InlineData(typeof(Arcsin))] - [InlineData(typeof(Arctan))] - [InlineData(typeof(Cos))] - [InlineData(typeof(Cot))] - [InlineData(typeof(Csc))] - [InlineData(typeof(Sec))] - [InlineData(typeof(Sin))] - [InlineData(typeof(Tan))] + [Test] + [TestCase(typeof(Arccos))] + [TestCase(typeof(Arccot))] + [TestCase(typeof(Arccsc))] + [TestCase(typeof(Arcsec))] + [TestCase(typeof(Arcsin))] + [TestCase(typeof(Arctan))] + [TestCase(typeof(Cos))] + [TestCase(typeof(Cot))] + [TestCase(typeof(Csc))] + [TestCase(typeof(Sec))] + [TestCase(typeof(Sin))] + [TestCase(typeof(Tan))] public void TestParameterException(Type type) { var exp = Create(type, Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/TruncTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/TruncTests.cs index b5fb0df6f..3a36866d2 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/TruncTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/TruncTests.cs @@ -2,7 +2,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class TruncTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestTruncUndefined() { var exp = new Trunc(Variable.X); @@ -10,7 +10,7 @@ public void TestTruncUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestTruncNumber() { var exp = new Trunc(new Number(10)); @@ -18,7 +18,7 @@ public void TestTruncNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestTruncAngle() { var exp = new Trunc(AngleValue.Degree(5.5).AsExpression()); @@ -26,7 +26,7 @@ public void TestTruncAngle() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestTruncPower() { var exp = new Trunc(PowerValue.Watt(5.5).AsExpression()); @@ -34,7 +34,7 @@ public void TestTruncPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestTruncTemperature() { var exp = new Trunc(TemperatureValue.Celsius(5.5).AsExpression()); @@ -42,7 +42,7 @@ public void TestTruncTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestTruncMass() { var exp = new Trunc(MassValue.Gram(5.5).AsExpression()); @@ -50,7 +50,7 @@ public void TestTruncMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestTruncLength() { var exp = new Trunc(LengthValue.Meter(5.5).AsExpression()); @@ -58,7 +58,7 @@ public void TestTruncLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestTimeLength() { var exp = new Trunc(TimeValue.Second(5.5).AsExpression()); @@ -66,7 +66,7 @@ public void TestTimeLength() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestAreaLength() { var exp = new Trunc(AreaValue.Meter(5.5).AsExpression()); @@ -74,7 +74,7 @@ public void TestAreaLength() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestVolumeLength() { var exp = new Trunc(VolumeValue.Meter(5.5).AsExpression()); @@ -82,7 +82,7 @@ public void TestVolumeLength() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestTruncException() { var exp = new Trunc(Bool.False); diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/TypeAnalyzerBaseTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/TypeAnalyzerBaseTests.cs index 9354bed66..b2fa4471a 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/TypeAnalyzerBaseTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/TypeAnalyzerBaseTests.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Reflection; -using Xunit.Sdk; +using NUnit.Framework.Internal; namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; @@ -19,7 +19,7 @@ protected void Test(IExpression exp, ResultTypes expected) { var simple = exp.Analyze(analyzer); - Assert.Equal(expected, simple); + Assert.That(simple, Is.EqualTo(expected)); } protected void TestException(IExpression exp) @@ -53,6 +53,6 @@ protected void TestNullExp(Type type) throw; } - throw new XunitException("The exception is expected."); + throw new NUnitException("The exception is expected."); } } \ No newline at end of file diff --git a/xFunc.Tests/Analyzers/TypeAnalyzerTests/UnaryMinusTests.cs b/xFunc.Tests/Analyzers/TypeAnalyzerTests/UnaryMinusTests.cs index ca06aff51..b831eee9f 100644 --- a/xFunc.Tests/Analyzers/TypeAnalyzerTests/UnaryMinusTests.cs +++ b/xFunc.Tests/Analyzers/TypeAnalyzerTests/UnaryMinusTests.cs @@ -2,7 +2,7 @@ namespace xFunc.Tests.Analyzers.TypeAnalyzerTests; public class UnaryMinusTests : TypeAnalyzerBaseTests { - [Fact] + [Test] public void TestUnaryMinusUndefined() { var exp = new UnaryMinus(Variable.X); @@ -10,7 +10,7 @@ public void TestUnaryMinusUndefined() Test(exp, ResultTypes.Undefined); } - [Fact] + [Test] public void TestUnaryMinusNumber() { var exp = new UnaryMinus(new Number(10)); @@ -18,7 +18,7 @@ public void TestUnaryMinusNumber() Test(exp, ResultTypes.Number); } - [Fact] + [Test] public void TestUnaryMinusAngleNumber() { var exp = new UnaryMinus(AngleValue.Degree(10).AsExpression()); @@ -26,7 +26,7 @@ public void TestUnaryMinusAngleNumber() Test(exp, ResultTypes.AngleNumber); } - [Fact] + [Test] public void TestUnaryMinusPower() { var exp = new UnaryMinus(PowerValue.Watt(10).AsExpression()); @@ -34,7 +34,7 @@ public void TestUnaryMinusPower() Test(exp, ResultTypes.PowerNumber); } - [Fact] + [Test] public void TestUnaryMinusTemperature() { var exp = new UnaryMinus(TemperatureValue.Celsius(10).AsExpression()); @@ -42,7 +42,7 @@ public void TestUnaryMinusTemperature() Test(exp, ResultTypes.TemperatureNumber); } - [Fact] + [Test] public void TestUnaryMinusMass() { var exp = new UnaryMinus(MassValue.Gram(10).AsExpression()); @@ -50,7 +50,7 @@ public void TestUnaryMinusMass() Test(exp, ResultTypes.MassNumber); } - [Fact] + [Test] public void TestUnaryMinusLength() { var exp = new UnaryMinus(LengthValue.Meter(10).AsExpression()); @@ -58,7 +58,7 @@ public void TestUnaryMinusLength() Test(exp, ResultTypes.LengthNumber); } - [Fact] + [Test] public void TestUnaryMinusTime() { var exp = new UnaryMinus(TimeValue.Second(10).AsExpression()); @@ -66,7 +66,7 @@ public void TestUnaryMinusTime() Test(exp, ResultTypes.TimeNumber); } - [Fact] + [Test] public void TestUnaryMinusArea() { var exp = new UnaryMinus(AreaValue.Meter(10).AsExpression()); @@ -74,7 +74,7 @@ public void TestUnaryMinusArea() Test(exp, ResultTypes.AreaNumber); } - [Fact] + [Test] public void TestUnaryMinusVolume() { var exp = new UnaryMinus(VolumeValue.Meter(10).AsExpression()); @@ -82,7 +82,7 @@ public void TestUnaryMinusVolume() Test(exp, ResultTypes.VolumeNumber); } - [Fact] + [Test] public void TestUnaryMinusComplexNumber() { var exp = new UnaryMinus(new ComplexNumber(10, 10)); @@ -90,7 +90,7 @@ public void TestUnaryMinusComplexNumber() Test(exp, ResultTypes.ComplexNumber); } - [Fact] + [Test] public void TestUnaryMinusRationalNumber() { var exp = new UnaryMinus(new Rational(Number.One, Number.Two)); @@ -98,7 +98,7 @@ public void TestUnaryMinusRationalNumber() Test(exp, ResultTypes.RationalNumber); } - [Fact] + [Test] public void TestUnaryMinusException() { var exp = new UnaryMinus(Bool.False); diff --git a/xFunc.Tests/BuilderTest.cs b/xFunc.Tests/BuilderTest.cs index 46842c70b..ef9d39165 100644 --- a/xFunc.Tests/BuilderTest.cs +++ b/xFunc.Tests/BuilderTest.cs @@ -5,41 +5,41 @@ namespace xFunc.Tests; public class BuilderTest { - [Fact] + [Test] public void ExpCtorTest() { - var exp = new Builder((IExpression)Number.Two).Expression; + var exp = new Builder(Number.Two).Expression; - Assert.Equal(exp, Number.Two); + Assert.That(exp, Is.EqualTo(Number.Two)); } - [Fact] + [Test] public void NumberCtorTest() { var exp = new Builder(2).Expression; - Assert.Equal(exp, Number.Two); + Assert.That(exp, Is.EqualTo(Number.Two)); } - [Fact] + [Test] public void VariableCtorTest() { var exp = new Builder("x").Expression; - Assert.Equal(exp, Variable.X); + Assert.That(exp, Is.EqualTo(Variable.X)); } - [Fact] + [Test] public void ExpressionTest() { var exp = new Builder(3) .Custom(exp => new Sin(exp)) .Expression; - Assert.Equal(exp, new Sin(new Number(3))); + Assert.That(exp, Is.EqualTo(new Sin(new Number(3)))); } - [Fact] + [Test] public void ExpressionNullTest() { var builder = new Builder(3); @@ -47,7 +47,7 @@ public void ExpressionNullTest() Assert.Throws(() => builder.Custom(null)); } - [Fact] + [Test] public void ExecuteTest() { var exp = new Builder(3) @@ -56,10 +56,10 @@ public void ExecuteTest() var expected = new NumberValue(5.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(expected, Is.EqualTo(exp.Execute())); } - [Fact] + [Test] public void ExecuteWithParamsTest() { var exp = new Builder(3) @@ -68,10 +68,10 @@ public void ExecuteWithParamsTest() var expected = new NumberValue(5.0); - Assert.Equal(expected, exp.Execute(new ExpressionParameters())); + Assert.That(expected, Is.EqualTo(exp.Execute(new ExpressionParameters()))); } - [Fact] + [Test] public void NullParamTest() { Assert.Throws(() => new Builder((IExpression)null)); @@ -79,420 +79,420 @@ public void NullParamTest() #region Standart - [Fact] + [Test] public void AddExpTest() { - var builder = new Builder(3).Add((IExpression)Number.Two); + var builder = new Builder(3).Add(Number.Two); - Assert.Equal(builder.Expression, new Add(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Add(new Number(3), Number.Two))); } - [Fact] + [Test] public void AddNumberTest() { var builder = new Builder(3).Add(2); - Assert.Equal(builder.Expression, new Add(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Add(new Number(3), Number.Two))); } - [Fact] + [Test] public void AddVariableTest() { var builder = new Builder(3).Add("x"); - Assert.Equal(builder.Expression, new Add(new Number(3), Variable.X)); + Assert.That(builder.Expression, Is.EqualTo(new Add(new Number(3), Variable.X))); } - [Fact] + [Test] public void SubExpTest() { - var builder = new Builder(3).Sub((IExpression)Number.Two); + var builder = new Builder(3).Sub(Number.Two); - Assert.Equal(builder.Expression, new Sub(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Sub(new Number(3), Number.Two))); } - [Fact] + [Test] public void SubNumberTest() { var builder = new Builder(3).Sub(2); - Assert.Equal(builder.Expression, new Sub(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Sub(new Number(3), Number.Two))); } - [Fact] + [Test] public void SubVariableTest() { var builder = new Builder(3).Sub("x"); - Assert.Equal(builder.Expression, new Sub(new Number(3), Variable.X)); + Assert.That(builder.Expression, Is.EqualTo(new Sub(new Number(3), Variable.X))); } - [Fact] + [Test] public void MulExpTest() { - var builder = new Builder(3).Mul((IExpression)Number.Two); + var builder = new Builder(3).Mul(Number.Two); - Assert.Equal(builder.Expression, new Mul(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Mul(new Number(3), Number.Two))); } - [Fact] + [Test] public void MulNumberTest() { var builder = new Builder(3).Mul(2); - Assert.Equal(builder.Expression, new Mul(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Mul(new Number(3), Number.Two))); } - [Fact] + [Test] public void MulVariableTest() { var builder = new Builder(3).Mul("x"); - Assert.Equal(builder.Expression, new Mul(new Number(3), Variable.X)); + Assert.That(builder.Expression, Is.EqualTo(new Mul(new Number(3), Variable.X))); } - [Fact] + [Test] public void DivExpTest() { - var builder = new Builder(3).Div((IExpression)Number.Two); + var builder = new Builder(3).Div(Number.Two); - Assert.Equal(builder.Expression, new Div(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Div(new Number(3), Number.Two))); } - [Fact] + [Test] public void DivNumberTest() { var builder = new Builder(3).Div(2); - Assert.Equal(builder.Expression, new Div(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Div(new Number(3), Number.Two))); } - [Fact] + [Test] public void DivVariableTest() { var builder = new Builder(3).Div("x"); - Assert.Equal(builder.Expression, new Div(new Number(3), Variable.X)); + Assert.That(builder.Expression, Is.EqualTo(new Div(new Number(3), Variable.X))); } - [Fact] + [Test] public void PowExpTest() { - var builder = new Builder(3).Pow((IExpression)Number.Two); + var builder = new Builder(3).Pow(Number.Two); - Assert.Equal(builder.Expression, new Pow(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Pow(new Number(3), Number.Two))); } - [Fact] + [Test] public void PowNumberTest() { var builder = new Builder(3).Pow(2); - Assert.Equal(builder.Expression, new Pow(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Pow(new Number(3), Number.Two))); } - [Fact] + [Test] public void PowVariableTest() { var builder = new Builder(3).Pow("x"); - Assert.Equal(builder.Expression, new Pow(new Number(3), Variable.X)); + Assert.That(builder.Expression, Is.EqualTo(new Pow(new Number(3), Variable.X))); } - [Fact] + [Test] public void SqrtNumberTest() { var builder = new Builder(3).Sqrt(); - Assert.Equal(builder.Expression, new Sqrt(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Sqrt(new Number(3)))); } - [Fact] + [Test] public void RootExpTest() { - var builder = new Builder(3).Root((IExpression)Number.Two); + var builder = new Builder(3).Root(Number.Two); - Assert.Equal(builder.Expression, new Root(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Root(new Number(3), Number.Two))); } - [Fact] + [Test] public void RootNumberTest() { var builder = new Builder(3).Root(2); - Assert.Equal(builder.Expression, new Root(new Number(3), Number.Two)); + Assert.That(builder.Expression, Is.EqualTo(new Root(new Number(3), Number.Two))); } - [Fact] + [Test] public void RootVariableTest() { var builder = new Builder(3).Root("x"); - Assert.Equal(builder.Expression, new Root(new Number(3), Variable.X)); + Assert.That(builder.Expression, Is.EqualTo(new Root(new Number(3), Variable.X))); } - [Fact] + [Test] public void AbsNumberTest() { var builder = new Builder(3).Abs(); - Assert.Equal(builder.Expression, new Abs(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Abs(new Number(3)))); } - [Fact] + [Test] public void LogExpTest() { - var builder = new Builder(3).Log((IExpression)Number.Two); + var builder = new Builder(3).Log(Number.Two); - Assert.Equal(builder.Expression, new Log(Number.Two, new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Log(Number.Two, new Number(3)))); } - [Fact] + [Test] public void LogNumberTest() { var builder = new Builder(3).Log(2); - Assert.Equal(builder.Expression, new Log(Number.Two, new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Log(Number.Two, new Number(3)))); } - [Fact] + [Test] public void LogVariableTest() { var builder = new Builder(3).Log("x"); - Assert.Equal(builder.Expression, new Log(Variable.X, new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Log(Variable.X, new Number(3)))); } - [Fact] + [Test] public void LnNumberTest() { var builder = new Builder(3).Ln(); - Assert.Equal(builder.Expression, new Ln(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Ln(new Number(3)))); } - [Fact] + [Test] public void LgNumberTest() { var builder = new Builder(3).Lg(); - Assert.Equal(builder.Expression, new Lg(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Lg(new Number(3)))); } - [Fact] + [Test] public void LbNumberTest() { var builder = new Builder(3).Lb(); - Assert.Equal(builder.Expression, new Lb(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Lb(new Number(3)))); } - [Fact] + [Test] public void ExpNumberTest() { var builder = new Builder(3).Exp(); - Assert.Equal(builder.Expression, new Exp(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Exp(new Number(3)))); } #endregion Standart #region Trigonometric - [Fact] + [Test] public void SinTest() { var builder = new Builder(3).Sin(); - Assert.Equal(builder.Expression, new Sin(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Sin(new Number(3)))); } - [Fact] + [Test] public void CosTest() { var builder = new Builder(3).Cos(); - Assert.Equal(builder.Expression, new Cos(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Cos(new Number(3)))); } - [Fact] + [Test] public void TanTest() { var builder = new Builder(3).Tan(); - Assert.Equal(builder.Expression, new Tan(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Tan(new Number(3)))); } - [Fact] + [Test] public void CotTest() { var builder = new Builder(3).Cot(); - Assert.Equal(builder.Expression, new Cot(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Cot(new Number(3)))); } - [Fact] + [Test] public void SecTest() { var builder = new Builder(3).Sec(); - Assert.Equal(builder.Expression, new Sec(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Sec(new Number(3)))); } - [Fact] + [Test] public void CscTest() { var builder = new Builder(3).Csc(); - Assert.Equal(builder.Expression, new Csc(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Csc(new Number(3)))); } - [Fact] + [Test] public void ArcsinTest() { var builder = new Builder(3).Arcsin(); - Assert.Equal(builder.Expression, new Arcsin(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arcsin(new Number(3)))); } - [Fact] + [Test] public void ArccosTest() { var builder = new Builder(3).Arccos(); - Assert.Equal(builder.Expression, new Arccos(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arccos(new Number(3)))); } - [Fact] + [Test] public void ArctanTest() { var builder = new Builder(3).Arctan(); - Assert.Equal(builder.Expression, new Arctan(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arctan(new Number(3)))); } - [Fact] + [Test] public void ArccotTest() { var builder = new Builder(3).Arccot(); - Assert.Equal(builder.Expression, new Arccot(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arccot(new Number(3)))); } - [Fact] + [Test] public void ArcsecTest() { var builder = new Builder(3).Arcsec(); - Assert.Equal(builder.Expression, new Arcsec(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arcsec(new Number(3)))); } - [Fact] + [Test] public void ArccscTest() { var builder = new Builder(3).Arccsc(); - Assert.Equal(builder.Expression, new Arccsc(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arccsc(new Number(3)))); } #endregion Trigonometric #region Hyperbolic - [Fact] + [Test] public void SinhTest() { var builder = new Builder(3).Sinh(); - Assert.Equal(builder.Expression, new Sinh(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Sinh(new Number(3)))); } - [Fact] + [Test] public void CoshTest() { var builder = new Builder(3).Cosh(); - Assert.Equal(builder.Expression, new Cosh(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Cosh(new Number(3)))); } - [Fact] + [Test] public void TanhTest() { var builder = new Builder(3).Tanh(); - Assert.Equal(builder.Expression, new Tanh(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Tanh(new Number(3)))); } - [Fact] + [Test] public void CothTest() { var builder = new Builder(3).Coth(); - Assert.Equal(builder.Expression, new Coth(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Coth(new Number(3)))); } - [Fact] + [Test] public void SechTest() { var builder = new Builder(3).Sech(); - Assert.Equal(builder.Expression, new Sech(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Sech(new Number(3)))); } - [Fact] + [Test] public void CschTest() { var builder = new Builder(3).Csch(); - Assert.Equal(builder.Expression, new Csch(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Csch(new Number(3)))); } - [Fact] + [Test] public void ArsinhTest() { var builder = new Builder(3).Arsinh(); - Assert.Equal(builder.Expression, new Arsinh(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arsinh(new Number(3)))); } - [Fact] + [Test] public void ArcoshTest() { var builder = new Builder(3).Arcosh(); - Assert.Equal(builder.Expression, new Arcosh(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arcosh(new Number(3)))); } - [Fact] + [Test] public void ArtanhTest() { var builder = new Builder(3).Artanh(); - Assert.Equal(builder.Expression, new Artanh(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Artanh(new Number(3)))); } - [Fact] + [Test] public void ArcothTest() { var builder = new Builder(3).Arcoth(); - Assert.Equal(builder.Expression, new Arcoth(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arcoth(new Number(3)))); } - [Fact] + [Test] public void ArsechTest() { var builder = new Builder(3).Arsech(); - Assert.Equal(builder.Expression, new Arsech(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arsech(new Number(3)))); } - [Fact] + [Test] public void ArcschTest() { var builder = new Builder(3).Arcsch(); - Assert.Equal(builder.Expression, new Arcsch(new Number(3))); + Assert.That(builder.Expression, Is.EqualTo(new Arcsch(new Number(3)))); } #endregion Hyperbolic diff --git a/xFunc.Tests/Expressions/AbsTest.cs b/xFunc.Tests/Expressions/AbsTest.cs index dd6b67ee5..8b29a6771 100644 --- a/xFunc.Tests/Expressions/AbsTest.cs +++ b/xFunc.Tests/Expressions/AbsTest.cs @@ -8,97 +8,97 @@ namespace xFunc.Tests.Expressions; public class AbsTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTestNumber() { var exp = new Abs(new Number(-1)); var expected = new NumberValue(1.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestAngleNumber() { var exp = new Abs(AngleValue.Degree(-10).AsExpression()); var expected = AngleValue.Degree(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestPowerValue() { var exp = new Abs(PowerValue.Watt(-1).AsExpression()); var expected = PowerValue.Watt(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestTemperatureValue() { var exp = new Abs(TemperatureValue.Celsius(-1).AsExpression()); var expected = TemperatureValue.Celsius(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestMassValue() { var exp = new Abs(MassValue.Gram(-1).AsExpression()); var expected = MassValue.Gram(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestLengthValue() { var exp = new Abs(LengthValue.Meter(-1).AsExpression()); var expected = LengthValue.Meter(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestTimeValue() { var exp = new Abs(TimeValue.Second(-1).AsExpression()); var expected = TimeValue.Second(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestAreaValue() { var exp = new Abs(AreaValue.Meter(-1).AsExpression()); var expected = AreaValue.Meter(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestVolumeValue() { var exp = new Abs(VolumeValue.Meter(-1).AsExpression()); var expected = VolumeValue.Meter(1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestComplexNumber() { var exp = new Abs(new ComplexNumber(4, 2)); var expected = Complex.Abs(new Complex(4, 2)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestVector() { var exp = new Abs(new Vector(new IExpression[] @@ -107,23 +107,23 @@ public void ExecuteTestVector() })); var expected = new NumberValue(11.2249721603218241567); - Assert.Equal(expected, (NumberValue)exp.Execute()); + Assert.That((NumberValue)exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestRational() { var exp = new Abs(new Rational(new Number(-1), new Number(3))); var expected = new RationalValue(1, 3); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Abs(Bool.False)); - [Fact] + [Test] public void EqualsTest1() { Variable x1 = "x"; @@ -140,7 +140,7 @@ public void EqualsTest1() Assert.True(abs1.Equals(abs1)); } - [Fact] + [Test] public void EqualsTest2() { Variable x1 = "x"; @@ -158,12 +158,12 @@ public void EqualsTest2() Assert.False(abs1.Equals(null)); } - [Fact] + [Test] public void CloneTest() { var exp = new Abs(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/AddTest.cs b/xFunc.Tests/Expressions/AddTest.cs index cabde1903..11b21d8e8 100644 --- a/xFunc.Tests/Expressions/AddTest.cs +++ b/xFunc.Tests/Expressions/AddTest.cs @@ -9,61 +9,61 @@ namespace xFunc.Tests.Expressions; public class AddTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTestNumber1() { var exp = new Add(Number.One, Number.Two); var expected = new NumberValue(3.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestNumber2() { var exp = new Add(new Number(-3), Number.Two); var expected = new NumberValue(-1.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestComplexNumber() { var exp = new Add(new ComplexNumber(7, 3), new ComplexNumber(2, 4)); var expected = new Complex(9, 7); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestNumberComplexNumber() { var exp = new Add(new Number(7), new ComplexNumber(2, 4)); var expected = new Complex(9, 4); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestComplexNumberNumber() { var exp = new Add(new ComplexNumber(7, 3), Number.Two); var expected = new Complex(9, 3); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest6() { var exp = new Add(Number.Two, new Sqrt(new Number(-9))); var expected = new Complex(2, 3); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void AddTwoVectorsTest() { var vector1 = new Vector(new IExpression[] { Number.Two, new Number(3) }); @@ -73,10 +73,10 @@ public void AddTwoVectorsTest() var expected = VectorValue.Create(new NumberValue(9), new NumberValue(4)); var result = add.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddTwoMatricesTest() { var matrix1 = new Matrix(new[] @@ -98,10 +98,10 @@ public void AddTwoMatricesTest() }); var result = add.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void Add4MatricesTest() { var vector1 = new Vector(new IExpression[] { Number.One, Number.Two }); @@ -114,30 +114,30 @@ public void Add4MatricesTest() var expected = VectorValue.Create(new NumberValue(4), new NumberValue(8)); - Assert.Equal(expected, add3.Execute()); + Assert.That(add3.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void AddNumberAndDegree() { var exp = new Add(Number.One, AngleValue.Degree(10).AsExpression()); var actual = exp.Execute(); var expected = AngleValue.Degree(11); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddRadianAndNumber() { var exp = new Add(AngleValue.Radian(10).AsExpression(), Number.One); var actual = exp.Execute(); var expected = AngleValue.Radian(11); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddDegreeAndRadian() { var exp = new Add( @@ -147,10 +147,10 @@ public void AddDegreeAndRadian() var actual = exp.Execute(); var expected = AngleValue.Degree(190); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddGradianAndGradian() { var exp = new Add( @@ -160,10 +160,10 @@ public void AddGradianAndGradian() var actual = exp.Execute(); var expected = AngleValue.Gradian(30); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndPower() { var exp = new Add( @@ -173,10 +173,10 @@ public void ExecuteNumberAndPower() var actual = exp.Execute(); var expected = PowerValue.Watt(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerAndNumber() { var exp = new Add( @@ -186,10 +186,10 @@ public void ExecutePowerAndNumber() var actual = exp.Execute(); var expected = PowerValue.Watt(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerAndPower() { var exp = new Add( @@ -199,10 +199,10 @@ public void ExecutePowerAndPower() var actual = exp.Execute(); var expected = PowerValue.Watt(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndTemperature() { var exp = new Add( @@ -212,10 +212,10 @@ public void ExecuteNumberAndTemperature() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureAndNumber() { var exp = new Add( @@ -225,10 +225,10 @@ public void ExecuteTemperatureAndNumber() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureAndTemperature() { var exp = new Add( @@ -238,10 +238,10 @@ public void ExecuteTemperatureAndTemperature() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndMass() { var exp = new Add( @@ -251,10 +251,10 @@ public void ExecuteNumberAndMass() var actual = exp.Execute(); var expected = MassValue.Gram(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassAndNumber() { var exp = new Add( @@ -264,10 +264,10 @@ public void ExecuteMassAndNumber() var actual = exp.Execute(); var expected = MassValue.Gram(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassAndMass() { var exp = new Add( @@ -277,10 +277,10 @@ public void ExecuteMassAndMass() var actual = exp.Execute(); var expected = MassValue.Gram(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndLength() { var exp = new Add( @@ -290,10 +290,10 @@ public void ExecuteNumberAndLength() var actual = exp.Execute(); var expected = LengthValue.Meter(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthAndNumber() { var exp = new Add( @@ -303,10 +303,10 @@ public void ExecuteLengthAndNumber() var actual = exp.Execute(); var expected = LengthValue.Meter(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthAndLength() { var exp = new Add( @@ -316,10 +316,10 @@ public void ExecuteLengthAndLength() var actual = exp.Execute(); var expected = LengthValue.Meter(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndTime() { var exp = new Add( @@ -329,10 +329,10 @@ public void ExecuteNumberAndTime() var actual = exp.Execute(); var expected = TimeValue.Second(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeAndNumber() { var exp = new Add( @@ -342,10 +342,10 @@ public void ExecuteTimeAndNumber() var actual = exp.Execute(); var expected = TimeValue.Second(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeAndTime() { var exp = new Add( @@ -355,10 +355,10 @@ public void ExecuteTimeAndTime() var actual = exp.Execute(); var expected = TimeValue.Second(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndArea() { var exp = new Add( @@ -368,10 +368,10 @@ public void ExecuteNumberAndArea() var actual = exp.Execute(); var expected = AreaValue.Meter(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAreaAndNumber() { var exp = new Add( @@ -381,10 +381,10 @@ public void ExecuteAreaAndNumber() var actual = exp.Execute(); var expected = AreaValue.Meter(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeAndArea() { var exp = new Add( @@ -394,10 +394,10 @@ public void ExecuteTimeAndArea() var actual = exp.Execute(); var expected = AreaValue.Meter(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndVolume() { var exp = new Add( @@ -407,10 +407,10 @@ public void ExecuteNumberAndVolume() var actual = exp.Execute(); var expected = VolumeValue.Meter(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVolumeAndNumber() { var exp = new Add( @@ -420,10 +420,10 @@ public void ExecuteVolumeAndNumber() var actual = exp.Execute(); var expected = VolumeValue.Meter(2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeAndVolume() { var exp = new Add( @@ -433,10 +433,10 @@ public void ExecuteTimeAndVolume() var actual = exp.Execute(); var expected = VolumeValue.Meter(3); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteStringAndString() { var exp = new Add( @@ -446,10 +446,10 @@ public void ExecuteStringAndString() var actual = exp.Execute(); var expected = "ab"; - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteStringAndNumber() { var exp = new Add( @@ -459,10 +459,10 @@ public void ExecuteStringAndNumber() var actual = exp.Execute(); var expected = "a1"; - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndString() { var exp = new Add( @@ -472,10 +472,10 @@ public void ExecuteNumberAndString() var actual = exp.Execute(); var expected = "1b"; - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndRational() { var exp = new Add( @@ -485,10 +485,10 @@ public void ExecuteRationalAndRational() var expected = new RationalValue(5, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndRational() { var exp = new Add( @@ -498,10 +498,10 @@ public void ExecuteNumberAndRational() var expected = new RationalValue(3, 1); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndNumber() { var exp = new Add( @@ -511,22 +511,22 @@ public void ExecuteRationalAndNumber() var expected = new RationalValue(3, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Add(Bool.False, Bool.False)); - [Fact] + [Test] public void ExecuteComplexNumberAndBool() => TestNotSupported(new Add(new ComplexNumber(7, 3), Bool.False)); - [Fact] + [Test] public void ExecuteBoolAndComplexNumber() => TestNotSupported(new Add(Bool.False, new ComplexNumber(7, 3))); - [Fact] + [Test] public void AnalyzeNull() { var exp = new Add(Number.One, Number.One); @@ -534,7 +534,7 @@ public void AnalyzeNull() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void AnalyzeContextNull() { var exp = new Add(Number.One, Number.One); @@ -542,12 +542,12 @@ public void AnalyzeContextNull() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new Add(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/AssignTest.cs b/xFunc.Tests/Expressions/AssignTest.cs index 9e1441db4..0421d89a8 100644 --- a/xFunc.Tests/Expressions/AssignTest.cs +++ b/xFunc.Tests/Expressions/AssignTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions; public class AssignTest { - [Fact] + [Test] public void SimpleDefineTest() { var exp = new Assign(Variable.X, Number.One); @@ -14,11 +14,11 @@ public void SimpleDefineTest() var answer = exp.Execute(parameters); var expected = new NumberValue(1.0); - Assert.Equal(expected, parameters["x"]); - Assert.Equal(expected, answer); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); + Assert.That(answer, Is.EqualTo(expected)); } - [Fact] + [Test] public void DefineWithFuncTest() { var exp = new Assign(Variable.X, new Sin(AngleValue.Radian(1).AsExpression())); @@ -27,11 +27,11 @@ public void DefineWithFuncTest() var answer = exp.Execute(parameters); var expected = new NumberValue(Math.Sin(1)); - Assert.Equal(expected, parameters[Variable.X.Name]); - Assert.Equal(expected, answer); + Assert.That(parameters[Variable.X.Name].Value, Is.EqualTo(expected)); + Assert.That(answer, Is.EqualTo(expected)); } - [Fact] + [Test] public void DefineExpTest() { var exp = new Assign(Variable.X, new Mul(new Number(4), new Add(new Number(8), Number.One))); @@ -40,11 +40,11 @@ public void DefineExpTest() var answer = exp.Execute(parameters); var expected = new NumberValue(36.0); - Assert.Equal(expected, parameters["x"]); - Assert.Equal(expected, answer); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); + Assert.That(answer, Is.EqualTo(expected)); } - [Fact] + [Test] public void OverrideConstTest() { var exp = new Assign(new Variable("π"), Number.One); @@ -52,10 +52,10 @@ public void OverrideConstTest() exp.Execute(parameters); - Assert.Equal(new NumberValue(1.0), parameters["π"]); + Assert.That(parameters["π"].Value, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void DefineFuncTest() { var function = Number.One.ToLambdaExpression(); @@ -65,10 +65,10 @@ public void DefineFuncTest() var parameters = new ExpressionParameters(); var result = exp.Execute(parameters); - Assert.Equal("() => 1", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("() => 1")); } - [Fact] + [Test] public void DefineFuncWithParamsTest() { var function = new Add(Variable.X, Variable.Y) @@ -79,69 +79,69 @@ public void DefineFuncWithParamsTest() var parameters = new ExpressionParameters(); var result = exp.Execute(parameters); - Assert.Equal("(x, y) => x + y", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("(x, y) => x + y")); } - [Fact] + [Test] public void ParamsNullTest() { Assert.Throws(() => new Assign(new Variable("π"), Number.One).Execute(null)); } - [Fact] + [Test] public void ExecuteWithoutParametersTest() { Assert.Throws(() => new Assign(new Variable("π"), Number.One).Execute()); } - [Fact] + [Test] public void KeyIsNullTest() { Assert.Throws(() => new Assign(null, Number.One)); } - [Fact] + [Test] public void ValueIsNullTest() { Assert.Throws(() => new Assign(Variable.X, null)); } - [Fact] + [Test] public void EqualsSameReferenceTest() { var def = new Assign(Variable.X, Number.One); - Assert.True(def.Equals(def)); + Assert.That(def.Equals(def), Is.True); } - [Fact] + [Test] public void EqualsDifferentTypesTest() { var def = new Assign(Variable.X, Number.One); var number = Number.One; - Assert.False(def.Equals(number)); + Assert.That(def.Equals(number), Is.False); } - [Fact] + [Test] public void EqualsDifferentOnjectsTest() { var def1 = new Assign(Variable.X, Number.One); var def2 = new Assign(Variable.Y, Number.Two); - Assert.False(def1.Equals(def2)); + Assert.That(def1.Equals(def2), Is.False); } - [Fact] + [Test] public void CloneTest() { var exp = new Assign(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new Assign(Variable.X, Number.Zero); @@ -149,7 +149,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new Assign(Variable.X, Number.Zero); diff --git a/xFunc.Tests/Expressions/BaseExpressionTests.cs b/xFunc.Tests/Expressions/BaseExpressionTests.cs index 931709df1..b54b0c5b0 100644 --- a/xFunc.Tests/Expressions/BaseExpressionTests.cs +++ b/xFunc.Tests/Expressions/BaseExpressionTests.cs @@ -6,5 +6,5 @@ namespace xFunc.Tests.Expressions; public abstract class BaseExpressionTests : BaseTest { protected void TestNotSupported(IExpression exp) - => Assert.Throws(exp.Execute); + => Assert.Throws(() => exp.Execute()); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/BinaryTest.cs b/xFunc.Tests/Expressions/BinaryTest.cs index 5dcd03d9e..7cac01684 100644 --- a/xFunc.Tests/Expressions/BinaryTest.cs +++ b/xFunc.Tests/Expressions/BinaryTest.cs @@ -5,47 +5,47 @@ namespace xFunc.Tests.Expressions; public class BinaryTest { - [Fact] + [Test] public void EqualsTest1() { var add1 = new Add(Number.Two, new Number(3)); var add2 = new Add(Number.Two, new Number(3)); - Assert.Equal(add1, add2); + Assert.That(add2, Is.EqualTo(add1)); } - [Fact] + [Test] public void EqualsTest2() { - var add = new Add(Number.Two, new Number(3)); - var sub = new Sub(Number.Two, new Number(3)); + var add = new Add(Number.Two, new Number(3)) as IExpression; + var sub = new Sub(Number.Two, new Number(3)) as IExpression; - Assert.NotEqual(add, sub); + Assert.That(sub, Is.Not.EqualTo(add)); } - [Fact] + [Test] public void EqualsSameTest() { var exp = new Add(Number.One, Number.One); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualsNullTest() { var exp = new Add(Number.One, Number.One); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void LeftNullExceptionTest() { Assert.Throws(() => new Add(null, Number.One)); } - [Fact] + [Test] public void RightNullExceptionTest() { Assert.Throws(() => new Add(Number.One, null)); diff --git a/xFunc.Tests/Expressions/CallExpressionTest.cs b/xFunc.Tests/Expressions/CallExpressionTest.cs index 3dd0c8a03..9a9ee9664 100644 --- a/xFunc.Tests/Expressions/CallExpressionTest.cs +++ b/xFunc.Tests/Expressions/CallExpressionTest.cs @@ -4,25 +4,25 @@ namespace xFunc.Tests.Expressions; public class CallExpressionTest { - [Fact] + [Test] public void EqualsNullTest() { var lambda = new Lambda(Array.Empty(), Number.One).AsExpression(); var exp = new CallExpression(lambda, ImmutableArray.Empty); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsSameTest() { var lambda = new Lambda(Array.Empty(), Number.One).AsExpression(); var exp = new CallExpression(lambda, ImmutableArray.Empty); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualsTest() { var exp1 = new CallExpression( @@ -32,10 +32,10 @@ public void EqualsTest() new Lambda(Array.Empty(), Number.One).AsExpression(), ImmutableArray.Empty); - Assert.True(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.True); } - [Fact] + [Test] public void NotEqualsParametersTest() { var exp1 = new CallExpression( @@ -45,10 +45,10 @@ public void NotEqualsParametersTest() new Lambda(Array.Empty(), Number.One).AsExpression(), new IExpression[] { Number.One }.ToImmutableArray()); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void NotEqualsLambdaTest() { var exp1 = new CallExpression( @@ -58,10 +58,10 @@ public void NotEqualsLambdaTest() new Lambda(Array.Empty(), Number.Two).AsExpression(), ImmutableArray.Empty); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void NotEqualsTest() { var exp1 = new CallExpression( @@ -71,30 +71,30 @@ public void NotEqualsTest() new Lambda(Array.Empty(), Number.One).AsExpression(), new IExpression[] { Number.One }.ToImmutableArray()); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void EqualsObjectNullTest() { var exp = new CallExpression( new Lambda(Array.Empty(), Number.One).AsExpression(), ImmutableArray.Empty); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualsObjectSameTest() { var exp = new CallExpression( new Lambda(Array.Empty(), Number.One).AsExpression(), ImmutableArray.Empty); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualsObjectTest() { var exp1 = new CallExpression( @@ -104,10 +104,10 @@ public void EqualsObjectTest() new Lambda(Array.Empty(), Number.One).AsExpression(), ImmutableArray.Empty); - Assert.True(exp1.Equals((object)exp2)); + Assert.That(exp1.Equals((object)exp2), Is.True); } - [Fact] + [Test] public void NotEqualsDifferentTypesTest() { var exp1 = new CallExpression( @@ -115,10 +115,10 @@ public void NotEqualsDifferentTypesTest() ImmutableArray.Empty); var exp2 = Variable.X; - Assert.False(exp1.Equals((object)exp2)); + Assert.That(exp1.Equals((object)exp2), Is.False); } - [Fact] + [Test] public void NotEqualsObjectTest() { var exp1 = new CallExpression( @@ -128,10 +128,10 @@ public void NotEqualsObjectTest() new Lambda(Array.Empty(), Number.One).AsExpression(), new IExpression[] { Number.One }.ToImmutableArray()); - Assert.False(exp1.Equals((object)exp2)); + Assert.That(exp1.Equals((object)exp2), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = new CallExpression( @@ -141,7 +141,7 @@ public void ExecuteTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteWithNullParametersTest() { var exp = new CallExpression( @@ -151,7 +151,7 @@ public void ExecuteWithNullParametersTest() Assert.Throws(() => exp.Execute(null)); } - [Fact] + [Test] public void ExecuteWithNotFunctionTest() { var exp = new CallExpression( @@ -161,7 +161,7 @@ public void ExecuteWithNotFunctionTest() Assert.Throws(() => exp.Execute(new ExpressionParameters())); } - [Fact] + [Test] public void ExecuteWithoutParametersTest() { var exp = new CallExpression( @@ -171,10 +171,10 @@ public void ExecuteWithoutParametersTest() var result = exp.Execute(new ExpressionParameters()); var expected = Number.One.Value; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteWithParametersTest() { var exp = new CallExpression( @@ -184,10 +184,10 @@ public void ExecuteWithParametersTest() var result = exp.Execute(new ExpressionParameters()); var expected = Number.One.Value; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new CallExpression( @@ -197,7 +197,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new CallExpression( @@ -207,7 +207,7 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new CallExpression( @@ -215,6 +215,6 @@ public void CloneTest() ImmutableArray.Empty); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/CeilTest.cs b/xFunc.Tests/Expressions/CeilTest.cs index 3f57fa698..00bca0e6e 100644 --- a/xFunc.Tests/Expressions/CeilTest.cs +++ b/xFunc.Tests/Expressions/CeilTest.cs @@ -5,106 +5,106 @@ namespace xFunc.Tests.Expressions; public class CeilTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTestNumber() { var ceil = new Ceil(new Number(5.55555555)); var result = (NumberValue)ceil.Execute(); var expected = new NumberValue(6.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestAngleNumber() { var ceil = new Ceil(AngleValue.Degree(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = AngleValue.Degree(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestPowerNumber() { var ceil = new Ceil(PowerValue.Watt(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = PowerValue.Watt(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestTemperatureNumber() { var ceil = new Ceil(TemperatureValue.Celsius(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = TemperatureValue.Celsius(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestMassNumber() { var ceil = new Ceil(MassValue.Gram(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = MassValue.Gram(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestLengthNumber() { var ceil = new Ceil(LengthValue.Meter(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = LengthValue.Meter(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestTimeNumber() { var ceil = new Ceil(TimeValue.Second(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = TimeValue.Second(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestAreaNumber() { var ceil = new Ceil(AreaValue.Meter(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = AreaValue.Meter(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestVolumeNumber() { var ceil = new Ceil(VolumeValue.Meter(5.55555555).AsExpression()); var result = ceil.Execute(); var expected = VolumeValue.Meter(6); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Ceil(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Ceil(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/ComplexNumberTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/ComplexNumberTest.cs index a4e4fe91a..b9d0540e1 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/ComplexNumberTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/ComplexNumberTest.cs @@ -7,54 +7,54 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class ComplexNumberTest { - [Fact] + [Test] public void ExecuteTest() { var complex = new Complex(5, 2); var exp = new ComplexNumber(complex); - Assert.Equal(complex, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(complex)); } - [Fact] + [Test] public void ExecuteWithParamsTest() { var complex = new Complex(5, 2); var exp = new ComplexNumber(complex); - Assert.Equal(complex, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(complex)); } - [Fact] + [Test] public void ValueTest() { var complex = new Complex(5, 2); var exp = new ComplexNumber(complex); - Assert.Equal(complex, exp.Value); + Assert.That(exp.Value, Is.EqualTo(complex)); } - [Fact] + [Test] public void CastToComplexTest() { var complex = new Complex(5, 2); var exp = new ComplexNumber(complex); var result = (Complex)exp; - Assert.Equal(complex, result); + Assert.That(result, Is.EqualTo(complex)); } - [Fact] + [Test] public void CastToComplexNumberTest() { var complex = new Complex(5, 2); var exp = (ComplexNumber)complex; var result = new ComplexNumber(complex); - Assert.Equal(exp, result); + Assert.That(result, Is.EqualTo(exp)); } - [Fact] + [Test] public void EqualsTest() { var exp1 = new ComplexNumber(new Complex(5, 2)); @@ -63,7 +63,7 @@ public void EqualsTest() Assert.True(exp1.Equals(exp2)); } - [Fact] + [Test] public void NotEqualsTest() { var exp1 = new ComplexNumber(new Complex(5, 2)); @@ -72,16 +72,16 @@ public void NotEqualsTest() Assert.False(exp1.Equals(exp2)); } - [Fact] + [Test] public void NotEqualsDiffTypesTest() { var exp1 = new ComplexNumber(new Complex(5, 2)); var exp2 = Number.Two; - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void ComplexNumberAsVariableTest() { var exp = new Add( @@ -96,10 +96,10 @@ public void ComplexNumberAsVariableTest() var actual = exp.Execute(parameters); var expected = new Complex(3, 2); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ComplexExponentialFormTest1() { const int r = 2; @@ -117,10 +117,10 @@ public void ComplexExponentialFormTest1() var actual = exp.Execute(); var expected = Complex.FromPolarCoordinates(r, phi); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ComplexExponentialFormTest2() { const int r = 2; @@ -139,10 +139,10 @@ public void ComplexExponentialFormTest2() var actual = exp.Execute(); var expected = Complex.FromPolarCoordinates(r, phi); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ComplexNumberAnalyzeNull1() { var exp = new ComplexNumber(3, 2); @@ -150,7 +150,7 @@ public void ComplexNumberAnalyzeNull1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void ComplexNumberAnalyzeNull2() { var exp = new ComplexNumber(3, 2); @@ -158,10 +158,13 @@ public void ComplexNumberAnalyzeNull2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void ConvertToComplexTest() { ComplexNumber exp = null; - Assert.Throws(() => (Complex)exp); + Assert.Throws(() => + { + var temp = (Complex)exp; + }); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/ConjugateTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/ConjugateTest.cs index 0adefd252..1560fcb73 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/ConjugateTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/ConjugateTest.cs @@ -7,25 +7,25 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class ConjugateTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3.1, 2.5); var exp = new Conjugate(new ComplexNumber(complex)); - Assert.Equal(Complex.Conjugate(complex), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Conjugate(complex))); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Conjugate(Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new Conjugate(new ComplexNumber(new Complex(2, 2))); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/ImTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/ImTest.cs index 8af10a69d..578fb6b28 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/ImTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/ImTest.cs @@ -7,26 +7,26 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class ImTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3.1, 2.5); var exp = new Im(new ComplexNumber(complex)); var expected = new NumberValue(complex.Imaginary); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Im(Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new Im(new ComplexNumber(new Complex(2, 2))); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/PhaseTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/PhaseTest.cs index 27993d7c1..99231f286 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/PhaseTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/PhaseTest.cs @@ -7,26 +7,26 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class PhaseTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var complex = new Complex(3.1, 2.5); var exp = new Phase(new ComplexNumber(complex)); var expected = AngleValue.Radian(complex.Phase); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Phase(Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new Phase(new ComplexNumber(new Complex(2, 2))); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/ReTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/ReTest.cs index cfa957ecc..1f08c1614 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/ReTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/ReTest.cs @@ -7,26 +7,26 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class ReTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3.1, 2.5); var exp = new Re(new ComplexNumber(complex)); var expected = new NumberValue(complex.Real); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Re(Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new Re(new ComplexNumber(new Complex(2, 2))); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/ReciprocalTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/ReciprocalTest.cs index 94f5f159b..1f58e96bb 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/ReciprocalTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/ReciprocalTest.cs @@ -7,25 +7,25 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class ReciprocalTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3.1, 2.5); var exp = new Reciprocal(new ComplexNumber(complex)); - Assert.Equal(Complex.Reciprocal(complex), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Reciprocal(complex))); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Reciprocal(Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new Reciprocal(new ComplexNumber(new Complex(2, 2))); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ComplexNumbers/ToComplexTest.cs b/xFunc.Tests/Expressions/ComplexNumbers/ToComplexTest.cs index fcf1c96a9..5ba5caa9c 100644 --- a/xFunc.Tests/Expressions/ComplexNumbers/ToComplexTest.cs +++ b/xFunc.Tests/Expressions/ComplexNumbers/ToComplexTest.cs @@ -7,26 +7,26 @@ namespace xFunc.Tests.Expressions.ComplexNumbers; public class ToComplexTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new ToComplex(Number.Two); var result = (Complex)exp.Execute(); var expected = new Complex(2, 0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new ToComplex(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new ToComplex(Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/DelTest.cs b/xFunc.Tests/Expressions/DelTest.cs index ea3424c1c..545c1f41d 100644 --- a/xFunc.Tests/Expressions/DelTest.cs +++ b/xFunc.Tests/Expressions/DelTest.cs @@ -7,11 +7,11 @@ namespace xFunc.Tests.Expressions; public class DelTest { - [Fact] + [Test] public void DifferentiatorNull() => Assert.Throws(() => new Del(null, null, null)); - [Fact] + [Test] public void SimplifierNull() { var differentiator = Substitute.For(); @@ -19,7 +19,7 @@ public void SimplifierNull() Assert.Throws(() => new Del(differentiator, null, null)); } - [Fact] + [Test] public void ExecuteTest1() { var exp = new Add( @@ -38,10 +38,10 @@ public void ExecuteTest1() new Mul(new Number(3), new Pow(new Variable("z"), Number.Two)) }).ToLambda(); - Assert.Equal(expected, del.Execute()); + Assert.That(del.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = new Add( @@ -57,10 +57,10 @@ public void ExecuteTest2() new Number(-1), }).ToLambda(); - Assert.Equal(expected, del.Execute()); + Assert.That(del.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNonLambdaTest() { var differentiator = Substitute.For(); @@ -73,19 +73,15 @@ public void ExecuteNonLambdaTest() Assert.Throws(() => del.Execute()); } - [Fact] + [Test] public void NullDiffTest() - { - Assert.Throws(() => new Del(null, null, Variable.X)); - } + => Assert.Throws(() => new Del(null, null, Variable.X)); - [Fact] + [Test] public void NullSimplifierTest() - { - Assert.Throws(() => new Del(new Differentiator(), null, Variable.X)); - } + => Assert.Throws(() => new Del(new Differentiator(), null, Variable.X)); - [Fact] + [Test] public void CloneTest() { var exp = new Add( @@ -95,6 +91,6 @@ public void CloneTest() var del = new Del(new Differentiator(), new Simplifier(), exp); var clone = del.Clone(); - Assert.Equal(del, clone); + Assert.That(clone, Is.EqualTo(del)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/DelegateExpressionTest.cs b/xFunc.Tests/Expressions/DelegateExpressionTest.cs index 3cb26c3a2..f8270a7a1 100644 --- a/xFunc.Tests/Expressions/DelegateExpressionTest.cs +++ b/xFunc.Tests/Expressions/DelegateExpressionTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions; public class DelegateExpressionTest { - [Fact] + [Test] public void ExecuteTest1() { var parameters = new ExpressionParameters() @@ -16,73 +16,73 @@ public void ExecuteTest1() var result = func.Execute(parameters); - Assert.Equal(new NumberValue(11.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(11.0))); } - [Fact] + [Test] public void ExecuteTest2() { var func = new DelegateExpression(_ => 10.0); var result = func.Execute(null); - Assert.Equal(10.0, result); + Assert.That(result, Is.EqualTo(10.0)); } - [Fact] + [Test] public void ExecuteTest4() { var func = new DelegateExpression(_ => 1.0); var result = func.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void EqualRefTest() { var exp = new DelegateExpression(_ => 1.0); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualRefNullTest() { var exp = new DelegateExpression(_ => 1.0); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp1 = new DelegateExpression(_ => 1.0); var exp2 = Number.Two; - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void EqualSameTest() { Func d = _ => 1.0; var exp1 = new DelegateExpression(d); var exp2 = new DelegateExpression(d); - Assert.True(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.True); } - [Fact] + [Test] public void EqualDiffTest() { var exp1 = new DelegateExpression(_ => 1.0); var exp2 = new DelegateExpression(_ => 2.0); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new DelegateExpression(_ => 1.0); @@ -90,7 +90,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new DelegateExpression(_ => 1.0); diff --git a/xFunc.Tests/Expressions/DerivativeTest.cs b/xFunc.Tests/Expressions/DerivativeTest.cs index 698bbca48..073982f45 100644 --- a/xFunc.Tests/Expressions/DerivativeTest.cs +++ b/xFunc.Tests/Expressions/DerivativeTest.cs @@ -7,11 +7,11 @@ namespace xFunc.Tests.Expressions; public class DerivativeTest { - [Fact] + [Test] public void DifferentiatorNull() => Assert.Throws(() => new Derivative(null, null, Variable.X)); - [Fact] + [Test] public void SimplifierNull() { var differentiator = Substitute.For(); @@ -19,7 +19,7 @@ public void SimplifierNull() Assert.Throws(() => new Derivative(differentiator, null, Variable.X)); } - [Fact] + [Test] public void ExecutePointTest() { var differentiator = Substitute.For(); @@ -36,10 +36,10 @@ public void ExecutePointTest() Variable.X, Number.Two); - Assert.Equal(new NumberValue(2.0), deriv.Execute()); + Assert.That(deriv.Execute(), Is.EqualTo(new NumberValue(2.0))); } - [Fact] + [Test] public void ExecuteNonLambdaTest() { var differentiator = Substitute.For(); @@ -52,16 +52,16 @@ public void ExecuteNonLambdaTest() Assert.Throws(() => derivative.Execute()); } - [Fact] + [Test] public void ExecuteNullDerivTest() => Assert.Throws(() => new Derivative(null, null, Variable.X)); - [Fact] + [Test] public void CloneTest() { var exp = new Derivative(new Differentiator(), new Simplifier(), new Sin(Variable.X), Variable.X, Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/DivTest.cs b/xFunc.Tests/Expressions/DivTest.cs index a54234e9a..296f7dd3c 100644 --- a/xFunc.Tests/Expressions/DivTest.cs +++ b/xFunc.Tests/Expressions/DivTest.cs @@ -7,62 +7,62 @@ namespace xFunc.Tests.Expressions; public class DivTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Div(Number.One, Number.Two); var expected = new NumberValue(1.0 / 2.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = new Div(new ComplexNumber(3, 2), new ComplexNumber(2, 4)); var expected = new Complex(0.7, -0.4); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new Div(new Number(3), new ComplexNumber(2, 4)); var expected = new Complex(0.3, -0.6); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest4() { var exp = new Div(new ComplexNumber(3, 2), Number.Two); var expected = new Complex(1.5, 1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest6() { var exp = new Div(new Sqrt(new Number(-16)), Number.Two); var expected = new Complex(0, 2); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void DivRadianAndNumber() { var exp = new Div(AngleValue.Radian(10).AsExpression(), Number.Two); var actual = exp.Execute(); var expected = AngleValue.Radian(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivPowerAndNumber() { var exp = new Div( @@ -72,10 +72,10 @@ public void DivPowerAndNumber() var actual = exp.Execute(); var expected = PowerValue.Watt(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivTemperatureAndNumber() { var exp = new Div( @@ -85,10 +85,10 @@ public void DivTemperatureAndNumber() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivMassAndNumber() { var exp = new Div( @@ -98,10 +98,10 @@ public void DivMassAndNumber() var actual = exp.Execute(); var expected = MassValue.Gram(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivLengthAndNumber() { var exp = new Div( @@ -111,10 +111,10 @@ public void DivLengthAndNumber() var actual = exp.Execute(); var expected = LengthValue.Meter(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivTimeAndNumber() { var exp = new Div( @@ -124,10 +124,10 @@ public void DivTimeAndNumber() var actual = exp.Execute(); var expected = TimeValue.Second(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivAreaAndNumber() { var exp = new Div( @@ -137,10 +137,10 @@ public void DivAreaAndNumber() var actual = exp.Execute(); var expected = AreaValue.Meter(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivVolumeAndNumber() { var exp = new Div( @@ -150,10 +150,10 @@ public void DivVolumeAndNumber() var actual = exp.Execute(); var expected = VolumeValue.Meter(5); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndRational() { var exp = new Div( @@ -163,10 +163,10 @@ public void ExecuteRationalAndRational() var expected = new RationalValue(1, 4); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndRational() { var exp = new Div( @@ -176,10 +176,10 @@ public void ExecuteNumberAndRational() var expected = new RationalValue(1, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndNumber() { var exp = new Div( @@ -189,10 +189,10 @@ public void ExecuteRationalAndNumber() var expected = new RationalValue(3, 4); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteBoolTest() { var exp = new Div(Bool.False, Bool.True); @@ -200,20 +200,20 @@ public void ExecuteBoolTest() TestNotSupported(exp); } - [Fact] + [Test] public void ExecuteComplexNumberBoolTest() => TestNotSupported(new Div(new ComplexNumber(2, 4), Bool.True)); - [Fact] + [Test] public void ExecuteBoolComplexNumberTest() => TestNotSupported(new Div(Bool.True, new ComplexNumber(2, 4))); - [Fact] + [Test] public void CloneTest() { var exp = new Div(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Domains/DomainBuilderTests.cs b/xFunc.Tests/Expressions/Domains/DomainBuilderTests.cs index 92cf9cb39..68c434343 100644 --- a/xFunc.Tests/Expressions/Domains/DomainBuilderTests.cs +++ b/xFunc.Tests/Expressions/Domains/DomainBuilderTests.cs @@ -4,7 +4,7 @@ namespace xFunc.Tests.Expressions.Domains; public class DomainBuilderTests { - [Fact] + [Test] public void AddRangeExceeded() { var domain = new DomainBuilder(1) diff --git a/xFunc.Tests/Expressions/Domains/DomainRangeTests.cs b/xFunc.Tests/Expressions/Domains/DomainRangeTests.cs index c4dfd8006..9eaa00550 100644 --- a/xFunc.Tests/Expressions/Domains/DomainRangeTests.cs +++ b/xFunc.Tests/Expressions/Domains/DomainRangeTests.cs @@ -17,99 +17,99 @@ public static IEnumerable GetCtorTestData() yield return new object[] { NumberValue.Two, true, NumberValue.One, true }; } - [Theory] - [MemberData(nameof(GetCtorTestData))] + [Test] + [TestCaseSource(nameof(GetCtorTestData))] public void CtorTest(NumberValue start, bool isStartInclusive, NumberValue end, bool isEndInclusive) => Assert.Throws(() => new DomainRange(start, isStartInclusive, end, isEndInclusive)); - [Fact] + [Test] public void EqualTest() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, true, NumberValue.One, true); - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualTest1() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.Two, true, NumberValue.One, true); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void NotEqualTest2() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, false, NumberValue.One, true); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void NotEqualTest3() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, true, NumberValue.Two, true); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void NotEqualTest4() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, true, NumberValue.One, false); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualTest() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, true, NumberValue.One, true) as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectNotEqualTest1() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, false, NumberValue.One, true) as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectNotEqualTest2() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new object(); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualOperatorTest() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, true, NumberValue.One, true); - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualOperatorTest() { var a = new DomainRange(-NumberValue.One, true, NumberValue.One, true); var b = new DomainRange(-NumberValue.One, false, NumberValue.One, true); - Assert.True(a != b); + Assert.That(a != b, Is.True); } public static IEnumerable GetToStringTestData() @@ -120,10 +120,10 @@ public static IEnumerable GetToStringTestData() yield return new object[] { new DomainRange(-NumberValue.One, false, NumberValue.One, false), "(-1; 1)" }; } - [Theory] - [MemberData(nameof(GetToStringTestData))] + [Test] + [TestCaseSource(nameof(GetToStringTestData))] public void ToStringTest(DomainRange range, string expected) - => Assert.Equal(expected, range.ToString()); + => Assert.That(range.ToString(), Is.EqualTo(expected)); public static IEnumerable GetInRangeTestData() { @@ -133,10 +133,10 @@ public static IEnumerable GetInRangeTestData() yield return new object[] { new DomainRange(-NumberValue.One, false, NumberValue.One, false), NumberValue.Zero }; } - [Theory] - [MemberData(nameof(GetInRangeTestData))] + [Test] + [TestCaseSource(nameof(GetInRangeTestData))] public void InRangeTest(DomainRange range, NumberValue number) - => Assert.True(range.IsInRange(number)); + => Assert.That(range.IsInRange(number), Is.True); public static IEnumerable GetNotInRangeTestTest() { @@ -146,8 +146,8 @@ public static IEnumerable GetNotInRangeTestTest() yield return new object[] { new DomainRange(-NumberValue.One, false, NumberValue.One, false), NumberValue.Two }; } - [Theory] - [MemberData(nameof(GetNotInRangeTestTest))] + [Test] + [TestCaseSource(nameof(GetNotInRangeTestTest))] public void NotInRangeTest(DomainRange range, NumberValue number) - => Assert.False(range.IsInRange(number)); + => Assert.That(range.IsInRange(number), Is.False); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Domains/DomainTests.cs b/xFunc.Tests/Expressions/Domains/DomainTests.cs index 6b78d2817..0ef0d7922 100644 --- a/xFunc.Tests/Expressions/Domains/DomainTests.cs +++ b/xFunc.Tests/Expressions/Domains/DomainTests.cs @@ -10,12 +10,12 @@ public static IEnumerable GetCtorTestData() yield return new object[] { Array.Empty() }; } - [Theory] - [MemberData(nameof(GetCtorTestData))] + [Test] + [TestCaseSource(nameof(GetCtorTestData))] public void CtorNullTest(DomainRange[] ranges) => Assert.Throws(() => new Domain(ranges)); - [Fact] + [Test] public void CtorInvalidDomainTest() => Assert.Throws(() => new Domain(new DomainRange[] { @@ -23,70 +23,70 @@ public void CtorInvalidDomainTest() new DomainRange(NumberValue.NegativeInfinity, false, -NumberValue.One, true), })); - [Fact] + [Test] public void EqualTest() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualTest() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, false, NumberValue.One, true) }); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualTest() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }) as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectNotEqualTest1() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, false, NumberValue.One, true) }) as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectNotEqualTest2() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new object(); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualOperatorTest() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualOperatorTest() { var a = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, true, NumberValue.One, true) }); var b = new Domain(new DomainRange[] { new DomainRange(-NumberValue.One, false, NumberValue.One, true) }); - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var domain = new Domain(new DomainRange[] @@ -96,10 +96,10 @@ public void ToStringTest() }); var expected = "(-∞; -1] ∪ [1; ∞)"; - Assert.Equal(expected, domain.ToString()); + Assert.That(domain.ToString(), Is.EqualTo(expected)); } - [Fact] + [Test] public void InRangeTest() { var domain = new Domain(new DomainRange[] @@ -109,10 +109,10 @@ public void InRangeTest() }); var result = domain.IsInRange(NumberValue.One); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void NotInRangeTest() { var domain = new Domain(new DomainRange[] @@ -122,6 +122,6 @@ public void NotInRangeTest() }); var result = domain.IsInRange(NumberValue.Zero); - Assert.False(result); + Assert.That(result, Is.False); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ExpTest.cs b/xFunc.Tests/Expressions/ExpTest.cs index 9b9ac4f0b..03f8e6329 100644 --- a/xFunc.Tests/Expressions/ExpTest.cs +++ b/xFunc.Tests/Expressions/ExpTest.cs @@ -7,34 +7,34 @@ namespace xFunc.Tests.Expressions; public class ExpTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Exp(Number.Two); var expected = NumberValue.Exp(new NumberValue(2)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var expected = new Complex(4, 2); var exp = new Exp(new ComplexNumber(expected)); - Assert.Equal(Complex.Exp(expected), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Exp(expected))); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Exp(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Exp(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/FactTest.cs b/xFunc.Tests/Expressions/FactTest.cs index f43abaa88..526d4d2dc 100644 --- a/xFunc.Tests/Expressions/FactTest.cs +++ b/xFunc.Tests/Expressions/FactTest.cs @@ -5,34 +5,34 @@ namespace xFunc.Tests.Expressions; public class FactTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var fact = new Fact(new Number(4)); var expected = new NumberValue(24.0); - Assert.Equal(expected, fact.Execute()); + Assert.That(fact.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var fact = new Fact(Number.Zero); var expected = new NumberValue(1.0); - Assert.Equal(expected, fact.Execute()); + Assert.That(fact.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var fact = new Fact(Number.One); var expected = new NumberValue(1.0); - Assert.Equal(expected, fact.Execute()); + Assert.That(fact.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest4() { var fact = new Fact(new Number(-1)); @@ -41,16 +41,16 @@ public void ExecuteTest4() Assert.True(actual.IsNaN); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Fact(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Fact(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/FloorTest.cs b/xFunc.Tests/Expressions/FloorTest.cs index c80b3f7ab..74a12ad3c 100644 --- a/xFunc.Tests/Expressions/FloorTest.cs +++ b/xFunc.Tests/Expressions/FloorTest.cs @@ -5,106 +5,106 @@ namespace xFunc.Tests.Expressions; public class FloorTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var floor = new Floor(new Number(5.55555555)); var result = floor.Execute(); var expected = new NumberValue(5.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAngleTest() { var floor = new Floor(AngleValue.Degree(5.55555555).AsExpression()); var result = floor.Execute(); var expected = AngleValue.Degree(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerTest() { var floor = new Floor(PowerValue.Watt(5.55555555).AsExpression()); var result = floor.Execute(); var expected = PowerValue.Watt(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureTest() { var floor = new Floor(TemperatureValue.Celsius(5.55555555).AsExpression()); var result = floor.Execute(); var expected = TemperatureValue.Celsius(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassTest() { var floor = new Floor(MassValue.Gram(5.55555555).AsExpression()); var result = floor.Execute(); var expected = MassValue.Gram(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthTest() { var floor = new Floor(LengthValue.Meter(5.55555555).AsExpression()); var result = floor.Execute(); var expected = LengthValue.Meter(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeTest() { var floor = new Floor(TimeValue.Second(5.55555555).AsExpression()); var result = floor.Execute(); var expected = TimeValue.Second(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAreaTest() { var floor = new Floor(AreaValue.Meter(5.55555555).AsExpression()); var result = floor.Execute(); var expected = AreaValue.Meter(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVolumeTest() { var floor = new Floor(VolumeValue.Meter(5.55555555).AsExpression()); var result = floor.Execute(); var expected = VolumeValue.Meter(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Floor(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Floor(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/FracTest.cs b/xFunc.Tests/Expressions/FracTest.cs index 3508507bb..00a1f3f47 100644 --- a/xFunc.Tests/Expressions/FracTest.cs +++ b/xFunc.Tests/Expressions/FracTest.cs @@ -5,196 +5,196 @@ namespace xFunc.Tests.Expressions; public class FracTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Frac(new Number(5.5)); var result = exp.Execute(); var expected = new NumberValue(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeNumberTest() { var exp = new Frac(new Number(-5.5)); var result = exp.Execute(); var expected = new NumberValue(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAngleTest() { var exp = new Frac(AngleValue.Degree(5.5).AsExpression()); var result = exp.Execute(); var expected = AngleValue.Degree(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeAngleTest() { var exp = new Frac(AngleValue.Degree(-5.5).AsExpression()); var result = exp.Execute(); var expected = AngleValue.Degree(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerTest() { var exp = new Frac(PowerValue.Watt(5.5).AsExpression()); var result = exp.Execute(); var expected = PowerValue.Watt(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativePowerTest() { var exp = new Frac(PowerValue.Watt(-5.5).AsExpression()); var result = exp.Execute(); var expected = PowerValue.Watt(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureTest() { var exp = new Frac(TemperatureValue.Celsius(5.5).AsExpression()); var result = exp.Execute(); var expected = TemperatureValue.Celsius(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeTemperatureTest() { var exp = new Frac(TemperatureValue.Celsius(-5.5).AsExpression()); var result = exp.Execute(); var expected = TemperatureValue.Celsius(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassTest() { var exp = new Frac(MassValue.Gram(5.5).AsExpression()); var result = exp.Execute(); var expected = MassValue.Gram(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeMassTest() { var exp = new Frac(MassValue.Gram(-5.5).AsExpression()); var result = exp.Execute(); var expected = MassValue.Gram(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthTest() { var exp = new Frac(LengthValue.Meter(5.5).AsExpression()); var result = exp.Execute(); var expected = LengthValue.Meter(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeLengthTest() { var exp = new Frac(LengthValue.Meter(-5.5).AsExpression()); var result = exp.Execute(); var expected = LengthValue.Meter(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeTest() { var exp = new Frac(TimeValue.Second(5.5).AsExpression()); var result = exp.Execute(); var expected = TimeValue.Second(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeTimeTest() { var exp = new Frac(TimeValue.Second(-5.5).AsExpression()); var result = exp.Execute(); var expected = TimeValue.Second(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAreaTest() { var exp = new Frac(AreaValue.Meter(5.5).AsExpression()); var result = exp.Execute(); var expected = AreaValue.Meter(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeAreaTest() { var exp = new Frac(AreaValue.Meter(-5.5).AsExpression()); var result = exp.Execute(); var expected = AreaValue.Meter(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVolumeTest() { var exp = new Frac(VolumeValue.Meter(5.5).AsExpression()); var result = exp.Execute(); var expected = VolumeValue.Meter(0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeVolumeTest() { var exp = new Frac(VolumeValue.Meter(-5.5).AsExpression()); var result = exp.Execute(); var expected = VolumeValue.Meter(-0.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Frac(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Frac(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/GCDTest.cs b/xFunc.Tests/Expressions/GCDTest.cs index d96583f8e..9c8810b1d 100644 --- a/xFunc.Tests/Expressions/GCDTest.cs +++ b/xFunc.Tests/Expressions/GCDTest.cs @@ -7,25 +7,25 @@ namespace xFunc.Tests.Expressions; public class GCDTest : BaseExpressionTests { - [Fact] + [Test] public void CalculateTest1() { var exp = new GCD(new Number(12), new Number(16)); var expected = new NumberValue(4.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void CalculateTest2() { var exp = new GCD(new IExpression[] { new Number(64), new Number(16), new Number(8) }); var expected = new NumberValue(8.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void CalculateWrongArgumentTypeTest() { var exp = new GCD(new IExpression[] { Bool.True, new Number(16), new Number(8) }); @@ -33,20 +33,20 @@ public void CalculateWrongArgumentTypeTest() TestNotSupported(exp); } - [Fact] + [Test] public void NullArgTest() => Assert.Throws(() => new GCD(null)); - [Fact] + [Test] public void CloneTest() { var exp = new GCD(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void CloneWithArgsTest() { var exp = new GCD(Variable.X, Number.Zero); @@ -54,10 +54,10 @@ public void CloneWithArgsTest() var clone = exp.Clone(args); var expected = new GCD(args); - Assert.Equal(expected, clone); + Assert.That(clone, Is.EqualTo(expected)); } - [Fact] + [Test] public void EqualsSameTest() { var exp = new GCD(new IExpression[] { new Number(16), new Number(8) }); @@ -65,7 +65,7 @@ public void EqualsSameTest() Assert.True(exp.Equals(exp)); } - [Fact] + [Test] public void EqualsNullTest() { var exp = new GCD(new IExpression[] { new Number(16), new Number(8) }); @@ -73,7 +73,7 @@ public void EqualsNullTest() Assert.False(exp.Equals(null)); } - [Fact] + [Test] public void EqualsDiffTypesTest() { var exp = new GCD(new IExpression[] { new Number(16), new Number(8) }); @@ -82,7 +82,7 @@ public void EqualsDiffTypesTest() Assert.False(exp.Equals(number)); } - [Fact] + [Test] public void EqualsDiffCountTest() { var exp1 = new GCD(new IExpression[] { new Number(16), new Number(8) }); @@ -91,7 +91,7 @@ public void EqualsDiffCountTest() Assert.False(exp1.Equals(exp2)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new GCD(new IExpression[] { new Number(16), new Number(8) }); @@ -99,7 +99,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new GCD(new IExpression[] { new Number(16), new Number(8) }); diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosecantTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosecantTest.cs index 2cc03ab44..5cc6de0df 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosecantTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosecantTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicArcosecantTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arcsch(new Number(0.5)); var result = exp.Execute(); var expected = AngleValue.Radian(1.2279471772995156); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arcsch(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.23133469857397318, result.Real, 15); - Assert.Equal(-0.15038560432786197, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.23133469857397318).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.15038560432786197).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arcsch(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arcsch(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosineTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosineTest.cs index b8660cfc4..e164327d9 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosineTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcosineTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicArcosineTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arcosh(new Number(7)); var result = exp.Execute(); var expected = AngleValue.Radian(2.6339157938496336); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arcosh(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(1.9686379257930964, result.Real, 15); - Assert.Equal(0.606137822387294, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(1.9686379257930964).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.606137822387294).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arcosh(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arcosh(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcotangentTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcotangentTest.cs index 15e9d785a..546f7a6da 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcotangentTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArcotangentTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicArcotangentTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arcoth(new Number(7)); var result = exp.Execute(); var expected = AngleValue.Radian(0.14384103622589042); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arcoth(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.2290726829685388, result.Real, 15); - Assert.Equal(-0.16087527719832109, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.2290726829685388).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.16087527719832109).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arcoth(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arcoth(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsecantTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsecantTest.cs index 4749fb91b..5d0b508a7 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsecantTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsecantTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicArsecantTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arsech(new Number(0.5)); var result = exp.Execute(); var expected = AngleValue.Radian(1.3169578969248166); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arsech(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.15735549884498526, result.Real, 15); - Assert.Equal(-1.3408334244176887, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.15735549884498526).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-1.3408334244176887).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arsech(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arsech(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsineTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsineTest.cs index b456da730..c171cd4a5 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsineTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArsineTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicArsineTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arsinh(new Number(0.5)); var result = (AngleValue)exp.Execute(); var expected = AngleValue.Radian(0.48121182505960347); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arsinh(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(1.983387029916535432347076, result.Real, 15); - Assert.Equal(0.5706527843210994007, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(1.983387029916535432347076).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.5706527843210994007).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arsinh(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arsinh(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArtangentTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArtangentTest.cs index a0556b714..9c864a06b 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArtangentTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicArtangentTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicArtangentTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Artanh(new Number(0.6)); var result = exp.Execute(); var expected = AngleValue.Radian(0.6931471805599453); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Artanh(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.2290726829685388, result.Real, 15); - Assert.Equal(1.4099210495965755, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.2290726829685388).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(1.4099210495965755).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Artanh(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Artanh(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosecantTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosecantTest.cs index 479c194b9..f2a3017a3 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosecantTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosecantTest.cs @@ -7,67 +7,67 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicCosecantTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Csch(Number.One); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(57.29287073437031); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Csch(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.8509181282393216); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Csch(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(57.29287073437031); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Csch(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(63.65935931824048); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Csch(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-0.041200986288574125, result.Real, 15); - Assert.Equal(-0.090473209753207426, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-0.041200986288574125).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.090473209753207426).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Csch(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Csch(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosineTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosineTest.cs index d37af3024..6e52eaed9 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosineTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCosineTest.cs @@ -7,67 +7,67 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicCosineTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Cosh(Number.One); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.0001523125762564); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Cosh(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.5430806348152437); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Cosh(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.0001523125762564); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Cosh(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.0001233725917296); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Cosh(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-4.189625690968807230132555, result.Real, 15); - Assert.Equal(9.10922789375533659797919, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-4.189625690968807230132555).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(9.10922789375533659797919).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Cosh(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Cosh(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCotangentTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCotangentTest.cs index 5868e70b8..6db6a2149 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCotangentTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicCotangentTest.cs @@ -7,67 +7,67 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicCotangentTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Coth(Number.One); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(57.30159715911299); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Coth(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.3130352854993312); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Coth(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(57.30159715911299); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Coth(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(63.66721313838742); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Coth(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.99675779656935837, result.Real, 15); - Assert.Equal(0.0037397103763368955, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.99675779656935837).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.0037397103763368955).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Coth(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Coth(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSecantTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSecantTest.cs index 30d5cbc71..e18e0a82d 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSecantTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSecantTest.cs @@ -7,67 +7,67 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicSecantTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Sech(Number.One); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.9998477106193315); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Sech(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.6480542736638855); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Sech(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.9998477106193315); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Sech(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.9998766426271892); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Sech(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-0.0416749644111442700483, result.Real, 15); - Assert.Equal(-0.090611137196237596, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-0.0416749644111442700483).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.090611137196237596).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Sech(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Sech(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSineTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSineTest.cs index c87d9396c..3a463b97b 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSineTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicSineTest.cs @@ -7,67 +7,67 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicSineTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Sinh(Number.One); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.01745417862959511); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Sinh(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.1752011936438014); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Sinh(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.01745417862959511); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Sinh(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.015708609240015783); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Sinh(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-4.16890695996656435075, result.Real, 15); - Assert.Equal(9.154499146911429573, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-4.16890695996656435075).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(9.154499146911429573).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Sinh(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Sinh(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicTangentTest.cs b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicTangentTest.cs index 531e1412d..16d308779 100644 --- a/xFunc.Tests/Expressions/Hyperbolic/HyperbolicTangentTest.cs +++ b/xFunc.Tests/Expressions/Hyperbolic/HyperbolicTangentTest.cs @@ -7,67 +7,67 @@ namespace xFunc.Tests.Expressions.Hyperbolic; public class HyperbolicTangentTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Tanh(Number.One); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.017451520543541533); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Tanh(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.7615941559557649); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Tanh(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.017451520543541533); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Tanh(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.015706671467249425); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Tanh(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(1.0032386273536098, result.Real, 15); - Assert.Equal(-0.0037640256415041864, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(1.0032386273536098).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.0037640256415041864).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Tanh(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Tanh(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LCMTest.cs b/xFunc.Tests/Expressions/LCMTest.cs index 5d8193fcb..53455ce81 100644 --- a/xFunc.Tests/Expressions/LCMTest.cs +++ b/xFunc.Tests/Expressions/LCMTest.cs @@ -7,42 +7,42 @@ namespace xFunc.Tests.Expressions; public class LCMTest : BaseExpressionTests { - [Fact] + [Test] public void NullArgTest() => Assert.Throws(() => new LCM(null)); - [Fact] + [Test] public void ExecuteTest1() { var exp = new LCM(new Number(12), new Number(16)); var expected = new NumberValue(48.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = new LCM(new IExpression[] { new Number(4), new Number(16), new Number(8) }); var expected = new NumberValue(16.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNotSupportedTest() => TestNotSupported(new LCM(new IExpression[] { Bool.False, Bool.True })); - [Fact] + [Test] public void CloneTest() { var exp = new LCM(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void CloneWithArgsTest() { var exp = new LCM(Variable.X, Number.Zero); @@ -50,6 +50,6 @@ public void CloneWithArgsTest() var clone = exp.Clone(args); var expected = new LCM(args); - Assert.Equal(expected, clone); + Assert.That(clone, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LambdaExpressionTest.cs b/xFunc.Tests/Expressions/LambdaExpressionTest.cs index 322e8bc3c..02ce17ab7 100644 --- a/xFunc.Tests/Expressions/LambdaExpressionTest.cs +++ b/xFunc.Tests/Expressions/LambdaExpressionTest.cs @@ -2,25 +2,25 @@ namespace xFunc.Tests.Expressions; public class LambdaExpressionTest { - [Fact] + [Test] public void EqualsNullTest() { var lambda = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); - Assert.False(lambda.Equals(null)); + Assert.That(lambda.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsSameTest() { var lambda = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); - Assert.True(lambda.Equals(lambda)); + Assert.That(lambda.Equals(lambda), Is.True); } - [Fact] + [Test] public void EqualsTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) @@ -28,10 +28,10 @@ public void EqualsTest() var lambda2 = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); - Assert.True(lambda1.Equals(lambda2)); + Assert.That(lambda1.Equals(lambda2), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) @@ -39,28 +39,28 @@ public void NotEqualsTest() var lambda2 = new Lambda(new[] { "y" }, Variable.Y) .AsExpression(); - Assert.False(lambda1.Equals(lambda2)); + Assert.That(lambda1.Equals(lambda2), Is.False); } - [Fact] + [Test] public void EqualsObjectNullTest() { var lambda = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); - Assert.False(lambda.Equals((object)null)); + Assert.That(lambda.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualsObjectSameTest() { var lambda = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); - Assert.True(lambda.Equals((object)lambda)); + Assert.That(lambda.Equals((object)lambda), Is.True); } - [Fact] + [Test] public void EqualsObjectTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) @@ -68,20 +68,20 @@ public void EqualsObjectTest() var lambda2 = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); - Assert.True(lambda1.Equals((object)lambda2)); + Assert.That(lambda1.Equals((object)lambda2), Is.True); } - [Fact] + [Test] public void NotEqualsDifferentTypesTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); var lambda2 = Variable.X; - Assert.False(lambda1.Equals((object)lambda2)); + Assert.That(lambda1.Equals((object)lambda2), Is.False); } - [Fact] + [Test] public void NotEqualsObjectTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) @@ -89,10 +89,10 @@ public void NotEqualsObjectTest() var lambda2 = new Lambda(new[] { "y" }, Variable.Y) .AsExpression(); - Assert.False(lambda1.Equals((object)lambda2)); + Assert.That(lambda1.Equals((object)lambda2), Is.False); } - [Fact] + [Test] public void NotEqualsParameterObjectTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) @@ -100,10 +100,10 @@ public void NotEqualsParameterObjectTest() var lambda2 = new Lambda(new[] { "y" }, Variable.X) .AsExpression(); - Assert.False(lambda1.Equals((object)lambda2)); + Assert.That(lambda1.Equals((object)lambda2), Is.False); } - [Fact] + [Test] public void NotEqualsBodyObjectTest() { var lambda1 = new Lambda(new[] { "x" }, Variable.X) @@ -111,10 +111,10 @@ public void NotEqualsBodyObjectTest() var lambda2 = new Lambda(new[] { "x" }, Variable.Y) .AsExpression(); - Assert.False(lambda1.Equals((object)lambda2)); + Assert.That(lambda1.Equals((object)lambda2), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = new Lambda(new[] { "x" }, Variable.X) @@ -122,10 +122,10 @@ public void ExecuteTest() var result = exp.Execute(); - Assert.Equal(exp.Lambda, result); + Assert.That(result, Is.EqualTo(exp.Lambda)); } - [Fact] + [Test] public void ExecuteWithParametersTest() { var exp = new Lambda(new[] { "x" }, Variable.X) @@ -133,10 +133,10 @@ public void ExecuteWithParametersTest() var result = exp.Execute(new ExpressionParameters()); - Assert.Equal(exp.Lambda, result); + Assert.That(result, Is.EqualTo(exp.Lambda)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new Lambda(new[] { "x" }, Variable.X) @@ -145,7 +145,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new Lambda(new[] { "x" }, Variable.X) @@ -154,13 +154,13 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new Lambda(new[] { "x" }, Variable.X) .AsExpression(); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LambdaTests.cs b/xFunc.Tests/Expressions/LambdaTests.cs index 996ffbfae..6858e58cb 100644 --- a/xFunc.Tests/Expressions/LambdaTests.cs +++ b/xFunc.Tests/Expressions/LambdaTests.cs @@ -2,107 +2,107 @@ namespace xFunc.Tests.Expressions; public class LambdaTests { - [Fact] + [Test] public void EqualsTest() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x" }, new Sin(Variable.X)); - Assert.True(f1.Equals(f2)); + Assert.That(f1.Equals(f2), Is.True); } - [Fact] + [Test] public void NotEqualsTest1() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x", "y" }, new Sin(Variable.X)); - Assert.False(f1.Equals(f2)); + Assert.That(f1.Equals(f2), Is.False); } - [Fact] + [Test] public void NotEqualsTest2() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x" }, new Add(Variable.X, Variable.Y)); - Assert.False(f1.Equals(f2)); + Assert.That(f1.Equals(f2), Is.False); } - [Fact] + [Test] public void EqualsObjectTest() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x" }, new Sin(Variable.X)); - Assert.True(f1.Equals(f2 as object)); + Assert.That(f1.Equals(f2 as object), Is.True); } - [Fact] + [Test] public void NotEqualsObjectTest1() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x", "y" }, new Sin(Variable.X)); - Assert.False(f1.Equals(f2 as object)); + Assert.That(f1.Equals(f2 as object), Is.False); } - [Fact] + [Test] public void NotEqualsObjectTest2() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x" }, new Add(Variable.X, Variable.Y)); - Assert.False(f1.Equals(f2 as object)); + Assert.That(f1.Equals(f2 as object), Is.False); } - [Fact] + [Test] public void NotEqualsDiffTypesObjectTest2() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = Variable.X; - Assert.False(f1.Equals(f2 as object)); + Assert.That(f1.Equals(f2 as object), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x" }, new Sin(Variable.X)); - Assert.True(f1 == f2); + Assert.That(f1 == f2, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest1() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x", "y" }, new Sin(Variable.X)); - Assert.True(f1 != f2); + Assert.That(f1 != f2, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest2() { var f1 = new Lambda(new[] { "x" }, new Sin(Variable.X)); var f2 = new Lambda(new[] { "x" }, new Add(Variable.X, Variable.Y)); - Assert.True(f1 != f2); + Assert.That(f1 != f2, Is.True); } - [Fact] + [Test] public void ToStringTest() { var function = new Lambda( new[] { "x", "y" }, new Add(Variable.X, Variable.Y)); - Assert.Equal("(x, y) => x + y", function.ToString()); + Assert.That(function.ToString(), Is.EqualTo("(x, y) => x + y")); } - [Fact] + [Test] public void CallTest() { var function = new Lambda( @@ -117,6 +117,6 @@ public void CallTest() var result = function.Call(parameters); var expected = new NumberValue(3.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LbTest.cs b/xFunc.Tests/Expressions/LbTest.cs index 6e988d80e..64d280e44 100644 --- a/xFunc.Tests/Expressions/LbTest.cs +++ b/xFunc.Tests/Expressions/LbTest.cs @@ -5,34 +5,34 @@ namespace xFunc.Tests.Expressions; public class LbTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new Lb(Number.Two); var expected = new NumberValue(Math.Log(2, 2)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalTest() { var exp = new Lb(new Rational(new Number(2), new Number(3))); var expected = new NumberValue(-0.5849625007211563); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Lb(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Lb(new Number(5)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LgTest.cs b/xFunc.Tests/Expressions/LgTest.cs index 91ea9a886..815e9c1ea 100644 --- a/xFunc.Tests/Expressions/LgTest.cs +++ b/xFunc.Tests/Expressions/LgTest.cs @@ -7,44 +7,44 @@ namespace xFunc.Tests.Expressions; public class LgTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Lg(Number.Two); var expected = new NumberValue(Math.Log10(2)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexTest() { var complex = new Complex(2, 3); var exp = new Lg(new ComplexNumber(complex)); var expected = Complex.Log10(complex); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalTest() { var exp = new Lg(new Rational(new Number(2), new Number(3))); var expected = new NumberValue(-0.17609125905568124); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Lg(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Lg(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LnTest.cs b/xFunc.Tests/Expressions/LnTest.cs index 7776a327e..596ff731e 100644 --- a/xFunc.Tests/Expressions/LnTest.cs +++ b/xFunc.Tests/Expressions/LnTest.cs @@ -7,43 +7,43 @@ namespace xFunc.Tests.Expressions; public class LnTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Ln(Number.Two); var expected = new NumberValue(Math.Log(2)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexTest() { var complex = new Complex(2, 3); var exp = new Ln(new ComplexNumber(complex)); - Assert.Equal(Complex.Log(complex), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Log(complex))); } - [Fact] + [Test] public void ExecuteRationalTest() { var exp = new Ln(new Rational(new Number(2), new Number(3))); var expected = new NumberValue(-0.4054651081081645); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Ln(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Ln(new Number(5)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogTest.cs b/xFunc.Tests/Expressions/LogTest.cs index 53276f903..c315a115e 100644 --- a/xFunc.Tests/Expressions/LogTest.cs +++ b/xFunc.Tests/Expressions/LogTest.cs @@ -7,47 +7,47 @@ namespace xFunc.Tests.Expressions; public class LogTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Log(Number.Two, new Number(10)); var expected = new NumberValue(Math.Log(10, 2)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexTest() { var complex = new Complex(2, 3); var exp = new Log(new Number(4), new ComplexNumber(complex)); - Assert.Equal(Complex.Log(complex, 4), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Log(complex, 4))); } - [Fact] + [Test] public void ExecuteRationalTest() { var exp = new Log(new Number(3), new Rational(new Number(2), new Number(3))); var expected = new NumberValue(-0.3690702464285426); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLeftResultIsNotSupported() => TestNotSupported(new Log(Bool.False, Bool.True)); - [Fact] + [Test] public void ExecuteRightResultIsNotSupported() => TestNotSupported(new Log(new Number(10), Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new Log(Number.Zero, new Number(5)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/AndTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/AndTest.cs index 7a3951266..a8939b3ca 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/AndTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/AndTest.cs @@ -5,32 +5,32 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class AndTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new And(Number.One, new Number(3)); var expected = new NumberValue(1.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new And(Bool.True, Bool.False); - Assert.False((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTest4() { var exp = new And(Bool.True, Bool.True); - Assert.True((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteTestLeftIsNotInt() { var exp = new And(new Number(1.5), Number.One); @@ -38,7 +38,7 @@ public void ExecuteTestLeftIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteTestRightIsNotInt() { var exp = new And(Number.One, new Number(1.5)); @@ -46,7 +46,7 @@ public void ExecuteTestRightIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() { var exp = new And(new ComplexNumber(1), new ComplexNumber(2)); @@ -54,12 +54,12 @@ public void ExecuteResultIsNotSupported() TestNotSupported(exp); } - [Fact] + [Test] public void CloneTest() { var exp = new And(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/BoolTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/BoolTest.cs index 36d566a7d..2e9cfc14d 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/BoolTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/BoolTest.cs @@ -5,115 +5,118 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class BoolTest { - [Fact] + [Test] public void ExecuteTest1() { var exp = Bool.False; - Assert.False((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTest2() { var exp = Bool.False; - Assert.False((bool)exp.Execute(null)); + Assert.That((bool)exp.Execute(null), Is.False); } - [Fact] + [Test] public void ExecuteTest3() { var exp = Bool.False; - Assert.False(exp); + Assert.That((bool)exp, Is.False); } - [Fact] + [Test] public void ExecuteTest4() { var exp = (Bool)false; - Assert.False((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.False); } - [Fact] + [Test] public void NotEqualsTest() { var exp1 = Bool.False; var exp2 = Bool.True; - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void EqualsTest() { var exp1 = Bool.True; var exp2 = Bool.True; - Assert.True(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.True); } - [Fact] + [Test] public void DifferentTypesEqualsTest() { var exp1 = Bool.True; var exp2 = Number.Two; - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void EqualsBoolNullTest() { var boolean = Bool.True; - Assert.False(boolean.Equals(null)); + Assert.That(boolean.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsObjectNullTest() { var boolean = Bool.True; - Assert.False(boolean.Equals((object)null)); + Assert.That(boolean.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualsBoolThisTest() { var boolean = Bool.True; - Assert.True(boolean.Equals(boolean)); + Assert.That(boolean.Equals(boolean), Is.True); } - [Fact] + [Test] public void EqualsObjectThisTest() { var boolean = Bool.True; - Assert.True(boolean.Equals((object)boolean)); + Assert.That(boolean.Equals((object)boolean), Is.True); } - [Fact] + [Test] public void EqualsObjectTest() { var exp1 = Bool.True; var exp2 = (object)Bool.False; - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void ImplicitNullToString() { Bool x = null; - Assert.Throws(() => (bool)x); + Assert.Throws(() => + { + var temp = (bool)x; + }); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = Bool.True; @@ -121,7 +124,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = Bool.True; @@ -129,13 +132,13 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void ToStringTest() { var trueExp = Bool.True; var falseExp = Bool.False; - Assert.Equal("True", trueExp.ToString()); - Assert.Equal("False", falseExp.ToString()); + Assert.That(trueExp.ToString(), Is.EqualTo("True")); + Assert.That(falseExp.ToString(), Is.EqualTo("False")); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/EqualityTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/EqualityTest.cs index 9dcb4d420..bd0305614 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/EqualityTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/EqualityTest.cs @@ -5,23 +5,23 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class EqualityTest { - [Fact] + [Test] public void ExecuteTest1() { var eq = new Equality(Bool.True, Bool.True); - Assert.True((bool) eq.Execute()); + Assert.That((bool) eq.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteTest2() { var eq = new Equality(Bool.True, Bool.False); - Assert.False((bool) eq.Execute()); + Assert.That((bool) eq.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() { var eq = new Equality(Number.One, Number.Two); @@ -29,12 +29,12 @@ public void ExecuteResultIsNotSupported() Assert.Throws(() => eq.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new Equality(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/ImplicationTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/ImplicationTest.cs index 0574131d8..5665b8cc7 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/ImplicationTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/ImplicationTest.cs @@ -5,32 +5,32 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class ImplicationTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var impl = new Implication(Bool.True, Bool.False); - Assert.False((bool) impl.Execute()); + Assert.That((bool) impl.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTest2() { var impl = new Implication(Bool.True, Bool.True); - Assert.True((bool) impl.Execute()); + Assert.That((bool) impl.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() => TestNotSupported(new Implication(Number.One, Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new Implication(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/NAndTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/NAndTest.cs index 9ae1917bd..40ed19cf3 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/NAndTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/NAndTest.cs @@ -5,32 +5,32 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class NAndTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var nand = new NAnd(Bool.True, Bool.True); - Assert.False((bool) nand.Execute()); + Assert.That((bool) nand.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTest2() { var nand = new NAnd(Bool.False, Bool.True); - Assert.True((bool) nand.Execute()); + Assert.That((bool) nand.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() => TestNotSupported(new NAnd(Number.One, Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new NAnd(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/NOrTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/NOrTest.cs index a55d7c177..c57bffd50 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/NOrTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/NOrTest.cs @@ -5,32 +5,32 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class NOrTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var nor = new NOr(Bool.False, Bool.True); - Assert.False((bool) nor.Execute()); + Assert.That((bool) nor.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTest2() { var nor = new NOr(Bool.False, Bool.False); - Assert.True((bool) nor.Execute()); + Assert.That((bool) nor.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() => TestNotSupported(new NOr(Number.One, Number.Two)); - [Fact] + [Test] public void CloneTest() { var exp = new NOr(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/NotTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/NotTest.cs index c5ff25730..81dce048d 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/NotTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/NotTest.cs @@ -5,24 +5,24 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class NotTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Not(Number.Two); var expected = new NumberValue(-3.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new Not(Bool.True); - Assert.False((bool) exp.Execute()); + Assert.That((bool) exp.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTestValueIsNotInt() { var exp = new Not(new Number(1.5)); @@ -30,16 +30,16 @@ public void ExecuteTestValueIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() => TestNotSupported(new Not(new ComplexNumber(1))); - [Fact] + [Test] public void CloneTest() { var exp = new Not(Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/OrTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/OrTest.cs index 269696bc3..83468ab72 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/OrTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/OrTest.cs @@ -5,32 +5,32 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class OrTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Or(Number.One, Number.Two); var expected = new NumberValue(3.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new Or(Bool.True, Bool.False); - Assert.True((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteTest4() { var exp = new Or(Bool.False, Bool.False); - Assert.False((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTestLeftIsNotInt() { var exp = new Or(new Number(1.5), Number.One); @@ -38,7 +38,7 @@ public void ExecuteTestLeftIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteTestRightIsNotInt() { var exp = new Or(Number.One, new Number(1.5)); @@ -46,16 +46,16 @@ public void ExecuteTestRightIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() => TestNotSupported(new Or(new ComplexNumber(1), new ComplexNumber(2))); - [Fact] + [Test] public void CloneTest() { var exp = new Or(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/LogicalAndBitwise/XOrTest.cs b/xFunc.Tests/Expressions/LogicalAndBitwise/XOrTest.cs index c4d124ba0..b94d2388a 100644 --- a/xFunc.Tests/Expressions/LogicalAndBitwise/XOrTest.cs +++ b/xFunc.Tests/Expressions/LogicalAndBitwise/XOrTest.cs @@ -5,32 +5,32 @@ namespace xFunc.Tests.Expressions.LogicalAndBitwise; public class XOrTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new XOr(Number.One, Number.Two); var expected = new NumberValue(3.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new XOr(Bool.True, Bool.True); - Assert.False((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.False); } - [Fact] + [Test] public void ExecuteTest4() { var exp = new XOr(Bool.False, Bool.True); - Assert.True((bool)exp.Execute()); + Assert.That((bool)exp.Execute(), Is.True); } - [Fact] + [Test] public void ExecuteTestLeftIsNotInt() { var exp = new XOr(new Number(1.5), Number.One); @@ -38,7 +38,7 @@ public void ExecuteTestLeftIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteTestRightIsNotInt() { var exp = new XOr(Number.One, new Number(1.5)); @@ -46,7 +46,7 @@ public void ExecuteTestRightIsNotInt() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() { var exp = new XOr(new ComplexNumber(1), new ComplexNumber(2)); @@ -54,12 +54,12 @@ public void ExecuteResultIsNotSupported() TestNotSupported(exp); } - [Fact] + [Test] public void CloneTest() { var exp = new XOr(Bool.True, Bool.False); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/CrossProductTests.cs b/xFunc.Tests/Expressions/Matrices/CrossProductTests.cs index 76fcf25f1..74e97987b 100644 --- a/xFunc.Tests/Expressions/Matrices/CrossProductTests.cs +++ b/xFunc.Tests/Expressions/Matrices/CrossProductTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Matrices; public class CrossProductTests : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new CrossProduct( @@ -15,10 +15,10 @@ public void ExecuteTest() var result = exp.Execute(); var expected = VectorValue.Create(new NumberValue(-3), new NumberValue(6), new NumberValue(-3)); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLeftLessThenThreeTest() { var exp = new CrossProduct( @@ -29,7 +29,7 @@ public void ExecuteLeftLessThenThreeTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteRightLessThenThreeTest() { var exp = new CrossProduct( @@ -40,11 +40,11 @@ public void ExecuteRightLessThenThreeTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteTypeExceptionTest() => TestNotSupported(new CrossProduct(Number.One, Number.Two)); - [Fact] + [Test] public void ExecuteLeftTypeExceptionTest() { var exp = new CrossProduct( @@ -54,7 +54,7 @@ public void ExecuteLeftTypeExceptionTest() TestNotSupported(exp); } - [Fact] + [Test] public void ExecuteRightTypeExceptionTest() { var exp = new CrossProduct( @@ -64,7 +64,7 @@ public void ExecuteRightTypeExceptionTest() TestNotSupported(exp); } - [Fact] + [Test] public void CloneTest() { var exp = new CrossProduct( @@ -73,6 +73,6 @@ public void CloneTest() ); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/DeterminantTest.cs b/xFunc.Tests/Expressions/Matrices/DeterminantTest.cs index c36beda4a..011f9afd9 100644 --- a/xFunc.Tests/Expressions/Matrices/DeterminantTest.cs +++ b/xFunc.Tests/Expressions/Matrices/DeterminantTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Matrices; public class DeterminantTest { - [Fact] + [Test] public void ExecuteSingleTest() { var matrix = new Matrix(new[] @@ -16,10 +16,10 @@ public void ExecuteSingleTest() var det = new Determinant(matrix); var expected = new NumberValue(1.0); - Assert.Equal(expected, det.Execute()); + Assert.That(det.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDoubleTest() { var matrix = new Matrix(new[] @@ -31,10 +31,10 @@ public void ExecuteDoubleTest() var det = new Determinant(matrix); var expected = new NumberValue(-2.0); - Assert.Equal(expected, det.Execute()); + Assert.That(det.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest() { var matrix = new Matrix(new[] @@ -47,10 +47,10 @@ public void ExecuteTest() var det = new Determinant(matrix); var expected = new NumberValue(204.0); - Assert.Equal(expected, det.Execute()); + Assert.That(det.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNegativeTest() { var matrix = new Matrix(new[] @@ -63,10 +63,10 @@ public void ExecuteNegativeTest() var det = new Determinant(matrix); var expected = new NumberValue(-72.00000000000004); - Assert.Equal(expected, det.Execute()); + Assert.That(det.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteIsNotSquareTest() { var matrix = new Matrix(new[] @@ -80,7 +80,7 @@ public void ExecuteIsNotSquareTest() Assert.Throws(() => det.Execute()); } - [Fact] + [Test] public void ExecuteVectorTest() { var vector = new Vector(new IExpression[] { Number.One, new Number(-2), new Number(3) }); @@ -89,7 +89,7 @@ public void ExecuteVectorTest() Assert.Throws(() => det.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new Determinant(new Matrix(new[] @@ -100,6 +100,6 @@ public void CloneTest() })); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/DotProductTests.cs b/xFunc.Tests/Expressions/Matrices/DotProductTests.cs index e601085a3..b060a15b5 100644 --- a/xFunc.Tests/Expressions/Matrices/DotProductTests.cs +++ b/xFunc.Tests/Expressions/Matrices/DotProductTests.cs @@ -7,11 +7,11 @@ namespace xFunc.Tests.Expressions.Matrices; public class DotProductTests : BaseExpressionTests { - [Fact] + [Test] public void CtorNullTest() => Assert.Throws(() => new DotProduct(new ImmutableArray())); - [Fact] + [Test] public void ExecuteTest() { var exp = new DotProduct( @@ -21,14 +21,14 @@ public void ExecuteTest() var result = exp.Execute(); var expected = new NumberValue(32.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTypeExceptionTest() => TestNotSupported(new DotProduct(Number.One, Number.Two)); - [Fact] + [Test] public void ExecuteLeftTypeExceptionTest() { var exp = new DotProduct( @@ -38,7 +38,7 @@ public void ExecuteLeftTypeExceptionTest() TestNotSupported(exp); } - [Fact] + [Test] public void ExecuteRightTypeExceptionTest() { var exp = new DotProduct( @@ -48,7 +48,7 @@ public void ExecuteRightTypeExceptionTest() TestNotSupported(exp); } - [Fact] + [Test] public void CloneTest() { var exp = new DotProduct( @@ -57,6 +57,6 @@ public void CloneTest() ); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/InverseTest.cs b/xFunc.Tests/Expressions/Matrices/InverseTest.cs index 22aa638af..780fccf8b 100644 --- a/xFunc.Tests/Expressions/Matrices/InverseTest.cs +++ b/xFunc.Tests/Expressions/Matrices/InverseTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Matrices; public class InverseTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteMatrixTest() { var matrix = new Matrix(new[] @@ -25,10 +25,10 @@ public void ExecuteMatrixTest() var exp = new Inverse(matrix); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteIsNotSquareTest() { var matrix = new Matrix(new[] @@ -42,7 +42,7 @@ public void ExecuteIsNotSquareTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteVectorTest() { var vector = new Vector(new[] { new Number(3), new Number(7), Number.Two, new Number(5) }); @@ -51,7 +51,7 @@ public void ExecuteVectorTest() TestNotSupported(exp); } - [Fact] + [Test] public void CloneTest() { var exp = new Inverse(new Matrix(new[] @@ -62,6 +62,6 @@ public void CloneTest() })); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/MatrixTest.cs b/xFunc.Tests/Expressions/Matrices/MatrixTest.cs index 375271594..422c1e8b3 100644 --- a/xFunc.Tests/Expressions/Matrices/MatrixTest.cs +++ b/xFunc.Tests/Expressions/Matrices/MatrixTest.cs @@ -7,11 +7,11 @@ namespace xFunc.Tests.Expressions.Matrices; public class MatrixTest { - [Fact] + [Test] public void CtorNullTest() => Assert.Throws(() => new Matrix(new ImmutableArray())); - [Fact] + [Test] public void MulByNumberMatrixTest() { var vector1 = new Vector(new IExpression[] { Number.Two, new Number(3) }); @@ -27,10 +27,10 @@ public void MulByNumberMatrixTest() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddMatricesTest() { var matrix1 = new Matrix(new[] @@ -52,10 +52,10 @@ public void AddMatricesTest() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddMatricesDiffSizeTest1() { Assert.Throws(() => @@ -66,7 +66,7 @@ public void AddMatricesDiffSizeTest1() })); } - [Fact] + [Test] public void AddMatricesDiffSizeTest2() { var matrix1 = new Matrix(new[] @@ -85,7 +85,7 @@ public void AddMatricesDiffSizeTest2() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void SubMatricesTest() { var matrix1 = new Matrix(new[] @@ -107,10 +107,10 @@ public void SubMatricesTest() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubMatricesDiffSizeTest1() { Assert.Throws(() => @@ -121,7 +121,7 @@ public void SubMatricesDiffSizeTest1() })); } - [Fact] + [Test] public void SubMatricesDiffSizeTest2() { var matrix1 = new Matrix(new[] @@ -140,7 +140,7 @@ public void SubMatricesDiffSizeTest2() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void TransposeMatrixTest() { var matrix = new Matrix(new[] @@ -158,10 +158,10 @@ public void TransposeMatrixTest() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulMatrices1() { var left = new Matrix(new[] @@ -183,10 +183,10 @@ public void MulMatrices1() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulMatrices2() { var left = new Matrix(new[] @@ -211,10 +211,10 @@ public void MulMatrices2() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulMatrices3() { var left = new Matrix(new[] @@ -232,7 +232,7 @@ public void MulMatrices3() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void MulMatrices4() { var left = new Matrix(new[] @@ -315,10 +315,10 @@ public void MulMatrices4() }, }); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void MatrixMulVectorTest() { var vector = new Vector(new IExpression[] { new Number(-2), Number.One }); @@ -336,10 +336,10 @@ public void MatrixMulVectorTest() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void DetTest() { var matrix = new Matrix(new[] @@ -353,10 +353,10 @@ public void DetTest() var det = exp.Execute(); var expected = new NumberValue(204.0); - Assert.Equal(expected, det); + Assert.That(det, Is.EqualTo(expected)); } - [Fact] + [Test] public void InverseTest() { var matrix = new Matrix(new[] @@ -378,10 +378,10 @@ public void InverseTest() var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void CloneTest() { var exp = new Matrix(new[] @@ -392,22 +392,22 @@ public void CloneTest() }); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void NullVectorArrayTest() { Assert.Throws(() => new Matrix(null)); } - [Fact] + [Test] public void NullTest() { Assert.Throws(() => new Matrix(new Vector[0])); } - [Fact] + [Test] public void NullVectorElementTest() { Assert.Throws(() => new Matrix(new[] @@ -417,7 +417,7 @@ public void NullVectorElementTest() })); } - [Fact] + [Test] public void ExecuteTest() { var matrix = new Matrix(new[] @@ -436,7 +436,7 @@ public void ExecuteTest() Assert.True(expected.Equals(result)); } - [Fact] + [Test] public void MatrixAnalyzeNull() { var exp = new Matrix(new[] @@ -448,7 +448,7 @@ public void MatrixAnalyzeNull() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void MatrixAnalyzeNull2() { var exp = new Matrix(new[] @@ -460,7 +460,7 @@ public void MatrixAnalyzeNull2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void EqualsTest() { var matrix = new Matrix(new[] @@ -472,7 +472,7 @@ public void EqualsTest() Assert.True(matrix.Equals(matrix)); } - [Fact] + [Test] public void EqualsNullTest() { var matrix = new Matrix(new[] @@ -484,7 +484,7 @@ public void EqualsNullTest() Assert.False(matrix.Equals(null)); } - [Fact] + [Test] public void EqualsDiffTypeTest() { var matrix = new Matrix(new[] @@ -497,7 +497,7 @@ public void EqualsDiffTypeTest() Assert.False(matrix.Equals(number)); } - [Fact] + [Test] public void EqualsDiffCountTest() { var matrix1 = new Matrix(new[] diff --git a/xFunc.Tests/Expressions/Matrices/MatrixValueTests.cs b/xFunc.Tests/Expressions/Matrices/MatrixValueTests.cs index 46cdee1eb..cf780c222 100644 --- a/xFunc.Tests/Expressions/Matrices/MatrixValueTests.cs +++ b/xFunc.Tests/Expressions/Matrices/MatrixValueTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Matrices; public class MatrixValueTests { - [Fact] + [Test] public void CtorEmptyVectorTests() => Assert.Throws(() => MatrixValue.Create(Array.Empty())); @@ -16,8 +16,8 @@ public static IEnumerable NotEqualsTestData() yield return new object[] { MatrixValue.Create(NumberValue.One), default(MatrixValue) }; } - [Theory] - [MemberData(nameof(NotEqualsTestData))] + [Test] + [TestCaseSource(nameof(NotEqualsTestData))] public void NotEqualsTest(MatrixValue v1, MatrixValue v2) => Assert.False(v1.Equals(v2)); @@ -28,10 +28,10 @@ public static IEnumerable EqualsTestData() yield return new object[] { MatrixValue.Create(NumberValue.One), MatrixValue.Create(NumberValue.One) }; } - [Theory] - [MemberData(nameof(EqualsTestData))] + [Test] + [TestCaseSource(nameof(EqualsTestData))] public void EqualsTest(MatrixValue v1, MatrixValue v2) - => Assert.True(v1.Equals(v2)); + => Assert.That(v1.Equals(v2), Is.True); public static IEnumerable NotEqualsAsObjectTestData() { @@ -42,36 +42,36 @@ public static IEnumerable NotEqualsAsObjectTestData() yield return new object[] { MatrixValue.Create(NumberValue.One), true }; } - [Theory] - [MemberData(nameof(NotEqualsAsObjectTestData))] + [Test] + [TestCaseSource(nameof(NotEqualsAsObjectTestData))] public void NotEqualsAsObjectTest(MatrixValue v1, object v2) - => Assert.False(v1.Equals(v2)); + => Assert.That(v1.Equals(v2), Is.False); - [Theory] - [MemberData(nameof(EqualsTestData))] + [Test] + [TestCaseSource(nameof(EqualsTestData))] public void EqualsAsObjectTest(MatrixValue v1, MatrixValue v2) - => Assert.True(v1.Equals(v2 as object)); + => Assert.That(v1.Equals(v2 as object), Is.True); - [Theory] - [MemberData(nameof(NotEqualsTestData))] + [Test] + [TestCaseSource(nameof(NotEqualsTestData))] public void NotEqualsAsOperatorTest(MatrixValue v1, MatrixValue v2) - => Assert.True(v1 != v2); + => Assert.That(v1 != v2, Is.True); - [Theory] - [MemberData(nameof(EqualsTestData))] + [Test] + [TestCaseSource(nameof(EqualsTestData))] public void EqualsAsOperatorTest(MatrixValue v1, MatrixValue v2) - => Assert.True(v1 == v2); + => Assert.That(v1 == v2, Is.True); - [Fact] + [Test] public void ToStringEmptyTest() { var matrix = default(MatrixValue); var expected = "{{}}"; - Assert.Equal(expected, matrix.ToString()); + Assert.That(matrix.ToString(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ToStringTest() { var matrix = MatrixValue.Create(new NumberValue[][] @@ -81,6 +81,6 @@ public void ToStringTest() }); var expected = "{{1}, {2}}"; - Assert.Equal(expected, matrix.ToString()); + Assert.That(matrix.ToString(), Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/TransposeTest.cs b/xFunc.Tests/Expressions/Matrices/TransposeTest.cs index 4ebb24e58..95180d5a2 100644 --- a/xFunc.Tests/Expressions/Matrices/TransposeTest.cs +++ b/xFunc.Tests/Expressions/Matrices/TransposeTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Matrices; public class TransposeTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteMatrixTest() { var matrix = new Matrix(new[] @@ -22,10 +22,10 @@ public void ExecuteMatrixTest() }); var exp = new Transpose(matrix); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVectorTest() { var vector = new Vector(new[] { Number.One, Number.Two }); @@ -37,10 +37,10 @@ public void ExecuteVectorTest() }); var exp = new Transpose(vector); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteWrongArgumentTypeTest() { var exp = new Transpose(Bool.True); @@ -48,12 +48,12 @@ public void ExecuteWrongArgumentTypeTest() TestNotSupported(exp); } - [Fact] + [Test] public void CloneTest() { var exp = new Transpose(new Vector(new[] { Number.One, Number.Two })); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/VectorTest.cs b/xFunc.Tests/Expressions/Matrices/VectorTest.cs index 0aac8b803..09dc83dab 100644 --- a/xFunc.Tests/Expressions/Matrices/VectorTest.cs +++ b/xFunc.Tests/Expressions/Matrices/VectorTest.cs @@ -5,25 +5,25 @@ namespace xFunc.Tests.Expressions.Matrices; public class VectorTest : BaseExpressionTests { - [Fact] + [Test] public void NullArgumentsTest() { Assert.Throws(() => new Vector(null)); } - [Fact] + [Test] public void EmptyArgumentsTest() { Assert.Throws(() => new Vector(new IExpression[0])); } - [Fact] + [Test] public void NullTest() { Assert.Throws(() => new Vector(new IExpression[] { null, null })); } - [Fact] + [Test] public void VectorArgumentIsNotNumber() { var exp = new Vector(new IExpression[] { Bool.False }); @@ -31,7 +31,7 @@ public void VectorArgumentIsNotNumber() TestNotSupported(exp); } - [Fact] + [Test] public void MulByNumberVectorTest() { var vector = new Vector(new IExpression[] { Number.Two, new Number(3) }); @@ -41,10 +41,10 @@ public void MulByNumberVectorTest() var expected = VectorValue.Create(new NumberValue(10), new NumberValue(15)); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddVectorsTest() { var vector1 = new Vector(new IExpression[] { Number.Two, new Number(3) }); @@ -54,20 +54,20 @@ public void AddVectorsTest() var expected = VectorValue.Create(new NumberValue(9), new NumberValue(4)); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorWithAddTest() { var vector = new Vector(new IExpression[] { new Add(Number.Two, new Number(3)) }); var expected = VectorValue.Create(new NumberValue(5)); var result = vector.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddVectorsDiffSizeTest() { var vector1 = new Vector(new[] { Number.Two, new Number(3) }); @@ -77,7 +77,7 @@ public void AddVectorsDiffSizeTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void SubVectorsTest() { var vector1 = new Vector(new IExpression[] { Number.Two, new Number(3) }); @@ -87,10 +87,10 @@ public void SubVectorsTest() var expected = VectorValue.Create(new NumberValue(-5), NumberValue.Two); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubVectorsDiffSizeTest() { var vector1 = new Vector(new[] { Number.Two, new Number(3) }); @@ -100,7 +100,7 @@ public void SubVectorsDiffSizeTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void TransposeVectorTest() { var vector = new Vector(new[] { Number.One, Number.Two }); @@ -113,10 +113,10 @@ public void TransposeVectorTest() }); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorMulMatrixTest() { var vector = new Vector(new[] { new Number(-2), Number.One }); @@ -130,10 +130,10 @@ public void VectorMulMatrixTest() var expected = MatrixValue.Create(new NumberValue(-7)); var result = exp.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MultiOpMulAdd() { // ({1, 2, 3} * 4) + {2, 3, 4} @@ -145,10 +145,10 @@ public void MultiOpMulAdd() var expected = VectorValue.Create(new NumberValue(6), new NumberValue(11), new NumberValue(16)); var result = add.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MultiOpMulSub() { // ({1, 2, 3} * 4) - {2, 3, 4} @@ -160,10 +160,10 @@ public void MultiOpMulSub() var expected = VectorValue.Create(new NumberValue(2), new NumberValue(5), new NumberValue(8)); var result = sub.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MultiOpSubMul() { // ({2, 3, 4} - {1, 2, 3}) * 4 @@ -175,10 +175,10 @@ public void MultiOpSubMul() var expected = VectorValue.Create(new NumberValue(4), new NumberValue(4), new NumberValue(4)); var result = mul.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MultiOpAddMul() { // ({2, 3, 4} + {1, 2, 3}) * 4 @@ -190,10 +190,10 @@ public void MultiOpAddMul() var expected = VectorValue.Create(new NumberValue(12), new NumberValue(20), new NumberValue(28)); var result = mul.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MultiOpMulMul() { // ({1, 2, 3} * 2) * 4 @@ -204,15 +204,15 @@ public void MultiOpMulMul() var expected = VectorValue.Create(new NumberValue(8), new NumberValue(16), new NumberValue(24)); var result = mul2.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void CloneTest() { var exp = new Vector(new[] { Number.One, Number.Two, new Number(3) }); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Matrices/VectorValueTests.cs b/xFunc.Tests/Expressions/Matrices/VectorValueTests.cs index f41b0a384..da9ea7a96 100644 --- a/xFunc.Tests/Expressions/Matrices/VectorValueTests.cs +++ b/xFunc.Tests/Expressions/Matrices/VectorValueTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Matrices; public class VectorValueTests { - [Fact] + [Test] public void CtorEmptyArrayTest() => Assert.Throws(() => VectorValue.Create(Array.Empty())); @@ -16,8 +16,8 @@ public static IEnumerable NotEqualsTestData() yield return new object[] { VectorValue.Create(NumberValue.One), default(VectorValue) }; } - [Theory] - [MemberData(nameof(NotEqualsTestData))] + [Test] + [TestCaseSource(nameof(NotEqualsTestData))] public void NotEqualsTest(VectorValue v1, VectorValue v2) => Assert.False(v1.Equals(v2)); @@ -28,8 +28,8 @@ public static IEnumerable EqualsTestData() yield return new object[] { VectorValue.Create(NumberValue.One), VectorValue.Create(NumberValue.One) }; } - [Theory] - [MemberData(nameof(EqualsTestData))] + [Test] + [TestCaseSource(nameof(EqualsTestData))] public void EqualsTest(VectorValue v1, VectorValue v2) => Assert.True(v1.Equals(v2)); @@ -42,42 +42,42 @@ public static IEnumerable NotEqualsAsObjectTestData() yield return new object[] { VectorValue.Create(NumberValue.One), true }; } - [Theory] - [MemberData(nameof(NotEqualsAsObjectTestData))] + [Test] + [TestCaseSource(nameof(NotEqualsAsObjectTestData))] public void NotEqualsAsObjectTest(VectorValue v1, object v2) - => Assert.False(v1.Equals(v2)); + => Assert.That(v1.Equals(v2), Is.False); - [Theory] - [MemberData(nameof(EqualsTestData))] + [Test] + [TestCaseSource(nameof(EqualsTestData))] public void EqualsAsObjectTest(VectorValue v1, VectorValue v2) - => Assert.True(v1.Equals(v2 as object)); + => Assert.That(v1.Equals(v2 as object), Is.True); - [Theory] - [MemberData(nameof(NotEqualsTestData))] + [Test] + [TestCaseSource(nameof(NotEqualsTestData))] public void NotEqualsAsOperatorTest(VectorValue v1, VectorValue v2) - => Assert.True(v1 != v2); + => Assert.That(v1 != v2, Is.True); - [Theory] - [MemberData(nameof(EqualsTestData))] + [Test] + [TestCaseSource(nameof(EqualsTestData))] public void EqualsAsOperatorTest(VectorValue v1, VectorValue v2) - => Assert.True(v1 == v2); + => Assert.That(v1 == v2, Is.True); - [Fact] + [Test] public void ToStringEmptyTest() { var vector = default(VectorValue); var expected = "{}"; - Assert.Equal(expected, vector.ToString()); + Assert.That(vector.ToString(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ToStringTest() { var vector = VectorValue.Create(NumberValue.One, NumberValue.Two); var expected = "{1, 2}"; - Assert.Equal(expected, vector.ToString()); + Assert.That(vector.ToString(), Is.EqualTo(expected)); } public static IEnumerable AbsTestData() @@ -118,10 +118,10 @@ public static IEnumerable AbsTestData() }; } - [Theory] - [MemberData(nameof(AbsTestData))] + [Test] + [TestCaseSource(nameof(AbsTestData))] public void AbsTest(VectorValue vector, NumberValue expected) - => Assert.Equal(expected, VectorValue.Abs(vector)); + => Assert.That(VectorValue.Abs(vector), Is.EqualTo(expected)); public static IEnumerable AddTestData() { @@ -198,10 +198,10 @@ public static IEnumerable AddTestData() }; } - [Theory] - [MemberData(nameof(AddTestData))] + [Test] + [TestCaseSource(nameof(AddTestData))] public void AddTest(VectorValue v1, VectorValue v2, VectorValue expected) - => Assert.Equal(expected, v1 + v2); + => Assert.That(v1 + v2, Is.EqualTo(expected)); public static IEnumerable SubTestData() { @@ -278,10 +278,10 @@ public static IEnumerable SubTestData() }; } - [Theory] - [MemberData(nameof(SubTestData))] + [Test] + [TestCaseSource(nameof(SubTestData))] public void SubTest(VectorValue v1, VectorValue v2, VectorValue expected) - => Assert.Equal(expected, v1 - v2); + => Assert.That(v1 - v2, Is.EqualTo(expected)); public static IEnumerable MulByScalarTestData() { @@ -341,10 +341,10 @@ public static IEnumerable MulByScalarTestData() }; } - [Theory] - [MemberData(nameof(MulByScalarTestData))] + [Test] + [TestCaseSource(nameof(MulByScalarTestData))] public void MulByScalarTest(VectorValue v1, NumberValue v2, VectorValue expected) - => Assert.Equal(expected, v1 * v2); + => Assert.That(v1 * v2, Is.EqualTo(expected)); public static IEnumerable MulTestData() { @@ -404,10 +404,10 @@ public static IEnumerable MulTestData() }; } - [Theory] - [MemberData(nameof(MulTestData))] + [Test] + [TestCaseSource(nameof(MulTestData))] public void MulTest(VectorValue v1, VectorValue v2, NumberValue expected) - => Assert.Equal(expected, v1 * v2); + => Assert.That(v1 * v2, Is.EqualTo(expected)); public static IEnumerable SumTestData() { @@ -447,8 +447,8 @@ public static IEnumerable SumTestData() }; } - [Theory] - [MemberData(nameof(SumTestData))] + [Test] + [TestCaseSource(nameof(SumTestData))] public void SumTest(VectorValue v1, NumberValue expected) - => Assert.Equal(expected, v1.Sum()); + => Assert.That(v1.Sum(), Is.EqualTo(expected)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ModTest.cs b/xFunc.Tests/Expressions/ModTest.cs index 137e91c47..628654cea 100644 --- a/xFunc.Tests/Expressions/ModTest.cs +++ b/xFunc.Tests/Expressions/ModTest.cs @@ -5,35 +5,35 @@ namespace xFunc.Tests.Expressions; public class ModTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Mod(new Number(25), new Number(7)); var result = exp.Execute(); var expected = new NumberValue(4.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = new Mod(new Number(25), new Number(5)); var result = exp.Execute(); - Assert.Equal(new NumberValue(0.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(0.0))); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new Mod(Number.Zero, new Number(5)); var result = exp.Execute(); - Assert.Equal(new NumberValue(0.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(0.0))); } - [Fact] + [Test] public void ExecuteTest4() { var exp = new Mod(new Number(5), Number.Zero); @@ -42,16 +42,16 @@ public void ExecuteTest4() Assert.True(result.IsNaN); } - [Fact] + [Test] public void ExecuteResultIsNotSupported() => TestNotSupported(new Mod(Bool.True, Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Mod(new Number(5), Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/MulTest.cs b/xFunc.Tests/Expressions/MulTest.cs index 882fe4537..8c25b208c 100644 --- a/xFunc.Tests/Expressions/MulTest.cs +++ b/xFunc.Tests/Expressions/MulTest.cs @@ -9,52 +9,52 @@ namespace xFunc.Tests.Expressions; public class MulTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteMulNumberByNumberTest() { var exp = new Mul(Number.Two, Number.Two); var expected = new NumberValue(4.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulComplexByComplexTest() { var exp = new Mul(new ComplexNumber(2, 5), new ComplexNumber(3, 2)); var expected = new Complex(-4, 19); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulComplexByNumberTest() { var exp = new Mul(new ComplexNumber(2, 5), Number.Two); var expected = new Complex(4, 10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulNumberByComplexTest() { var exp = new Mul(Number.Two, new ComplexNumber(3, 2)); var expected = new Complex(6, 4); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulNumberBySqrtComplexTest() { var exp = new Mul(Number.Two, new Sqrt(new Number(-9))); var expected = new Complex(0, 6); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDotProductTest() { var vector1 = new Vector(new IExpression[] @@ -68,10 +68,10 @@ public void ExecuteDotProductTest() var exp = new Mul(vector1, vector2); var expected = new NumberValue(32.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDotProductErrorTest() { var vector1 = new Vector(new IExpression[] @@ -87,7 +87,7 @@ public void ExecuteDotProductErrorTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteMulComplexByBool() { var complex = new ComplexNumber(3, 2); @@ -97,7 +97,7 @@ public void ExecuteMulComplexByBool() Assert.Throws(() => mul.Execute()); } - [Fact] + [Test] public void ExecuteMulBoolByComplex() { var boolean = Bool.True; @@ -107,7 +107,7 @@ public void ExecuteMulBoolByComplex() Assert.Throws(() => mul.Execute()); } - [Fact] + [Test] public void ExecuteMulVectorByMatrixTest() { var vector = new Vector(new IExpression[] @@ -126,10 +126,10 @@ public void ExecuteMulVectorByMatrixTest() var expected = MatrixValue.Create(new NumberValue(32)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulMatrixByVectorTest() { var matrix = new Matrix(new[] @@ -153,10 +153,10 @@ public void ExecuteMulMatrixByVectorTest() new NumberValue[] { new NumberValue(6), new NumberValue(12), new NumberValue(18) }, }); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulMatrixByMatrixTest() { var matrix1 = new Matrix(new[] @@ -173,10 +173,10 @@ public void ExecuteMulMatrixByMatrixTest() var expected = MatrixValue.Create(new NumberValue(32)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulNumberByVectorTest() { var number = new Number(5); @@ -190,10 +190,10 @@ public void ExecuteMulNumberByVectorTest() var expected = VectorValue.Create(new NumberValue(5), new NumberValue(10), new NumberValue(15)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulMatrixByNumberTest() { var matrix = new Matrix(new[] @@ -210,10 +210,10 @@ public void ExecuteMulMatrixByNumberTest() new NumberValue[] { new NumberValue(15), new NumberValue(20) }, }); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulNumberByMatrixTest() { var number = new Number(5); @@ -230,30 +230,30 @@ public void ExecuteMulNumberByMatrixTest() new NumberValue[] { new NumberValue(15), new NumberValue(20) }, }); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndDegree() { var exp = new Mul(Number.Two, AngleValue.Degree(10).AsExpression()); var actual = exp.Execute(); var expected = AngleValue.Degree(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulRadianAndNumber() { var exp = new Mul(AngleValue.Radian(10).AsExpression(), Number.Two); var actual = exp.Execute(); var expected = AngleValue.Radian(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndPower() { var exp = new Mul( @@ -263,10 +263,10 @@ public void MulNumberAndPower() var actual = exp.Execute(); var expected = PowerValue.Watt(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulPowerAndNumber() { var exp = new Mul( @@ -276,10 +276,10 @@ public void MulPowerAndNumber() var actual = exp.Execute(); var expected = PowerValue.Watt(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndTemperature() { var exp = new Mul( @@ -289,10 +289,10 @@ public void MulNumberAndTemperature() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulTemperatureAndNumber() { var exp = new Mul( @@ -302,10 +302,10 @@ public void MulTemperatureAndNumber() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndMass() { var exp = new Mul( @@ -315,10 +315,10 @@ public void MulNumberAndMass() var actual = exp.Execute(); var expected = MassValue.Gram(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulMassAndNumber() { var exp = new Mul( @@ -328,10 +328,10 @@ public void MulMassAndNumber() var actual = exp.Execute(); var expected = MassValue.Gram(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndLength() { var exp = new Mul( @@ -341,10 +341,10 @@ public void MulNumberAndLength() var actual = exp.Execute(); var expected = LengthValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulLengthAndNumber() { var exp = new Mul( @@ -354,10 +354,10 @@ public void MulLengthAndNumber() var actual = exp.Execute(); var expected = LengthValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulLengthAndLength() { var exp = new Mul( @@ -367,10 +367,10 @@ public void MulLengthAndLength() var actual = exp.Execute(); var expected = AreaValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulAreaAndLength() { var exp = new Mul( @@ -380,10 +380,10 @@ public void MulAreaAndLength() var actual = exp.Execute(); var expected = VolumeValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulLengthAndArea() { var exp = new Mul( @@ -393,10 +393,10 @@ public void MulLengthAndArea() var actual = exp.Execute(); var expected = VolumeValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndTime() { var exp = new Mul( @@ -406,10 +406,10 @@ public void MulNumberAndTime() var actual = exp.Execute(); var expected = TimeValue.Second(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulTimeAndNumber() { var exp = new Mul( @@ -419,10 +419,10 @@ public void MulTimeAndNumber() var actual = exp.Execute(); var expected = TimeValue.Second(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndArea() { var exp = new Mul( @@ -432,10 +432,10 @@ public void MulNumberAndArea() var actual = exp.Execute(); var expected = AreaValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulAreaAndNumber() { var exp = new Mul( @@ -445,10 +445,10 @@ public void MulAreaAndNumber() var actual = exp.Execute(); var expected = AreaValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulNumberAndVolume() { var exp = new Mul( @@ -458,10 +458,10 @@ public void MulNumberAndVolume() var actual = exp.Execute(); var expected = VolumeValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulVolumeAndNumber() { var exp = new Mul( @@ -471,10 +471,10 @@ public void MulVolumeAndNumber() var actual = exp.Execute(); var expected = VolumeValue.Meter(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndRational() { var exp = new Mul( @@ -484,10 +484,10 @@ public void ExecuteRationalAndRational() var expected = new RationalValue(1, 1); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndRational() { var exp = new Mul( @@ -497,10 +497,10 @@ public void ExecuteNumberAndRational() var expected = new RationalValue(2, 1); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndNumber() { var exp = new Mul( @@ -510,19 +510,19 @@ public void ExecuteRationalAndNumber() var expected = new RationalValue(3, 1); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMulBoolByBoolTest() => TestNotSupported(new Mul(Bool.True, Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new Mul(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/NumberTest.cs b/xFunc.Tests/Expressions/NumberTest.cs index 71d8f6e5f..bafd919f2 100644 --- a/xFunc.Tests/Expressions/NumberTest.cs +++ b/xFunc.Tests/Expressions/NumberTest.cs @@ -5,97 +5,97 @@ namespace xFunc.Tests.Expressions; public class NumberTest { - [Fact] + [Test] public void EqualsNumberNullTest() { var number = Number.Zero; - Assert.False(number.Equals(null)); + Assert.That(number.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsObjectNullTest() { var number = Number.Zero; - Assert.False(number.Equals((object)null)); + Assert.That(number.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualsNumberThisTest() { var number = Number.Zero; - Assert.True(number.Equals(number)); + Assert.That(number.Equals(number), Is.True); } - [Fact] + [Test] public void EqualsObjectThisTest() { var number = Number.Zero; - Assert.True(number.Equals((object)number)); + Assert.That(number.Equals((object)number), Is.True); } - [Fact] + [Test] public void EqualsTest() { var left = Number.Zero; var right = Number.Zero; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var left = Number.Zero; var right = Number.One; - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var number = Number.One; - Assert.Equal(new NumberValue(1.0), number.Execute()); + Assert.That(number.Execute(), Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void NanTest() { var number = new Number(double.NaN); - Assert.True(number.Value.IsNaN); + Assert.That(number.Value.IsNaN, Is.True); } - [Fact] + [Test] public void PositiveInfinityTest() { var number = new Number(double.PositiveInfinity); - Assert.True(number.Value.IsPositiveInfinity); + Assert.That(number.Value.IsPositiveInfinity, Is.True); } - [Fact] + [Test] public void NegativeInfinityTest() { var number = new Number(double.NegativeInfinity); - Assert.True(number.Value.IsNegativeInfinity); + Assert.That(number.Value.IsNegativeInfinity, Is.True); } - [Fact] + [Test] public void InfinityTest() { var number = new Number(double.NegativeInfinity); - Assert.True(number.Value.IsInfinity); + Assert.That(number.Value.IsInfinity, Is.True); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = Number.One; @@ -103,7 +103,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = Number.One; diff --git a/xFunc.Tests/Expressions/NumberValueTest.cs b/xFunc.Tests/Expressions/NumberValueTest.cs index 962a04a64..bde3b167d 100644 --- a/xFunc.Tests/Expressions/NumberValueTest.cs +++ b/xFunc.Tests/Expressions/NumberValueTest.cs @@ -5,188 +5,188 @@ namespace xFunc.Tests.Expressions; public class NumberValueTest { - [Fact] + [Test] public void EqualObjectTest() { var x = new NumberValue(1); var y = (object)new NumberValue(1.0); - Assert.True(x.Equals(y)); + Assert.That(x.Equals(y), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var x = new NumberValue(1); var y = new object(); - Assert.False(x.Equals(y)); + Assert.That(x.Equals(y), Is.False); } - [Fact] + [Test] public void EqualNumberTest() { var x = new NumberValue(1); var y = new NumberValue(1); - Assert.True(x == y); + Assert.That(x == y, Is.True); } - [Fact] + [Test] public void NotEqualNumberTest() { var x = new NumberValue(1); var y = new NumberValue(2); - Assert.True(x != y); + Assert.That(x != y, Is.True); } - [Fact] + [Test] public void EqualDoubleTest() { var x = new NumberValue(1); var y = 1.0; - Assert.True(x == y); - Assert.True(y == x); + Assert.That(x == y, Is.True); + Assert.That(y == x, Is.True); } - [Fact] + [Test] public void NotEqualDoubleTest() { var x = new NumberValue(1); var y = 2.0; - Assert.True(x != y); - Assert.True(y != x); + Assert.That(x != y, Is.True); + Assert.That(y != x, Is.True); } - [Fact] + [Test] public void NumberLessNumberTest() { var x = new NumberValue(1); var y = new NumberValue(2); - Assert.True(x < y); - Assert.True(x <= y); + Assert.That(x < y, Is.True); + Assert.That(x <= y, Is.True); } - [Fact] + [Test] public void NumberLessDoubleTest() { var x = new NumberValue(1); var y = 2.0; - Assert.True(x < y); - Assert.True(x <= y); + Assert.That(x < y, Is.True); + Assert.That(x <= y, Is.True); } - [Fact] + [Test] public void DoubleLessNumberTest() { var x = 1.0; var y = new NumberValue(2.0); - Assert.True(x < y); - Assert.True(x <= y); + Assert.That(x < y, Is.True); + Assert.That(x <= y, Is.True); } - [Fact] + [Test] public void NumberGreaterNumberTest() { var x = new NumberValue(1); var y = new NumberValue(2); - Assert.True(y > x); - Assert.True(y >= x); + Assert.That(y > x, Is.True); + Assert.That(y >= x, Is.True); } - [Fact] + [Test] public void NumberGreaterDoubleTest() { var x = new NumberValue(1); var y = 2.0; - Assert.True(y > x); - Assert.True(y >= x); + Assert.That(y > x, Is.True); + Assert.That(y >= x, Is.True); } - [Fact] + [Test] public void DoubleGreaterNumberTest() { var x = 1.0; var y = new NumberValue(2); - Assert.True(y > x); - Assert.True(y >= x); + Assert.That(y > x, Is.True); + Assert.That(y >= x, Is.True); } // .... - [Fact] + [Test] public void NumberLessOrEqualNumberTest() { var x = new NumberValue(1); var y = new NumberValue(1); - Assert.True(x <= y); + Assert.That(x <= y, Is.True); } - [Fact] + [Test] public void NumberLessOrEqualDoubleTest() { var x = new NumberValue(1); var y = 1.0; - Assert.True(x <= y); + Assert.That(x <= y, Is.True); } - [Fact] + [Test] public void DoubleLessOrEqualNumberTest() { var x = 1.0; var y = new NumberValue(1.0); - Assert.True(x <= y); + Assert.That(x <= y, Is.True); } - [Fact] + [Test] public void NumberGreaterOrEqualNumberTest() { var x = new NumberValue(1); var y = new NumberValue(1); - Assert.True(y >= x); + Assert.That(y >= x, Is.True); } - [Fact] + [Test] public void NumberGreaterOrEqualDoubleTest() { var x = new NumberValue(1); var y = 1.0; - Assert.True(y >= x); + Assert.That(y >= x, Is.True); } - [Fact] + [Test] public void DoubleGreaterOrEqualNumberTest() { var x = 1.0; var y = new NumberValue(1); - Assert.True(y >= x); + Assert.That(y >= x, Is.True); } - [Fact] + [Test] public void CompareNullTest() { var x = new NumberValue(1); - Assert.Equal(1, x.CompareTo(null)); + Assert.That(x.CompareTo(null), Is.EqualTo(1)); } - [Fact] + [Test] public void CompareToDifferentTypeTest() { var x = NumberValue.One; @@ -195,12 +195,12 @@ public void CompareToDifferentTypeTest() Assert.Throws(() => x.CompareTo(y)); } - [Fact] + [Test] public void RoundTest() { var x = new NumberValue(1.5); var expected = new NumberValue(2.0); - Assert.Equal(expected, NumberValue.Round(x)); + Assert.That(NumberValue.Round(x), Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Parameters/ExpressionParameterTest.cs b/xFunc.Tests/Expressions/Parameters/ExpressionParameterTest.cs index 256428f8c..3f9f75c81 100644 --- a/xFunc.Tests/Expressions/Parameters/ExpressionParameterTest.cs +++ b/xFunc.Tests/Expressions/Parameters/ExpressionParameterTest.cs @@ -7,29 +7,29 @@ namespace xFunc.Tests.Expressions.Parameters; public class ExpressionParameterTest { - [Fact] + [Test] public void NullCtorTest() { Assert.Throws(() => new ExpressionParameters(null as ExpressionParameters)); } - [Fact] + [Test] public void InitializeWithConstantsTest() { var parameters = new ExpressionParameters(true); - Assert.NotEmpty(parameters); + CollectionAssert.IsNotEmpty(parameters); } - [Fact] + [Test] public void InitializeWithoutConstantsTest() { var parameters = new ExpressionParameters(false); - Assert.Empty(parameters); + CollectionAssert.IsEmpty(parameters); } - [Fact] + [Test] public void InitializeDuplicatesTest() { var array = new[] @@ -41,11 +41,11 @@ public void InitializeDuplicatesTest() Assert.Throws(() => new ExpressionParameters(array)); } - [Fact] + [Test] public void InitializeNullTest() => Assert.Throws(() => new ExpressionParameters(null)); - [Fact] + [Test] public void ChangedEventTest() { var isExecuted = false; @@ -55,9 +55,9 @@ public void ChangedEventTest() { isExecuted = true; - Assert.Equal(NotifyCollectionChangedAction.Add, args.Action); + Assert.That(args.Action, Is.EqualTo(NotifyCollectionChangedAction.Add)); Assert.Null(args.OldItems); - Assert.Single(args.NewItems); + Assert.That(args.NewItems, Has.Count.EqualTo(1)); }; parameters.Add(new Parameter("xxx", 1.0)); @@ -65,15 +65,15 @@ public void ChangedEventTest() Assert.True(isExecuted); } - [Fact] + [Test] public void EnumeratorTest() { var parameters = new ExpressionParameters(true); - Assert.True(parameters.Any()); + Assert.That(parameters.Any(), Is.True); } - [Fact] + [Test] public void AddNullParameter() { var parameters = new ExpressionParameters(true); @@ -81,7 +81,7 @@ public void AddNullParameter() Assert.Throws(() => parameters.Add(null as Parameter)); } - [Fact] + [Test] public void AddConstantParameter() { var parameters = new ExpressionParameters(true); @@ -90,7 +90,7 @@ public void AddConstantParameter() Assert.Throws(() => parameters.Add(parameter)); } - [Fact] + [Test] public void AddParameter() { var parameters = new ExpressionParameters(true); @@ -100,10 +100,10 @@ public void AddParameter() var result = parameters[parameter.Key]; - Assert.Equal(parameter.Value, result); + Assert.That(result, Is.EqualTo(parameter.Value)); } - [Fact] + [Test] public void RemoveNullParameter() { var parameters = new ExpressionParameters(true); @@ -111,7 +111,7 @@ public void RemoveNullParameter() Assert.Throws(() => parameters.Remove(null as Parameter)); } - [Fact] + [Test] public void RemoveConstantParameter() { var parameters = new ExpressionParameters(true); @@ -120,7 +120,7 @@ public void RemoveConstantParameter() Assert.Throws(() => parameters.Add(parameter)); } - [Fact] + [Test] public void RemoveStringParameter() { var parameters = new ExpressionParameters(true); @@ -128,7 +128,7 @@ public void RemoveStringParameter() Assert.Throws(() => parameters.Remove(string.Empty)); } - [Fact] + [Test] public void GetItemFromCollectionTest() { var parameters = new ExpressionParameters @@ -136,26 +136,29 @@ public void GetItemFromCollectionTest() new Parameter("x", 2.3) }; - Assert.Equal(new NumberValue(2.3), parameters["x"]); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(2.3))); } - [Fact] + [Test] public void GetItemFromConstsTest() { var parameters = new ExpressionParameters(); - Assert.Equal(AngleValue.Radian(Math.PI), parameters["π"]); + Assert.That(parameters["π"].Value, Is.EqualTo(AngleValue.Radian(Math.PI))); } - [Fact] + [Test] public void GetItemKeyNotFoundTest() { var parameters = new ExpressionParameters(); - Assert.Throws(() => parameters["hello"]); + Assert.Throws(() => + { + var value = parameters["hello"].Value; + }); } - [Fact] + [Test] public void SetItemFromCollectionTest() { var parameters = new ExpressionParameters @@ -163,12 +166,12 @@ public void SetItemFromCollectionTest() ["x"] = 2.3 }; - Assert.True(parameters.ContainsKey("x")); - Assert.Contains(new Parameter("x", 2.3), parameters); - Assert.Equal(new NumberValue(2.3), parameters["x"]); + Assert.That(parameters.ContainsKey("x"), Is.True); + CollectionAssert.Contains(parameters, new Parameter("x", 2.3)); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(2.3))); } - [Fact] + [Test] public void ContainsNullTest() { var parameters = new ExpressionParameters(); @@ -176,7 +179,7 @@ public void ContainsNullTest() Assert.Throws(() => parameters.Contains(null)); } - [Fact] + [Test] public void SetExistItemFromCollectionTest() { var parameters = new ExpressionParameters @@ -185,11 +188,11 @@ public void SetExistItemFromCollectionTest() }; parameters["x"] = new NumberValue(3.3); - Assert.True(parameters.ContainsKey("x")); - Assert.Equal(new NumberValue(3.3), parameters["x"]); + Assert.That(parameters.ContainsKey("x"), Is.True); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(3.3))); } - [Fact] + [Test] public void SetReadOnlyItemTest() { var parameters = new ExpressionParameters @@ -200,7 +203,7 @@ public void SetReadOnlyItemTest() Assert.Throws(() => parameters["hello"] = 5); } - [Fact] + [Test] public void OverrideConstsTest() { var parameters = new ExpressionParameters @@ -208,11 +211,11 @@ public void OverrideConstsTest() ["π"] = 4 }; - Assert.True(parameters.ContainsKey("π")); - Assert.Equal(new NumberValue(4.0), parameters["π"]); + Assert.That(parameters.ContainsKey("π"), Is.True); + Assert.That(parameters["π"].Value, Is.EqualTo(new NumberValue(4.0))); } - [Fact] + [Test] public void OverrideRemoveTest() { var parameters = new ExpressionParameters(false) @@ -222,10 +225,10 @@ public void OverrideRemoveTest() parameters["a"] = 2; parameters.Remove("a"); - Assert.Empty(parameters); + CollectionAssert.IsEmpty(parameters); } - [Fact] + [Test] public void ClearTest() { var parameters = new ExpressionParameters(false) @@ -235,10 +238,10 @@ public void ClearTest() parameters.Clear(); - Assert.Empty(parameters); + CollectionAssert.IsEmpty(parameters); } - [Fact] + [Test] public void ScopedGetEnumerator() { var parameters = new ExpressionParameters(false) @@ -248,10 +251,10 @@ public void ScopedGetEnumerator() var scoped = ExpressionParameters.CreateScoped(parameters); scoped["y"] = new ParameterValue(2); - Assert.Equal(2, scoped.Count()); + Assert.That(scoped.Count(), Is.EqualTo(2)); } - [Fact] + [Test] public void ScopedGetParentValue() { var parameter = new Parameter("x", new ParameterValue(1)); @@ -264,10 +267,10 @@ public void ScopedGetParentValue() var result = scoped[parameter.Key]; - Assert.Equal(parameter.Value, result); + Assert.That(result, Is.EqualTo(parameter.Value)); } - [Fact] + [Test] public void ScopedSetActualValue() { const string key = "x"; @@ -283,11 +286,11 @@ public void ScopedSetActualValue() var result = scoped[key]; var parentResult = parent[key]; - Assert.Equal(new ParameterValue(NumberValue.Two), result); - Assert.Equal(new ParameterValue(NumberValue.One), parentResult); + Assert.That(result, Is.EqualTo(new ParameterValue(NumberValue.Two))); + Assert.That(parentResult, Is.EqualTo(new ParameterValue(NumberValue.One))); } - [Fact] + [Test] public void ScopedSetParentValue() { const string key = "x"; @@ -303,11 +306,11 @@ public void ScopedSetParentValue() var result = scoped[key]; var parentResult = parent[key]; - Assert.Equal(new ParameterValue(NumberValue.Two), result); - Assert.Equal(new ParameterValue(NumberValue.Two), parentResult); + Assert.That(result, Is.EqualTo(new ParameterValue(NumberValue.Two))); + Assert.That(parentResult, Is.EqualTo(new ParameterValue(NumberValue.Two))); } - [Fact] + [Test] public void ScopedContainsParentValue() { var parameter = new Parameter("x", new ParameterValue(1)); @@ -323,7 +326,7 @@ public void ScopedContainsParentValue() Assert.True(result); } - [Fact] + [Test] public void ScopedDoesntContainsParentValue() { var parameter = new Parameter("x", new ParameterValue(1)); @@ -339,7 +342,7 @@ public void ScopedDoesntContainsParentValue() Assert.False(result); } - [Fact] + [Test] public void ScopedContainsValue() { var x = new Parameter("x", new ParameterValue(1)); @@ -357,7 +360,7 @@ public void ScopedContainsValue() Assert.True(result); } - [Fact] + [Test] public void ScopedDoesntContainsValue() { var x = new Parameter("x", new ParameterValue(1)); @@ -375,97 +378,97 @@ public void ScopedDoesntContainsValue() Assert.False(result); } - [Theory] - [InlineData("add", typeof(Add))] - [InlineData("sub", typeof(Sub))] - [InlineData("mul", typeof(Mul))] - [InlineData("div", typeof(Div))] - [InlineData("pow", typeof(Pow))] - [InlineData("exp", typeof(Exp))] - [InlineData("abs", typeof(Abs))] - [InlineData("sqrt", typeof(Sqrt))] - [InlineData("root", typeof(Root))] - [InlineData("fact", typeof(Fact))] - [InlineData("factorial", typeof(Fact))] - [InlineData("ln", typeof(Ln))] - [InlineData("lg", typeof(Lg))] - [InlineData("lb", typeof(Lb))] - [InlineData("log2", typeof(Lb))] - [InlineData("log", typeof(Log))] - [InlineData("todeg", typeof(ToDegree))] - [InlineData("todegree", typeof(ToDegree))] - [InlineData("torad", typeof(ToRadian))] - [InlineData("toradian", typeof(ToRadian))] - [InlineData("tograd", typeof(ToGradian))] - [InlineData("togradian", typeof(ToGradian))] - [InlineData("sin", typeof(Sin))] - [InlineData("cos", typeof(Cos))] - [InlineData("tan", typeof(Tan))] - [InlineData("tg", typeof(Tan))] - [InlineData("cot", typeof(Cot))] - [InlineData("ctg", typeof(Cot))] - [InlineData("sec", typeof(Sec))] - [InlineData("cosec", typeof(Csc))] - [InlineData("csc", typeof(Csc))] - [InlineData("arcsin", typeof(Arcsin))] - [InlineData("arccos", typeof(Arccos))] - [InlineData("arctan", typeof(Arctan))] - [InlineData("arctg", typeof(Arctan))] - [InlineData("arccot", typeof(Arccot))] - [InlineData("arcctg", typeof(Arccot))] - [InlineData("arcsec", typeof(Arcsec))] - [InlineData("arccosec", typeof(Arccsc))] - [InlineData("arccsc", typeof(Arccsc))] - [InlineData("sh", typeof(Sinh))] - [InlineData("sinh", typeof(Sinh))] - [InlineData("ch", typeof(Cosh))] - [InlineData("cosh", typeof(Cosh))] - [InlineData("th", typeof(Tanh))] - [InlineData("tanh", typeof(Tanh))] - [InlineData("cth", typeof(Coth))] - [InlineData("coth", typeof(Coth))] - [InlineData("sech", typeof(Sech))] - [InlineData("csch", typeof(Csch))] - [InlineData("arsh", typeof(Arsinh))] - [InlineData("arsinh", typeof(Arsinh))] - [InlineData("arch", typeof(Arcosh))] - [InlineData("arcosh", typeof(Arcosh))] - [InlineData("arth", typeof(Artanh))] - [InlineData("artanh", typeof(Artanh))] - [InlineData("arcth", typeof(Arcoth))] - [InlineData("arcoth", typeof(Arcoth))] - [InlineData("arsch", typeof(Arsech))] - [InlineData("arsech", typeof(Arsech))] - [InlineData("arcsch", typeof(Arcsch))] - [InlineData("round", typeof(Round))] - [InlineData("floor", typeof(Floor))] - [InlineData("ceil", typeof(Ceil))] - [InlineData("trunc", typeof(Trunc))] - [InlineData("truncate", typeof(Trunc))] - [InlineData("frac", typeof(Frac))] - [InlineData("transpose", typeof(Transpose))] - [InlineData("det", typeof(Determinant))] - [InlineData("determinant", typeof(Determinant))] - [InlineData("inverse", typeof(Inverse))] - [InlineData("dotproduct", typeof(DotProduct))] - [InlineData("crossproduct", typeof(CrossProduct))] - [InlineData("im", typeof(Im))] - [InlineData("imaginary", typeof(Im))] - [InlineData("re", typeof(Re))] - [InlineData("real", typeof(Re))] - [InlineData("phase", typeof(Phase))] - [InlineData("conjugate", typeof(Conjugate))] - [InlineData("reciprocal", typeof(Reciprocal))] - [InlineData("tocomplex", typeof(ToComplex))] - [InlineData("sign", typeof(Sign))] - [InlineData("tobin", typeof(ToBin))] - [InlineData("tooct", typeof(ToOct))] - [InlineData("tohex", typeof(ToHex))] + [Test] + [TestCase("add", typeof(Add))] + [TestCase("sub", typeof(Sub))] + [TestCase("mul", typeof(Mul))] + [TestCase("div", typeof(Div))] + [TestCase("pow", typeof(Pow))] + [TestCase("exp", typeof(Exp))] + [TestCase("abs", typeof(Abs))] + [TestCase("sqrt", typeof(Sqrt))] + [TestCase("root", typeof(Root))] + [TestCase("fact", typeof(Fact))] + [TestCase("factorial", typeof(Fact))] + [TestCase("ln", typeof(Ln))] + [TestCase("lg", typeof(Lg))] + [TestCase("lb", typeof(Lb))] + [TestCase("log2", typeof(Lb))] + [TestCase("log", typeof(Log))] + [TestCase("todeg", typeof(ToDegree))] + [TestCase("todegree", typeof(ToDegree))] + [TestCase("torad", typeof(ToRadian))] + [TestCase("toradian", typeof(ToRadian))] + [TestCase("tograd", typeof(ToGradian))] + [TestCase("togradian", typeof(ToGradian))] + [TestCase("sin", typeof(Sin))] + [TestCase("cos", typeof(Cos))] + [TestCase("tan", typeof(Tan))] + [TestCase("tg", typeof(Tan))] + [TestCase("cot", typeof(Cot))] + [TestCase("ctg", typeof(Cot))] + [TestCase("sec", typeof(Sec))] + [TestCase("cosec", typeof(Csc))] + [TestCase("csc", typeof(Csc))] + [TestCase("arcsin", typeof(Arcsin))] + [TestCase("arccos", typeof(Arccos))] + [TestCase("arctan", typeof(Arctan))] + [TestCase("arctg", typeof(Arctan))] + [TestCase("arccot", typeof(Arccot))] + [TestCase("arcctg", typeof(Arccot))] + [TestCase("arcsec", typeof(Arcsec))] + [TestCase("arccosec", typeof(Arccsc))] + [TestCase("arccsc", typeof(Arccsc))] + [TestCase("sh", typeof(Sinh))] + [TestCase("sinh", typeof(Sinh))] + [TestCase("ch", typeof(Cosh))] + [TestCase("cosh", typeof(Cosh))] + [TestCase("th", typeof(Tanh))] + [TestCase("tanh", typeof(Tanh))] + [TestCase("cth", typeof(Coth))] + [TestCase("coth", typeof(Coth))] + [TestCase("sech", typeof(Sech))] + [TestCase("csch", typeof(Csch))] + [TestCase("arsh", typeof(Arsinh))] + [TestCase("arsinh", typeof(Arsinh))] + [TestCase("arch", typeof(Arcosh))] + [TestCase("arcosh", typeof(Arcosh))] + [TestCase("arth", typeof(Artanh))] + [TestCase("artanh", typeof(Artanh))] + [TestCase("arcth", typeof(Arcoth))] + [TestCase("arcoth", typeof(Arcoth))] + [TestCase("arsch", typeof(Arsech))] + [TestCase("arsech", typeof(Arsech))] + [TestCase("arcsch", typeof(Arcsch))] + [TestCase("round", typeof(Round))] + [TestCase("floor", typeof(Floor))] + [TestCase("ceil", typeof(Ceil))] + [TestCase("trunc", typeof(Trunc))] + [TestCase("truncate", typeof(Trunc))] + [TestCase("frac", typeof(Frac))] + [TestCase("transpose", typeof(Transpose))] + [TestCase("det", typeof(Determinant))] + [TestCase("determinant", typeof(Determinant))] + [TestCase("inverse", typeof(Inverse))] + [TestCase("dotproduct", typeof(DotProduct))] + [TestCase("crossproduct", typeof(CrossProduct))] + [TestCase("im", typeof(Im))] + [TestCase("imaginary", typeof(Im))] + [TestCase("re", typeof(Re))] + [TestCase("real", typeof(Re))] + [TestCase("phase", typeof(Phase))] + [TestCase("conjugate", typeof(Conjugate))] + [TestCase("reciprocal", typeof(Reciprocal))] + [TestCase("tocomplex", typeof(ToComplex))] + [TestCase("sign", typeof(Sign))] + [TestCase("tobin", typeof(ToBin))] + [TestCase("tooct", typeof(ToOct))] + [TestCase("tohex", typeof(ToHex))] public void LambdaParametersTest(string function, Type type) { var parameters = new ExpressionParameters(); var lambda = (Lambda)parameters[function].Value; - Assert.IsType(type, lambda.Body); + Assert.That(lambda.Body, Is.InstanceOf(type)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Parameters/ParameterTest.cs b/xFunc.Tests/Expressions/Parameters/ParameterTest.cs index 43d5a7f0e..316ed8b8b 100644 --- a/xFunc.Tests/Expressions/Parameters/ParameterTest.cs +++ b/xFunc.Tests/Expressions/Parameters/ParameterTest.cs @@ -7,152 +7,152 @@ namespace xFunc.Tests.Expressions.Parameters; public class ParameterTest { - [Fact] + [Test] public void DoubleCtor() { var value = 1.0; var x = new Parameter("x", value); var expected = new NumberValue(value); - Assert.Equal(expected, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void NumberCtor() { var value = new NumberValue(1.0); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void AngleValueCtor() { var value = AngleValue.Degree(1.0); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void PowerValueCtor() { var value = PowerValue.Watt(1.0); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void TemperatureValueCtor() { var value = TemperatureValue.Celsius(10); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void MassValueCtor() { var value = MassValue.Gram(10); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void LengthValueCtor() { var value = LengthValue.Meter(10); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void TimeValueCtor() { var value = TimeValue.Second(10); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void AreaValueCtor() { var value = AreaValue.Meter(10); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void VolumeValueCtor() { var value = VolumeValue.Meter(10); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void ComplexCtor() { var value = new Complex(1, 2); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void BoolCtor() { var value = true; var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void VectorCtor() { var value = VectorValue.Create(NumberValue.One); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void MatrixCtor() { var value = MatrixValue.Create(NumberValue.One); var x = new Parameter("x", value); - Assert.Equal(value, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(value)); } - [Fact] + [Test] public void StringCtor() { var str = "hello"; var x = new Parameter("x", str); - Assert.Equal(str, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(str)); } - [Fact] + [Test] public void RationalCtor() { var rational = new RationalValue(1, 3); var x = new Parameter("x", rational); - Assert.Equal(rational, x.Value); + Assert.That(x.Value.Value, Is.EqualTo(rational)); } - [Fact] + [Test] public void NullEqual() { var parameter = new Parameter("x", 1); @@ -161,7 +161,7 @@ public void NullEqual() Assert.False(isEqual); } - [Fact] + [Test] public void RefEqualEqual() { var parameter = new Parameter("x", 1); @@ -170,7 +170,7 @@ public void RefEqualEqual() Assert.True(isEqual); } - [Fact] + [Test] public void EqualObjectEqual() { var parameter1 = new Parameter("x", 1); @@ -180,7 +180,7 @@ public void EqualObjectEqual() Assert.True(isEqual); } - [Fact] + [Test] public void OtherType() { var parameter = new Parameter("x", 1); @@ -190,7 +190,7 @@ public void OtherType() Assert.False(isEqual); } - [Fact] + [Test] public void EqualParameters() { var parameter1 = new Parameter("x", 1); @@ -200,7 +200,7 @@ public void EqualParameters() Assert.True(isEqual); } - [Fact] + [Test] public void NotEqualKey() { var parameter1 = new Parameter("x", 1); @@ -210,7 +210,7 @@ public void NotEqualKey() Assert.False(isEqual); } - [Fact] + [Test] public void NotEqualValue() { var parameter1 = new Parameter("x", 1); @@ -220,7 +220,7 @@ public void NotEqualValue() Assert.False(isEqual); } - [Fact] + [Test] public void EqualOperatorTest() { var x = new Parameter("x", 1); @@ -229,7 +229,7 @@ public void EqualOperatorTest() Assert.True(x == y); } - [Fact] + [Test] public void NotEqualOperatorTest() { var x = new Parameter("x", 1); @@ -238,7 +238,7 @@ public void NotEqualOperatorTest() Assert.True(x != y); } - [Fact] + [Test] public void GreaterTest() { var parameter1 = new Parameter("x", 1); @@ -247,7 +247,7 @@ public void GreaterTest() Assert.True(parameter1 > parameter2); } - [Fact] + [Test] public void GreaterLeftNullTest() { var parameter2 = new Parameter("a", 2); @@ -255,7 +255,7 @@ public void GreaterLeftNullTest() Assert.False(null > parameter2); } - [Fact] + [Test] public void GreaterRightNullTest() { var parameter1 = new Parameter("x", 1); @@ -263,7 +263,7 @@ public void GreaterRightNullTest() Assert.False(parameter1 > null); } - [Fact] + [Test] public void LessTest() { var parameter1 = new Parameter("x", 1); @@ -272,7 +272,7 @@ public void LessTest() Assert.True(parameter1 < parameter2); } - [Fact] + [Test] public void LessLeftNullTest() { var parameter2 = new Parameter("y", 2); @@ -280,7 +280,7 @@ public void LessLeftNullTest() Assert.False(null < parameter2); } - [Fact] + [Test] public void LessRightNullTest() { var parameter1 = new Parameter("x", 1); @@ -288,7 +288,7 @@ public void LessRightNullTest() Assert.False(parameter1 < null); } - [Fact] + [Test] public void GreaterOrEqualTest() { var parameter1 = new Parameter("x", 1); @@ -297,7 +297,7 @@ public void GreaterOrEqualTest() Assert.True(parameter1 >= parameter2); } - [Fact] + [Test] public void LessOrEqualTest() { var parameter1 = new Parameter("x", 1); @@ -306,28 +306,28 @@ public void LessOrEqualTest() Assert.True(parameter1 <= parameter2); } - [Fact] + [Test] public void CompareToNullTest() { var parameter = new Parameter("x", 1); var result = parameter.CompareTo(null); - Assert.Equal(1, result); + Assert.That(result, Is.EqualTo(1)); } - [Fact] + [Test] public void EmptyKeyTest() { Assert.Throws(() => new Parameter(string.Empty, 1.0)); } - [Fact] + [Test] public void SetNullValueTest() { Assert.Throws(() => new Parameter("x", (string)null)); } - [Fact] + [Test] public void EditConstantParameterTest() { var parameter = new Parameter("x", 1.0, ParameterType.Constant); @@ -335,7 +335,7 @@ public void EditConstantParameterTest() Assert.Throws(() => parameter.Value = 3.0); } - [Fact] + [Test] public void EditReadonlyParameterTest() { var parameter = new Parameter("x", 1.0, ParameterType.ReadOnly); @@ -343,13 +343,13 @@ public void EditReadonlyParameterTest() Assert.Throws(() => parameter.Value = 3.0); } - [Fact] + [Test] public void ToStringTest() { var parameter = new Parameter("x", 1, ParameterType.Constant); var str = parameter.ToString(); var expected = "x: 1 (Constant)"; - Assert.Equal(expected, str); + Assert.That(str, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Parameters/ParameterValueTest.cs b/xFunc.Tests/Expressions/Parameters/ParameterValueTest.cs index 7535d1780..8d8eb0e92 100644 --- a/xFunc.Tests/Expressions/Parameters/ParameterValueTest.cs +++ b/xFunc.Tests/Expressions/Parameters/ParameterValueTest.cs @@ -5,38 +5,38 @@ namespace xFunc.Tests.Expressions.Parameters; public class ParameterValueTest { - [Fact] + [Test] public void EqualNullTest() { var value = new ParameterValue(1); - Assert.False(value.Equals(null as object)); + Assert.That(value.Equals(null as object), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var x = new ParameterValue(1); var y = new ParameterValue(1) as object; - Assert.True(x.Equals(y)); + Assert.That(x.Equals(y), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var x = new ParameterValue(1); var y = new ParameterValue(1); - Assert.True(x == y); + Assert.That(x == y, Is.True); } - [Fact] + [Test] public void NotEqualOperatorTest() { var x = new ParameterValue(1); var y = new ParameterValue(2); - Assert.True(x != y); + Assert.That(x != y, Is.True); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/PowTest.cs b/xFunc.Tests/Expressions/PowTest.cs index a778ccbe1..57eaeb808 100644 --- a/xFunc.Tests/Expressions/PowTest.cs +++ b/xFunc.Tests/Expressions/PowTest.cs @@ -7,90 +7,90 @@ namespace xFunc.Tests.Expressions; public class PowTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Pow(Number.Two, new Number(10)); var expected = new NumberValue(1024.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void NegativeExecuteTest1() { var exp = new Pow(new Number(-8), new Number(1 / 3.0)); var expected = new NumberValue(-2.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void NegativeNumberExecuteTest1() { var exp = new Pow(new Number(-25), new Number(1 / 2.0)); var result = (Complex)exp.Execute(); var expected = new Complex(0, 5); - Assert.Equal(expected.Real, result.Real, 14); - Assert.Equal(expected.Imaginary, result.Imaginary, 14); + Assert.That(result.Real, Is.EqualTo(expected.Real).Within(14)); + Assert.That(result.Imaginary, Is.EqualTo(expected.Imaginary).Within(14)); } - [Fact] + [Test] public void NegativeNumberExecuteTest2() { var exp = new Pow(new Number(-25), new Number(-1 / 2.0)); - Assert.Equal(new Complex(0, -0.2), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new Complex(0, -0.2))); } - [Fact] + [Test] public void NegativeNumberExecuteTest3() { var exp = new Pow(new Number(-5), Number.Two); - Assert.Equal(new NumberValue(25.0), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new NumberValue(25.0))); } - [Fact] + [Test] public void ExecuteTest2() { var complex1 = new Complex(3, 2); var complex2 = new Complex(4, 5); var exp = new Pow(new ComplexNumber(complex1), new ComplexNumber(complex2)); - Assert.Equal(Complex.Pow(complex1, complex2), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Pow(complex1, complex2))); } - [Fact] + [Test] public void ExecuteTest3() { var complex = new Complex(3, 2); var exp = new Pow(new ComplexNumber(complex), new Number(10)); - Assert.Equal(Complex.Pow(complex, 10), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Pow(complex, 10))); } - [Fact] + [Test] public void ExecuteTest4() { var complex1 = new Complex(-3, 2); var complex2 = new Complex(-4, 5); var exp = new Pow(new ComplexNumber(complex1), new ComplexNumber(complex2)); - Assert.Equal(Complex.Pow(complex1, complex2), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Pow(complex1, complex2))); } - [Fact] + [Test] public void ExecuteTest5() { var complex = new Complex(-3, 2); var exp = new Pow(new ComplexNumber(complex), new Number(10)); - Assert.Equal(Complex.Pow(complex, 10), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Pow(complex, 10))); } - [Fact] + [Test] public void ExecuteNumberAndComplexTest() { const int @base = 2; @@ -98,10 +98,10 @@ public void ExecuteNumberAndComplexTest() var exp = new Pow(new Number(@base), new ComplexNumber(complex)); var expected = Complex.Pow(@base, complex); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndNumberTest() { var exp = new Pow( @@ -109,19 +109,19 @@ public void ExecuteRationalAndNumberTest() new Number(3)); var expected = new RationalValue(8, 27); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteWrongArgumentTypeTest() => TestNotSupported(new Pow(Bool.True, Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new Pow(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/AddAssignTest.cs b/xFunc.Tests/Expressions/Programming/AddAssignTest.cs index 3e97eae63..81ba1ac8a 100644 --- a/xFunc.Tests/Expressions/Programming/AddAssignTest.cs +++ b/xFunc.Tests/Expressions/Programming/AddAssignTest.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.Expressions.Programming; public class AddAssignTest { - [Fact] + [Test] public void NullVariableTest() { Assert.Throws(() => new AddAssign(null, null)); } - [Fact] + [Test] public void NullExpTest() { Assert.Throws(() => new AddAssign(Variable.X, null)); } - [Fact] + [Test] public void AddAssignCalc() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -25,22 +25,22 @@ public void AddAssignCalc() var result = add.Execute(parameters); var expected = new NumberValue(12.0); - Assert.Equal(expected, result); - Assert.Equal(expected, parameters["x"]); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddAssignAsExpressionTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var add = new Add(Number.One, new AddAssign(Variable.X, Number.Two)); var result = add.Execute(parameters); - Assert.Equal(new NumberValue(13.0), result); - Assert.Equal(new NumberValue(12.0), parameters["x"]); + Assert.That(result, Is.EqualTo(new NumberValue(13.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(12.0))); } - [Fact] + [Test] public void AddNullParameters() { var exp = new AddAssign(Variable.X, Number.One); @@ -48,7 +48,7 @@ public void AddNullParameters() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void SubValueBoolParameters() { var exp = new AddAssign(Variable.X, Bool.False); @@ -57,7 +57,7 @@ public void SubValueBoolParameters() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void BoolAddNumberTest() { var parameters = new ExpressionParameters { new Parameter("x", true) }; @@ -66,7 +66,7 @@ public void BoolAddNumberTest() Assert.Throws(() => add.Execute(parameters)); } - [Fact] + [Test] public void SameEqualsTest() { var exp = new AddAssign(Variable.X, Number.One); @@ -74,7 +74,7 @@ public void SameEqualsTest() Assert.True(exp.Equals(exp)); } - [Fact] + [Test] public void EqualsNullTest() { var exp = new AddAssign(Variable.X, Number.One); @@ -82,7 +82,7 @@ public void EqualsNullTest() Assert.False(exp.Equals(null)); } - [Fact] + [Test] public void EqualsDifferentTypeTest() { var exp1 = new AddAssign(Variable.X, Number.One); @@ -91,7 +91,7 @@ public void EqualsDifferentTypeTest() Assert.False(exp1.Equals(exp2)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new AddAssign(Variable.X, Number.One); @@ -99,7 +99,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new AddAssign(Variable.X, Number.One); @@ -107,12 +107,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new AddAssign(Variable.X, Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/ConditionalAndTest.cs b/xFunc.Tests/Expressions/Programming/ConditionalAndTest.cs index 6b3efc0eb..09d39ab9e 100644 --- a/xFunc.Tests/Expressions/Programming/ConditionalAndTest.cs +++ b/xFunc.Tests/Expressions/Programming/ConditionalAndTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class ConditionalAndTest { - [Fact] + [Test] public void CalculateAndTrueTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; @@ -13,10 +13,10 @@ public void CalculateAndTrueTest() var greaterThen = new GreaterThan(Variable.X, new Number(-10)); var and = new ConditionalAnd(lessThen, greaterThen); - Assert.True((bool) and.Execute(parameters)); + Assert.That((bool) and.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateAndFalseTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; @@ -24,10 +24,10 @@ public void CalculateAndFalseTest() var greaterThen = new GreaterThan(Variable.X, new Number(10)); var and = new ConditionalAnd(lessThen, greaterThen); - Assert.False((bool) and.Execute(parameters)); + Assert.That((bool) and.Execute(parameters), Is.False); } - [Fact] + [Test] public void CalculateInvalidParametersTest() { var and = new ConditionalAnd(Number.One, Number.Two); @@ -35,7 +35,7 @@ public void CalculateInvalidParametersTest() Assert.Throws(() => and.Execute()); } - [Fact] + [Test] public void CloneTest() { var lessThen = new LessThan(Variable.X, new Number(10)); @@ -43,6 +43,6 @@ public void CloneTest() var exp = new ConditionalAnd(lessThen, greaterThen); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/ConditionalOrTest.cs b/xFunc.Tests/Expressions/Programming/ConditionalOrTest.cs index 9a4fc4c78..8c72d514f 100644 --- a/xFunc.Tests/Expressions/Programming/ConditionalOrTest.cs +++ b/xFunc.Tests/Expressions/Programming/ConditionalOrTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class ConditionalOrTest { - [Fact] + [Test] public void CalculateOrTrueTest1() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; @@ -16,7 +16,7 @@ public void CalculateOrTrueTest1() Assert.True((bool) or.Execute(parameters)); } - [Fact] + [Test] public void CalculateOrTrueTest2() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; @@ -27,7 +27,7 @@ public void CalculateOrTrueTest2() Assert.True((bool) or.Execute(parameters)); } - [Fact] + [Test] public void ExecuteInvalidParametersTest() { var or = new ConditionalOr(Number.One, Number.Two); @@ -35,7 +35,7 @@ public void ExecuteInvalidParametersTest() Assert.Throws(() => or.Execute()); } - [Fact] + [Test] public void CloneTest() { var lessThen = new LessThan(Variable.X, new Number(10)); @@ -43,6 +43,6 @@ public void CloneTest() var exp = new ConditionalOr(lessThen, greaterThen); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/DecTest.cs b/xFunc.Tests/Expressions/Programming/DecTest.cs index 0a9d86dda..51179faaa 100644 --- a/xFunc.Tests/Expressions/Programming/DecTest.cs +++ b/xFunc.Tests/Expressions/Programming/DecTest.cs @@ -5,11 +5,11 @@ namespace xFunc.Tests.Expressions.Programming; public class DecTest { - [Fact] + [Test] public void NullCtorTest() => Assert.Throws(() => new Dec(null)); - [Fact] + [Test] public void DecCalcTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -17,28 +17,28 @@ public void DecCalcTest() var result = (NumberValue)dec.Execute(parameters); var expected = new NumberValue(9.0); - Assert.Equal(expected, result); - Assert.Equal(expected, parameters["x"]); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void DecAsExpExecuteTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var inc = new Add(Number.One, new Dec(Variable.X)); var result = (NumberValue)inc.Execute(parameters); - Assert.Equal(new NumberValue(10.0), result); - Assert.Equal(new NumberValue(9.0), parameters["x"]); + Assert.That(result, Is.EqualTo(new NumberValue(10.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(9.0))); } - [Fact] + [Test] public void DecNullParameters() { Assert.Throws(() => new Dec(Variable.X).Execute()); } - [Fact] + [Test] public void DecBoolTest() { var parameters = new ExpressionParameters { new Parameter("x", true) }; @@ -47,32 +47,32 @@ public void DecBoolTest() Assert.Throws(() => dec.Execute(parameters)); } - [Fact] + [Test] public void SameEqualsTest() { var dec = new Dec(Variable.X); - Assert.True(dec.Equals(dec)); + Assert.That(dec.Equals(dec), Is.True); } - [Fact] + [Test] public void EqualsNullTest() { var dec = new Dec(Variable.X); - Assert.False(dec.Equals(null)); + Assert.That(dec.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsDifferentTypeTest() { var dec = new Dec(Variable.X); var inc = new Inc(Variable.X); - Assert.False(dec.Equals(inc)); + Assert.That(dec.Equals(inc), Is.False); } - [Fact] + [Test] public void NullAnalyzerTest1() { var inc = new Dec(Variable.X); @@ -80,7 +80,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => inc.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var inc = new Dec(Variable.X); @@ -88,12 +88,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => inc.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new Dec(Variable.X); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/DivAssignTest.cs b/xFunc.Tests/Expressions/Programming/DivAssignTest.cs index c9940c452..fd09fb382 100644 --- a/xFunc.Tests/Expressions/Programming/DivAssignTest.cs +++ b/xFunc.Tests/Expressions/Programming/DivAssignTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class DivAssignTest { - [Fact] + [Test] public void DivAssignCalc() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -13,22 +13,22 @@ public void DivAssignCalc() var result = div.Execute(parameters); var expected = new NumberValue(5.0); - Assert.Equal(expected, result); - Assert.Equal(expected, parameters["x"]); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivAssignAsExpressionTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var add = new Add(new DivAssign(Variable.X, Number.Two), Number.Two); var result = add.Execute(parameters); - Assert.Equal(new NumberValue(7.0), result); - Assert.Equal(new NumberValue(5.0), parameters["x"]); + Assert.That(result, Is.EqualTo(new NumberValue(7.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(5.0))); } - [Fact] + [Test] public void DivNullParameters() { var exp = new DivAssign(Variable.X, Number.One); @@ -36,7 +36,7 @@ public void DivNullParameters() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void DivValueBoolParameters() { var exp = new DivAssign(Variable.X, Bool.False); @@ -45,7 +45,7 @@ public void DivValueBoolParameters() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void BoolDivNumberTest() { var parameters = new ExpressionParameters { new Parameter("x", true) }; @@ -54,32 +54,32 @@ public void BoolDivNumberTest() Assert.Throws(() => add.Execute(parameters)); } - [Fact] + [Test] public void SameEqualsTest() { var exp = new DivAssign(Variable.X, Number.One); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualsNullTest() { var exp = new DivAssign(Variable.X, Number.One); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsDifferentTypeTest() { var exp1 = new DivAssign(Variable.X, Number.One); var exp2 = new MulAssign(Variable.X, Number.One); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new DivAssign(Variable.X, Number.One); @@ -87,7 +87,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new DivAssign(Variable.X, Number.One); @@ -95,12 +95,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new DivAssign(Variable.X, Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/EqualTest.cs b/xFunc.Tests/Expressions/Programming/EqualTest.cs index b40396e42..82af1d4e7 100644 --- a/xFunc.Tests/Expressions/Programming/EqualTest.cs +++ b/xFunc.Tests/Expressions/Programming/EqualTest.cs @@ -5,16 +5,16 @@ namespace xFunc.Tests.Expressions.Programming; public class EqualTest { - [Fact] + [Test] public void NumberEqualTest() { var equal = new Equal(new Number(10), new Number(10)); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void NumberVarEqualTest() { var parameters = new ExpressionParameters @@ -25,19 +25,19 @@ public void NumberVarEqualTest() var equal = new Equal(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void BoolTrueEqualTest() { var equal = new Equal(Bool.True, Bool.True); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void BoolTrueVarEqualTest() { var parameters = new ExpressionParameters @@ -48,19 +48,19 @@ public void BoolTrueVarEqualTest() var equal = new Equal(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void BoolTrueAndFalseEqualTest() { var equal = new Equal(Bool.True, Bool.False); var result = (bool)equal.Execute(); - Assert.False(result); + Assert.That(result, Is.False); } - [Fact] + [Test] public void BoolTrueAndFalseVarEqualTest() { var parameters = new ExpressionParameters @@ -71,19 +71,19 @@ public void BoolTrueAndFalseVarEqualTest() var equal = new Equal(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.False(result); + Assert.That(result, Is.False); } - [Fact] + [Test] public void BoolFalseEqualTest() { var equal = new Equal(Bool.False, Bool.False); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void BoolFalseVarEqualTest() { var parameters = new ExpressionParameters @@ -94,10 +94,10 @@ public void BoolFalseVarEqualTest() var equal = new Equal(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void AngleEqualTest() { var equal = new Equal( @@ -106,10 +106,10 @@ public void AngleEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void PowerEqualTest() { var equal = new Equal( @@ -118,10 +118,10 @@ public void PowerEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void TemperatureEqualTest() { var equal = new Equal( @@ -130,10 +130,10 @@ public void TemperatureEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void MassEqualTest() { var equal = new Equal( @@ -142,10 +142,10 @@ public void MassEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LengthEqualTest() { var equal = new Equal( @@ -154,10 +154,10 @@ public void LengthEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void TimeEqualTest() { var equal = new Equal( @@ -166,10 +166,10 @@ public void TimeEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void AreaEqualTest() { var equal = new Equal( @@ -178,10 +178,10 @@ public void AreaEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void VolumeEqualTest() { var equal = new Equal( @@ -190,10 +190,10 @@ public void VolumeEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void CalculateInvalidParametersTest() { var equal = new Equal(new ComplexNumber(3, 2), new ComplexNumber(3, 2)); @@ -201,12 +201,12 @@ public void CalculateInvalidParametersTest() Assert.Throws(() => equal.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new Equal(Number.Two, new Number(3)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/ForTest.cs b/xFunc.Tests/Expressions/Programming/ForTest.cs index a8b74f8c0..214d6d590 100644 --- a/xFunc.Tests/Expressions/Programming/ForTest.cs +++ b/xFunc.Tests/Expressions/Programming/ForTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class ForTest { - [Fact] + [Test] public void CalculateForTest() { var parameters = new ExpressionParameters(); @@ -17,10 +17,10 @@ public void CalculateForTest() var @for = new For(new Variable("i"), init, cond, iter); @for.Execute(parameters); - Assert.Equal(new NumberValue(10.0), parameters["i"]); + Assert.That(parameters["i"].Value, Is.EqualTo(new NumberValue(10.0))); } - [Fact] + [Test] public void CloneTest() { var init = new Assign(new Variable("i"), Number.Zero); @@ -30,6 +30,6 @@ public void CloneTest() var exp = new For(new Variable("i"), init, cond, iter); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/GreaterOrEqualTest.cs b/xFunc.Tests/Expressions/Programming/GreaterOrEqualTest.cs index 24a96e66f..9681ac082 100644 --- a/xFunc.Tests/Expressions/Programming/GreaterOrEqualTest.cs +++ b/xFunc.Tests/Expressions/Programming/GreaterOrEqualTest.cs @@ -5,34 +5,34 @@ namespace xFunc.Tests.Expressions.Programming; public class GreaterOrEqualTest { - [Fact] + [Test] public void CalculateGreaterTrueTest1() { var parameters = new ExpressionParameters { new Parameter("x", 463) }; var greaterOrEqual = new GreaterOrEqual(Variable.X, new Number(10)); - Assert.True((bool)greaterOrEqual.Execute(parameters)); + Assert.That((bool)greaterOrEqual.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateGreaterTrueTest2() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var greaterOrEqual = new GreaterOrEqual(Variable.X, new Number(10)); - Assert.True((bool)greaterOrEqual.Execute(parameters)); + Assert.That((bool)greaterOrEqual.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateGreaterFalseTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; var greaterOrEqual = new GreaterOrEqual(Variable.X, new Number(10)); - Assert.False((bool)greaterOrEqual.Execute(parameters)); + Assert.That((bool)greaterOrEqual.Execute(parameters), Is.False); } - [Fact] + [Test] public void GreaterOrEqualAngleTest() { var exp = new GreaterOrEqual( @@ -41,10 +41,10 @@ public void GreaterOrEqualAngleTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualPowerTest() { var exp = new GreaterOrEqual( @@ -53,10 +53,10 @@ public void GreaterOrEqualPowerTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTemperatureTest() { var exp = new GreaterOrEqual( @@ -65,10 +65,10 @@ public void GreaterOrEqualTemperatureTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualMassTest() { var exp = new GreaterOrEqual( @@ -77,10 +77,10 @@ public void GreaterOrEqualMassTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualLengthTest() { var exp = new GreaterOrEqual( @@ -89,10 +89,10 @@ public void GreaterOrEqualLengthTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTimeTest() { var exp = new GreaterOrEqual( @@ -101,10 +101,10 @@ public void GreaterOrEqualTimeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualAreaTest() { var exp = new GreaterOrEqual( @@ -113,10 +113,10 @@ public void GreaterOrEqualAreaTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterOrEqualVolumeTest() { var exp = new GreaterOrEqual( @@ -125,10 +125,10 @@ public void GreaterOrEqualVolumeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void CalculateInvalidTypeTest() { var greaterOrEqual = new GreaterOrEqual(Bool.True, Bool.True); @@ -136,12 +136,12 @@ public void CalculateInvalidTypeTest() Assert.Throws(() => greaterOrEqual.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new GreaterOrEqual(Number.Two, new Number(3)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/GreaterTest.cs b/xFunc.Tests/Expressions/Programming/GreaterTest.cs index 02910d792..77413406c 100644 --- a/xFunc.Tests/Expressions/Programming/GreaterTest.cs +++ b/xFunc.Tests/Expressions/Programming/GreaterTest.cs @@ -5,25 +5,25 @@ namespace xFunc.Tests.Expressions.Programming; public class GreaterTest { - [Fact] + [Test] public void CalculateGreaterTrueTest() { var parameters = new ExpressionParameters { new Parameter("x", 463) }; var greaterThen = new GreaterThan(Variable.X, new Number(10)); - Assert.True((bool)greaterThen.Execute(parameters)); + Assert.That((bool)greaterThen.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateGreaterFalseTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; var greaterThan = new GreaterThan(Variable.X, new Number(10)); - Assert.False((bool)greaterThan.Execute(parameters)); + Assert.That((bool)greaterThan.Execute(parameters), Is.False); } - [Fact] + [Test] public void GreaterAngleTest() { var exp = new GreaterThan( @@ -32,10 +32,10 @@ public void GreaterAngleTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterPowerTest() { var exp = new GreaterThan( @@ -44,10 +44,10 @@ public void GreaterPowerTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterTemperatureTest() { var exp = new GreaterThan( @@ -56,10 +56,10 @@ public void GreaterTemperatureTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterMassTest() { var exp = new GreaterThan( @@ -68,10 +68,10 @@ public void GreaterMassTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterLengthTest() { var exp = new GreaterThan( @@ -80,10 +80,10 @@ public void GreaterLengthTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterTimeTest() { var exp = new GreaterThan( @@ -92,10 +92,10 @@ public void GreaterTimeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterAreaTest() { var exp = new GreaterThan( @@ -104,10 +104,10 @@ public void GreaterAreaTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void GreaterVolumeTest() { var exp = new GreaterThan( @@ -116,10 +116,10 @@ public void GreaterVolumeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void CalculateInvalidTypeTest() { var greaterThan = new GreaterThan(Bool.True, Bool.True); @@ -127,12 +127,12 @@ public void CalculateInvalidTypeTest() Assert.Throws(() => greaterThan.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new GreaterThan(Number.Two, new Number(3)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/IfTest.cs b/xFunc.Tests/Expressions/Programming/IfTest.cs index c61c6a983..088535844 100644 --- a/xFunc.Tests/Expressions/Programming/IfTest.cs +++ b/xFunc.Tests/Expressions/Programming/IfTest.cs @@ -7,7 +7,7 @@ namespace xFunc.Tests.Expressions.Programming; public class IfTest : BaseExpressionTests { - [Fact] + [Test] public void CtorMaxParametersExceeded() => Assert.Throws(() => new If(new IExpression[] { @@ -18,7 +18,7 @@ public void CtorMaxParametersExceeded() Variable.X, }.ToImmutableArray())); - [Fact] + [Test] public void CalculateIfElseTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -26,14 +26,14 @@ public void CalculateIfElseTest() var cond = new Equal(Variable.X, new Number(10)); var @if = new If(cond, new Number(20), Number.Zero); - Assert.Equal(new NumberValue(20.0), @if.Execute(parameters)); + Assert.That(@if.Execute(parameters), Is.EqualTo(new NumberValue(20.0))); parameters["x"] = new NumberValue(0.0); - Assert.Equal(new NumberValue(0.0), @if.Execute(parameters)); + Assert.That(@if.Execute(parameters), Is.EqualTo(new NumberValue(0.0))); } - [Fact] + [Test] public void CalculateIfElseNegativeNumberTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; @@ -41,14 +41,14 @@ public void CalculateIfElseNegativeNumberTest() var cond = new Equal(Variable.X, Number.Zero); var @if = new If(cond, Number.One, new UnaryMinus(Number.One)); - Assert.Equal(new NumberValue(1.0), @if.Execute(parameters)); + Assert.That(@if.Execute(parameters), Is.EqualTo(new NumberValue(1.0))); parameters["x"] = new NumberValue(10); - Assert.Equal(new NumberValue(-1.0), @if.Execute(parameters)); + Assert.That(@if.Execute(parameters), Is.EqualTo(new NumberValue(-1.0))); } - [Fact] + [Test] public void CalculateIfTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -56,10 +56,10 @@ public void CalculateIfTest() var cond = new Equal(Variable.X, new Number(10)); var @if = new If(cond, new Number(20)); - Assert.Equal(new NumberValue(20.0), @if.Execute(parameters)); + Assert.That(@if.Execute(parameters), Is.EqualTo(new NumberValue(20.0))); } - [Fact] + [Test] public void CalculateElseTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; @@ -68,19 +68,19 @@ public void CalculateElseTest() var @if = new If(cond, new Number(20)); var expected = new NumberValue(0.0); - Assert.Equal(expected, @if.Execute(parameters)); + Assert.That(@if.Execute(parameters), Is.EqualTo(expected)); } - [Fact] + [Test] public void CloneTest() { var exp = new If(new Equal(Variable.X, new Number(10)), new Number(3), Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void ConditionIsNotBoolTest() { var exp = new If(Number.One, Number.One, Number.One); diff --git a/xFunc.Tests/Expressions/Programming/IncTest.cs b/xFunc.Tests/Expressions/Programming/IncTest.cs index 4c5aad508..b1fd2337c 100644 --- a/xFunc.Tests/Expressions/Programming/IncTest.cs +++ b/xFunc.Tests/Expressions/Programming/IncTest.cs @@ -5,11 +5,11 @@ namespace xFunc.Tests.Expressions.Programming; public class IncTest { - [Fact] + [Test] public void NullCtorTest() => Assert.Throws(() => new Inc(null)); - [Fact] + [Test] public void IncCalcTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -17,28 +17,28 @@ public void IncCalcTest() var result = (NumberValue)inc.Execute(parameters); var expected = new NumberValue(11.0); - Assert.Equal(expected, result); - Assert.Equal(expected, parameters["x"]); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void IncAsExpExecuteTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var inc = new Add(Number.One, new Inc(Variable.X)); var result = (NumberValue)inc.Execute(parameters); - Assert.Equal(new NumberValue(12.0), result); - Assert.Equal(new NumberValue(11.0), parameters["x"]); + Assert.That(result, Is.EqualTo(new NumberValue(12.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(11.0))); } - [Fact] + [Test] public void IncNullParameters() { Assert.Throws(() => new Inc(Variable.X).Execute()); } - [Fact] + [Test] public void IncBoolTest() { var parameters = new ExpressionParameters { new Parameter("x", true) }; @@ -47,32 +47,32 @@ public void IncBoolTest() Assert.Throws(() => inc.Execute(parameters)); } - [Fact] + [Test] public void SameEqualsTest() { var inc = new Inc(Variable.X); - Assert.True(inc.Equals(inc)); + Assert.That(inc.Equals(inc), Is.True); } - [Fact] + [Test] public void EqualsNullTest() { var inc = new Inc(Variable.X); - Assert.False(inc.Equals(null)); + Assert.That(inc.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsDifferentTypeTest() { var inc = new Inc(Variable.X); var dec = new Dec(Variable.X); - Assert.False(inc.Equals(dec)); + Assert.That(inc.Equals(dec), Is.False); } - [Fact] + [Test] public void NullAnalyzerTest1() { var inc = new Inc(Variable.X); @@ -80,7 +80,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => inc.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var inc = new Inc(Variable.X); @@ -88,12 +88,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => inc.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new Inc(Variable.X); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/LeftShiftAssignTest.cs b/xFunc.Tests/Expressions/Programming/LeftShiftAssignTest.cs index 3d02f43f6..1641e2bfe 100644 --- a/xFunc.Tests/Expressions/Programming/LeftShiftAssignTest.cs +++ b/xFunc.Tests/Expressions/Programming/LeftShiftAssignTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class LeftShiftAssignTest { - [Fact] + [Test] public void ExecuteTest() { var exp = new LeftShiftAssign(Variable.X, new Number(10)); @@ -16,10 +16,10 @@ public void ExecuteTest() var actual = exp.Execute(parameters); var expected = new NumberValue(1024.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAsExpressionTest() { var exp = new Add(Number.One, new LeftShiftAssign(Variable.X, new Number(10))); @@ -29,11 +29,11 @@ public void ExecuteAsExpressionTest() }; var actual = exp.Execute(parameters); - Assert.Equal(new NumberValue(1025.0), actual); - Assert.Equal(new NumberValue(1024.0), parameters["x"]); + Assert.That(actual, Is.EqualTo(new NumberValue(1025.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(1024.0))); } - [Fact] + [Test] public void ExecuteNullParamsTest() { var exp = new LeftShiftAssign(Variable.X, new Number(10)); @@ -41,7 +41,7 @@ public void ExecuteNullParamsTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteDoubleLeftTest() { var exp = new LeftShiftAssign(Variable.X, new Number(10)); @@ -53,7 +53,7 @@ public void ExecuteDoubleLeftTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void ExecuteDoubleRightTest() { var exp = new LeftShiftAssign(Variable.X, new Number(10.1)); @@ -65,7 +65,7 @@ public void ExecuteDoubleRightTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void ExecuteBoolRightTest() { var exp = new LeftShiftAssign(Variable.X, Bool.True); @@ -77,7 +77,7 @@ public void ExecuteBoolRightTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void ExecuteBoolLeftTest() { var exp = new LeftShiftAssign(Variable.X, Bool.True); @@ -89,12 +89,12 @@ public void ExecuteBoolLeftTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void CloneTest() { var exp = new LeftShiftAssign(Variable.X, new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/LeftShiftTest.cs b/xFunc.Tests/Expressions/Programming/LeftShiftTest.cs index 9d2005d2b..4a6a989b1 100644 --- a/xFunc.Tests/Expressions/Programming/LeftShiftTest.cs +++ b/xFunc.Tests/Expressions/Programming/LeftShiftTest.cs @@ -5,17 +5,17 @@ namespace xFunc.Tests.Expressions.Programming; public class LeftShiftTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new LeftShift(Number.One, new Number(10)); var actual = exp.Execute(); var expected = new NumberValue(1024.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDoubleLeftTest() { var exp = new LeftShift(new Number(1.5), new Number(10)); @@ -23,7 +23,7 @@ public void ExecuteDoubleLeftTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteDoubleRightTest() { var exp = new LeftShift(Number.One, new Number(10.1)); @@ -31,16 +31,16 @@ public void ExecuteDoubleRightTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new LeftShift(Bool.False, Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new LeftShift(Number.One, new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/LessOrEqualTest.cs b/xFunc.Tests/Expressions/Programming/LessOrEqualTest.cs index 93a392e12..c46b26b05 100644 --- a/xFunc.Tests/Expressions/Programming/LessOrEqualTest.cs +++ b/xFunc.Tests/Expressions/Programming/LessOrEqualTest.cs @@ -5,34 +5,34 @@ namespace xFunc.Tests.Expressions.Programming; public class LessOrEqualTest { - [Fact] + [Test] public void CalculateLessTrueTest1() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; var lessOrEqual = new LessOrEqual(Variable.X, new Number(10)); - Assert.True((bool)lessOrEqual.Execute(parameters)); + Assert.That((bool)lessOrEqual.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateLessTrueTest2() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var lessOrEqual = new LessOrEqual(Variable.X, new Number(10)); - Assert.True((bool)lessOrEqual.Execute(parameters)); + Assert.That((bool)lessOrEqual.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateLessFalseTest() { var parameters = new ExpressionParameters { new Parameter("x", 666) }; var lessOrEqual = new LessOrEqual(Variable.X, new Number(10)); - Assert.False((bool)lessOrEqual.Execute(parameters)); + Assert.That((bool)lessOrEqual.Execute(parameters), Is.False); } - [Fact] + [Test] public void LessOrEqualAngleTest() { var exp = new LessOrEqual( @@ -41,10 +41,10 @@ public void LessOrEqualAngleTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessOrEqualPowerTest() { var exp = new LessOrEqual( @@ -53,10 +53,10 @@ public void LessOrEqualPowerTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessOrEqualTemperatureTest() { var exp = new LessOrEqual( @@ -65,10 +65,10 @@ public void LessOrEqualTemperatureTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessOrEqualMassTest() { var exp = new LessOrEqual( @@ -77,10 +77,10 @@ public void LessOrEqualMassTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessOrEqualLengthTest() { var exp = new LessOrEqual( @@ -89,10 +89,10 @@ public void LessOrEqualLengthTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessOrEqualTimeTest() { var exp = new LessOrEqual( @@ -101,10 +101,10 @@ public void LessOrEqualTimeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessOrEqualAreaTest() { var exp = new LessOrEqual( @@ -116,7 +116,7 @@ public void LessOrEqualAreaTest() Assert.True(result); } - [Fact] + [Test] public void LessOrEqualVolumeTest() { var exp = new LessOrEqual( @@ -125,10 +125,10 @@ public void LessOrEqualVolumeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void CalculateInvalidTypeTest() { var lessOrEqual = new LessOrEqual(Bool.True, Bool.True); @@ -136,12 +136,12 @@ public void CalculateInvalidTypeTest() Assert.Throws(() => lessOrEqual.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new LessOrEqual(Number.Two, new Number(3)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/LessThanTest.cs b/xFunc.Tests/Expressions/Programming/LessThanTest.cs index b44ee6180..555f67d6a 100644 --- a/xFunc.Tests/Expressions/Programming/LessThanTest.cs +++ b/xFunc.Tests/Expressions/Programming/LessThanTest.cs @@ -5,25 +5,25 @@ namespace xFunc.Tests.Expressions.Programming; public class LessThanTest { - [Fact] + [Test] public void CalculateLessTrueTest() { var parameters = new ExpressionParameters { new Parameter("x", 0) }; var lessThen = new LessThan(Variable.X, new Number(10)); - Assert.True((bool)lessThen.Execute(parameters)); + Assert.That((bool)lessThen.Execute(parameters), Is.True); } - [Fact] + [Test] public void CalculateLessFalseTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var lessThen = new LessThan(Variable.X, new Number(10)); - Assert.False((bool)lessThen.Execute(parameters)); + Assert.That((bool)lessThen.Execute(parameters), Is.False); } - [Fact] + [Test] public void LessAngleTest() { var exp = new LessThan( @@ -32,10 +32,10 @@ public void LessAngleTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessPowerTest() { var exp = new LessThan( @@ -44,10 +44,10 @@ public void LessPowerTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessTemperatureTest() { var exp = new LessThan( @@ -56,10 +56,10 @@ public void LessTemperatureTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessMassTest() { var exp = new LessThan( @@ -68,10 +68,10 @@ public void LessMassTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessLengthTest() { var exp = new LessThan( @@ -80,10 +80,10 @@ public void LessLengthTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessTimeTest() { var exp = new LessThan( @@ -92,10 +92,10 @@ public void LessTimeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessAreaTest() { var exp = new LessThan( @@ -104,10 +104,10 @@ public void LessAreaTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LessVolumeTest() { var exp = new LessThan( @@ -116,10 +116,10 @@ public void LessVolumeTest() ); var result = (bool)exp.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void CalculateInvalidTypeTest() { var lessThen = new LessThan(Bool.True, Bool.True); @@ -127,12 +127,12 @@ public void CalculateInvalidTypeTest() Assert.Throws(() => lessThen.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new LessThan(Number.Two, new Number(3)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/MulAssignTest.cs b/xFunc.Tests/Expressions/Programming/MulAssignTest.cs index 28686670d..0248d75f1 100644 --- a/xFunc.Tests/Expressions/Programming/MulAssignTest.cs +++ b/xFunc.Tests/Expressions/Programming/MulAssignTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class MulAssignTest { - [Fact] + [Test] public void MulAssignCalc() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -13,22 +13,22 @@ public void MulAssignCalc() var result = mul.Execute(parameters); var expected = new NumberValue(20.0); - Assert.Equal(expected, result); - Assert.Equal(expected, parameters["x"]); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulAssignAsExpressionTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var add = new Add(Number.Two, new MulAssign(Variable.X, Number.Two)); var result = add.Execute(parameters); - Assert.Equal(new NumberValue(22.0), result); - Assert.Equal(new NumberValue(20.0), parameters["x"]); + Assert.That(result, Is.EqualTo(new NumberValue(22.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(20.0))); } - [Fact] + [Test] public void MulNullParameters() { var exp = new MulAssign(Variable.X, Number.One); @@ -36,7 +36,7 @@ public void MulNullParameters() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void MulValueBoolParameters() { var exp = new MulAssign(Variable.X, Bool.False); @@ -45,7 +45,7 @@ public void MulValueBoolParameters() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void BoolMulNumberTest() { var parameters = new ExpressionParameters { new Parameter("x", true) }; @@ -54,32 +54,32 @@ public void BoolMulNumberTest() Assert.Throws(() => mul.Execute(parameters)); } - [Fact] + [Test] public void SameEqualsTest() { var exp = new MulAssign(Variable.X, Number.One); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualsNullTest() { var exp = new MulAssign(Variable.X, Number.One); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsDifferentTypeTest() { var exp1 = new MulAssign(Variable.X, Number.One); var exp2 = new DivAssign(Variable.X, Number.One); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new MulAssign(Variable.X, Number.One); @@ -87,7 +87,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new MulAssign(Variable.X, Number.One); @@ -95,12 +95,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new MulAssign(Variable.X, Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/NotEqualTest.cs b/xFunc.Tests/Expressions/Programming/NotEqualTest.cs index 7d18f678f..fe3778a80 100644 --- a/xFunc.Tests/Expressions/Programming/NotEqualTest.cs +++ b/xFunc.Tests/Expressions/Programming/NotEqualTest.cs @@ -5,16 +5,16 @@ namespace xFunc.Tests.Expressions.Programming; public class NotEqualTest { - [Fact] + [Test] public void NumberEqualTest() { var equal = new NotEqual(new Number(11), new Number(10)); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void NumberVarEqualTest() { var parameters = new ExpressionParameters @@ -25,10 +25,10 @@ public void NumberVarEqualTest() var equal = new NotEqual(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void NumberAndBoolVarEqualTest() { var parameters = new ExpressionParameters @@ -41,16 +41,16 @@ public void NumberAndBoolVarEqualTest() Assert.Throws(() => equal.Execute(parameters)); } - [Fact] + [Test] public void BoolTrueEqualTest() { var equal = new NotEqual(Bool.True, Bool.True); var result = (bool)equal.Execute(); - Assert.False(result); + Assert.That(result, Is.False); } - [Fact] + [Test] public void BoolTrueVarEqualTest() { var parameters = new ExpressionParameters @@ -61,19 +61,19 @@ public void BoolTrueVarEqualTest() var equal = new NotEqual(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.False(result); + Assert.That(result, Is.False); } - [Fact] + [Test] public void BoolTrueAndFalseEqualTest() { var equal = new NotEqual(Bool.True, Bool.False); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void BoolTrueAndFalseVarEqualTest() { var parameters = new ExpressionParameters @@ -84,19 +84,19 @@ public void BoolTrueAndFalseVarEqualTest() var equal = new NotEqual(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void BoolFalseEqualTest() { var equal = new NotEqual(Bool.False, Bool.False); var result = (bool)equal.Execute(); - Assert.False(result); + Assert.That(result, Is.False); } - [Fact] + [Test] public void BoolFalseVarEqualTest() { var parameters = new ExpressionParameters @@ -107,10 +107,10 @@ public void BoolFalseVarEqualTest() var equal = new NotEqual(Variable.X, Variable.Y); var result = (bool)equal.Execute(parameters); - Assert.False(result); + Assert.That(result, Is.False); } - [Fact] + [Test] public void AngleNotEqualTest() { var equal = new NotEqual( @@ -119,10 +119,10 @@ public void AngleNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void PowerNotEqualTest() { var equal = new NotEqual( @@ -131,10 +131,10 @@ public void PowerNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void TemperatureNotEqualTest() { var equal = new NotEqual( @@ -143,10 +143,10 @@ public void TemperatureNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void MassNotEqualTest() { var equal = new NotEqual( @@ -155,10 +155,10 @@ public void MassNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void LengthNotEqualTest() { var equal = new NotEqual( @@ -167,10 +167,10 @@ public void LengthNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void TimeNotEqualTest() { var equal = new NotEqual( @@ -179,10 +179,10 @@ public void TimeNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void AreaNotEqualTest() { var equal = new NotEqual( @@ -191,10 +191,10 @@ public void AreaNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void VolumeNotEqualTest() { var equal = new NotEqual( @@ -203,15 +203,15 @@ public void VolumeNotEqualTest() ); var result = (bool)equal.Execute(); - Assert.True(result); + Assert.That(result, Is.True); } - [Fact] + [Test] public void CloneTest() { var exp = new NotEqual(Number.Two, Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/RightShiftAssignTest.cs b/xFunc.Tests/Expressions/Programming/RightShiftAssignTest.cs index 1d1ced652..7dd6f6198 100644 --- a/xFunc.Tests/Expressions/Programming/RightShiftAssignTest.cs +++ b/xFunc.Tests/Expressions/Programming/RightShiftAssignTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class RightShiftAssignTest { - [Fact] + [Test] public void ExecuteTest() { var exp = new RightShiftAssign(Variable.X, new Number(9)); @@ -16,10 +16,10 @@ public void ExecuteTest() var actual = exp.Execute(parameters); var expected = new NumberValue(1.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAsExpressionTest() { var exp = new Add(Number.One, new RightShiftAssign(Variable.X, new Number(9))); @@ -29,11 +29,11 @@ public void ExecuteAsExpressionTest() }; var actual = exp.Execute(parameters); - Assert.Equal(new NumberValue(2.0), actual); - Assert.Equal(new NumberValue(1.0), parameters["x"]); + Assert.That(actual, Is.EqualTo(new NumberValue(2.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void ExecuteNullParamsTest() { var exp = new RightShiftAssign(Variable.X, new Number(9)); @@ -41,7 +41,7 @@ public void ExecuteNullParamsTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteDoubleLeftTest() { var exp = new RightShiftAssign(Variable.X, new Number(10)); @@ -53,7 +53,7 @@ public void ExecuteDoubleLeftTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void ExecuteDoubleRightTest() { var exp = new RightShiftAssign(Variable.X, new Number(10.1)); @@ -65,7 +65,7 @@ public void ExecuteDoubleRightTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void ExecuteBoolRightTest() { var exp = new RightShiftAssign(Variable.X, Bool.True); @@ -77,7 +77,7 @@ public void ExecuteBoolRightTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void ExecuteBoolLeftTest() { var exp = new RightShiftAssign(Variable.X, Bool.True); @@ -89,12 +89,12 @@ public void ExecuteBoolLeftTest() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void CloneTest() { var exp = new RightShiftAssign(Variable.X, new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/RightShiftTest.cs b/xFunc.Tests/Expressions/Programming/RightShiftTest.cs index e499b86d8..9ca6b0415 100644 --- a/xFunc.Tests/Expressions/Programming/RightShiftTest.cs +++ b/xFunc.Tests/Expressions/Programming/RightShiftTest.cs @@ -5,17 +5,17 @@ namespace xFunc.Tests.Expressions.Programming; public class RightShiftTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new RightShift(new Number(512), new Number(9)); var actual = exp.Execute(); var expected = new NumberValue(1.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDoubleLeftTest() { var exp = new RightShift(new Number(1.5), new Number(10)); @@ -23,7 +23,7 @@ public void ExecuteDoubleLeftTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteDoubleRightTest() { var exp = new RightShift(Number.One, new Number(10.1)); @@ -31,16 +31,16 @@ public void ExecuteDoubleRightTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new RightShift(Bool.False, Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new RightShift(Number.One, new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/SubAssignTest.cs b/xFunc.Tests/Expressions/Programming/SubAssignTest.cs index e398143fd..b161cbda9 100644 --- a/xFunc.Tests/Expressions/Programming/SubAssignTest.cs +++ b/xFunc.Tests/Expressions/Programming/SubAssignTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Programming; public class SubAssignTest { - [Fact] + [Test] public void SubAssignCalc() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; @@ -13,22 +13,22 @@ public void SubAssignCalc() var result = sub.Execute(parameters); var expected = new NumberValue(8.0); - Assert.Equal(expected, result); - Assert.Equal(expected, parameters["x"]); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(parameters["x"].Value, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubAssignAsExpressionTest() { var parameters = new ExpressionParameters { new Parameter("x", 10) }; var add = new Add(Number.One, new SubAssign(Variable.X, Number.Two)); var result = add.Execute(parameters); - Assert.Equal(new NumberValue(9.0), result); - Assert.Equal(new NumberValue(8.0), parameters["x"]); + Assert.That(result, Is.EqualTo(new NumberValue(9.0))); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(8.0))); } - [Fact] + [Test] public void SubNullParameters() { var exp = new SubAssign(Variable.X, Number.One); @@ -36,7 +36,7 @@ public void SubNullParameters() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void SubValueBoolParameters() { var exp = new SubAssign(Variable.X, Bool.False); @@ -45,7 +45,7 @@ public void SubValueBoolParameters() Assert.Throws(() => exp.Execute(parameters)); } - [Fact] + [Test] public void BoolSubNumberTest() { var parameters = new ExpressionParameters { new Parameter("x", true) }; @@ -54,32 +54,32 @@ public void BoolSubNumberTest() Assert.Throws(() => add.Execute(parameters)); } - [Fact] + [Test] public void SameEqualsTest() { var exp = new SubAssign(Variable.X, Number.One); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualsNullTest() { var exp = new SubAssign(Variable.X, Number.One); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsDifferentTypeTest() { var exp1 = new SubAssign(Variable.X, Number.One); var exp2 = new DivAssign(Variable.X, Number.One); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new SubAssign(Variable.X, Number.One); @@ -87,7 +87,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new SubAssign(Variable.X, Number.One); @@ -95,12 +95,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new SubAssign(Variable.X, Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Programming/WhileTest.cs b/xFunc.Tests/Expressions/Programming/WhileTest.cs index 09e0346c7..8f692c6fe 100644 --- a/xFunc.Tests/Expressions/Programming/WhileTest.cs +++ b/xFunc.Tests/Expressions/Programming/WhileTest.cs @@ -5,11 +5,13 @@ namespace xFunc.Tests.Expressions.Programming; public class WhileTest { - [Fact] + [Test] public void CalculateWhileTest() { - var parameters = new ExpressionParameters(); - parameters.Add(new Parameter("x", 0)); + var parameters = new ExpressionParameters + { + new Parameter("x", 0) + }; var body = new Assign(Variable.X, new Add(Variable.X, Number.Two)); var cond = new LessThan(Variable.X, new Number(10)); @@ -17,10 +19,10 @@ public void CalculateWhileTest() var @while = new While(body, cond); @while.Execute(parameters); - Assert.Equal(new NumberValue(10.0), parameters["x"]); + Assert.That(parameters["x"].Value, Is.EqualTo(new NumberValue(10.0))); } - [Fact] + [Test] public void CloneTest() { var body = new Assign(Variable.X, new Add(Variable.X, Number.Two)); @@ -29,6 +31,6 @@ public void CloneTest() var exp = new While(body, cond); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/RationalTest.cs b/xFunc.Tests/Expressions/RationalTest.cs index 95aa4f2f0..9cc3ec5df 100644 --- a/xFunc.Tests/Expressions/RationalTest.cs +++ b/xFunc.Tests/Expressions/RationalTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Expressions; public class RationalTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new Rational(Number.One, Number.Two); var expected = new RationalValue(1, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLeftExceptionTest() => TestNotSupported(new Rational(Bool.True, Number.Two)); - [Fact] + [Test] public void ExecuteRightExceptionTest() => TestNotSupported(new Rational(Number.One, Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new Rational(Number.One, Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/RationalValueTests.cs b/xFunc.Tests/Expressions/RationalValueTests.cs index 4f24e8089..a52cee24c 100644 --- a/xFunc.Tests/Expressions/RationalValueTests.cs +++ b/xFunc.Tests/Expressions/RationalValueTests.cs @@ -5,150 +5,150 @@ namespace xFunc.Tests.Expressions; public class RationalValueTests { - [Fact] + [Test] public void Equals_TwoEqualNumbers_ReturnsTrue() { var a = new RationalValue(3, 4); var b = new RationalValue(3, 4); - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void Equals_NumeratorIsDifferent_ReturnsFalse() { var a = new RationalValue(3, 4); var b = new RationalValue(1, 4); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void Equals_DenominatorIsDifferent_ReturnsFalse() { var a = new RationalValue(3, 4); var b = new RationalValue(3, 2); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void Equals_NumeratorAndDenominatorAreDifferent_ReturnsFalse() { var a = new RationalValue(3, 4); var b = new RationalValue(4, 2); - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsObject_TwoEqualNumbers_ReturnsTrue() { var a = new RationalValue(3, 4); var b = new RationalValue(3, 4) as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void EqualsObject_NumeratorAndDenominatorAreDifferent_ReturnsFalse() { var a = new RationalValue(3, 4); var b = new RationalValue(4, 2) as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsObject_DiffTypes_ReturnsFalse() { var a = new RationalValue(3, 4); var b = 3.0 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void Equals_DiffDenominator_ReturnsTrue() { var a = new RationalValue(1, 2); var b = new RationalValue(2, 4); - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void EqualsOperator_TwoEqualNumbers_ReturnsTrue() { var a = new RationalValue(3, 4); var b = new RationalValue(3, 4); - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperator_TwoEqualNumbers_ReturnsTrue() { var a = new RationalValue(1, 4); var b = new RationalValue(3, 4); - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void CompareTo_WithPositive_FirstLess() { var a = new RationalValue(3, 4); var b = new RationalValue(4, 2); - Assert.Equal(-1, a.CompareTo(b)); + Assert.That(a.CompareTo(b), Is.EqualTo(-1)); } - [Fact] + [Test] public void CompareTo_WithNegative_FirstLess() { var a = new RationalValue(-3, 4); var b = new RationalValue(4, 2); - Assert.Equal(-1, a.CompareTo(b)); + Assert.That(a.CompareTo(b), Is.EqualTo(-1)); } - [Fact] + [Test] public void CompareTo_WithPositive_FirstGreater() { var a = new RationalValue(4, 2); var b = new RationalValue(3, 4); - Assert.Equal(1, a.CompareTo(b)); + Assert.That(a.CompareTo(b), Is.EqualTo(1)); } - [Fact] + [Test] public void CompareTo_WithPositive_Equal() { var a = new RationalValue(4, 2); var b = new RationalValue(4, 2); - Assert.Equal(0, a.CompareTo(b)); + Assert.That(a.CompareTo(b), Is.EqualTo(0)); } - [Fact] + [Test] public void CompareTo_WithNegative_Equal() { var a = new RationalValue(-4, 2); var b = new RationalValue(-4, 2); - Assert.Equal(0, a.CompareTo(b)); + Assert.That(a.CompareTo(b), Is.EqualTo(0)); } - [Fact] + [Test] public void CompareToObject_WithNull_Greater() { var a = new RationalValue(-4, 2); - Assert.Equal(1, a.CompareTo(null)); + Assert.That(a.CompareTo(null), Is.EqualTo(1)); } - [Fact] + [Test] public void CompareToObject_DiffType_ThrowsException() { var a = new RationalValue(-4, 2); @@ -156,16 +156,16 @@ public void CompareToObject_DiffType_ThrowsException() Assert.Throws(() => a.CompareTo(3.0 as object)); } - [Fact] + [Test] public void CompareToObject_WithNegative_Equal() { var a = new RationalValue(-4, 2); var b = new RationalValue(-4, 2) as object; - Assert.Equal(0, a.CompareTo(b)); + Assert.That(a.CompareTo(b), Is.EqualTo(0)); } - [Fact] + [Test] public void LessThenOperator_WithPositive_ReturnsTrue() { var a = new RationalValue(3, 4); @@ -174,7 +174,7 @@ public void LessThenOperator_WithPositive_ReturnsTrue() Assert.True(a < b); } - [Fact] + [Test] public void LessThenOrEqualOperator_WithPositive_ReturnsTrue() { var a = new RationalValue(3, 4); @@ -183,125 +183,125 @@ public void LessThenOrEqualOperator_WithPositive_ReturnsTrue() Assert.True(a <= b); } - [Fact] + [Test] public void GreaterThenOperator_WithPositive_ReturnsTrue() { var a = new RationalValue(4, 2); var b = new RationalValue(3, 4); - Assert.True(a > b); + Assert.That(a > b, Is.True); } - [Fact] + [Test] public void GreaterThenOrEqualOperator_WithPositive_ReturnsTrue() { var a = new RationalValue(3, 4); var b = new RationalValue(3, 4); - Assert.True(a >= b); + Assert.That(a >= b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = new RationalValue(3, 4); const string expected = "3 // 4"; var result = a.ToString(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_IsNotConvertible_KeepTheSame() { var rationalValue = new RationalValue(3, 4); var expected = new RationalValue(3, 4); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_IsConvertible_ReturnNewRational() { var rationalValue = new RationalValue(4, 4); var expected = new RationalValue(1, 1); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_IsConvertible_ReturnNewRational2() { var rationalValue = new RationalValue(4, 2); var expected = new RationalValue(2, 1); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_IsConvertible_ReturnNewRational3() { var rationalValue = new RationalValue(5, 15); var expected = new RationalValue(1, 3); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_WithNegativeNumerator_ReturnNewRational3() { var rationalValue = new RationalValue(-5, 15); var expected = new RationalValue(-1, 3); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_WithNegativeDenominator_ReturnNewRational3() { var rationalValue = new RationalValue(5, -15); var expected = new RationalValue(-1, 3); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToCanonical_WithNegativeNumeratorAndDenominator_ReturnNewRational3() { var rationalValue = new RationalValue(-5, -15); var expected = new RationalValue(1, 3); var result = rationalValue.ToCanonical(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void UnaryMinus_WithPositiveNumber_ReturnNegative() { var rational = new RationalValue(3, 4); var expected = new RationalValue(-3, 4); var result = -rational; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void UnaryMinus_WithNegativeNumber_ReturnPositive() { var rational = new RationalValue(-3, 4); var expected = new RationalValue(3, 4); var result = -rational; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddOperator_TwoNumbers_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -309,10 +309,10 @@ public void AddOperator_TwoNumbers_ReturnNewRational() var expected = new RationalValue(13, 4); var result = a + b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddOperator_WithSameDenominator_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -320,10 +320,10 @@ public void AddOperator_WithSameDenominator_ReturnNewRational() var expected = new RationalValue(2, 1); var result = a + b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddOperator_RationalAndDouble_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -331,10 +331,10 @@ public void AddOperator_RationalAndDouble_ReturnNewRational() var expected = new RationalValue(23, 4); var result = a + b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AddOperator_DoubleAndRational_ReturnNewRational() { var a = new NumberValue(3.0); @@ -342,10 +342,10 @@ public void AddOperator_DoubleAndRational_ReturnNewRational() var expected = new RationalValue(11, 2); var result = a + b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperator_TwoNumbers_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -353,10 +353,10 @@ public void SubOperator_TwoNumbers_ReturnNewRational() var expected = new RationalValue(-7, 4); var result = a - b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperator_WithSameDenominator_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -364,10 +364,10 @@ public void SubOperator_WithSameDenominator_ReturnNewRational() var expected = new RationalValue(-1, 2); var result = a - b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperator_RationalAndDouble_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -375,10 +375,10 @@ public void SubOperator_RationalAndDouble_ReturnNewRational() var expected = new RationalValue(-17, 4); var result = a - b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperator_DoubleAndRational_ReturnNewRational() { var a = new NumberValue(3.0); @@ -386,10 +386,10 @@ public void SubOperator_DoubleAndRational_ReturnNewRational() var expected = new RationalValue(1, 2); var result = a - b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulOperator_TwoNumbers_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -397,10 +397,10 @@ public void MulOperator_TwoNumbers_ReturnNewRational() var expected = new RationalValue(15, 8); var result = a * b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulOperator_RationalAndDouble_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -408,10 +408,10 @@ public void MulOperator_RationalAndDouble_ReturnNewRational() var expected = new RationalValue(15, 4); var result = a * b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulOperator_DoubleAndRational_ReturnNewRational() { var a = new NumberValue(3.0); @@ -419,10 +419,10 @@ public void MulOperator_DoubleAndRational_ReturnNewRational() var expected = new RationalValue(15, 2); var result = a * b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivOperator_TwoNumbers_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -430,10 +430,10 @@ public void DivOperator_TwoNumbers_ReturnNewRational() var expected = new RationalValue(3, 10); var result = a / b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivOperator_RationalAndDouble_ReturnNewRational() { var a = new RationalValue(3, 4); @@ -441,10 +441,10 @@ public void DivOperator_RationalAndDouble_ReturnNewRational() var expected = new RationalValue(3, 20); var result = a / b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void DivOperator_DoubleAndRational_ReturnNewRational() { var a = new NumberValue(3.0); @@ -452,86 +452,86 @@ public void DivOperator_DoubleAndRational_ReturnNewRational() var expected = new RationalValue(6, 5); var result = a / b; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void AbsTest() { var rational = new RationalValue(-1, 3); var expected = new RationalValue(1, 3); var result = RationalValue.Abs(rational); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void PowTest() { var rational = new RationalValue(2, 3); var result = RationalValue.Pow(rational, new NumberValue(3)); var expected = new RationalValue(8, 27); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void PowNegativeTest() { var rational = new RationalValue(2, 3); var result = RationalValue.Pow(rational, new NumberValue(-3)); var expected = new RationalValue(27, 8); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void LbTest() { var rational = new RationalValue(2, 3); var result = RationalValue.Lb(rational); var expected = new NumberValue(-0.5849625007211563); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void LgTest() { var rational = new RationalValue(2, 3); var result = RationalValue.Lg(rational); var expected = new NumberValue(-0.17609125905568124); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void LnTest() { var rational = new RationalValue(2, 3); var result = RationalValue.Ln(rational); var expected = new NumberValue(-0.4054651081081645); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void LogTest() { var rational = new RationalValue(2, 3); var result = RationalValue.Log(rational, new NumberValue(3)); var expected = new NumberValue(-0.3690702464285426); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToIrrationalTest() { var b = new RationalValue(1, 2); var expected = new NumberValue(0.5); var actual = b.ToIrrational(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/RootTest.cs b/xFunc.Tests/Expressions/RootTest.cs index d1e137d86..8f328bb7d 100644 --- a/xFunc.Tests/Expressions/RootTest.cs +++ b/xFunc.Tests/Expressions/RootTest.cs @@ -7,52 +7,52 @@ namespace xFunc.Tests.Expressions; public class RootTest : BaseExpressionTests { - [Fact] + [Test] public void CalculateRootTest1() { var exp = new Root(new Number(8), new Number(3)); var expected = new NumberValue(Math.Pow(8, 1.0 / 3.0)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void CalculateRootTest2() { var exp = new Root(new Number(-8), new Number(3)); - Assert.Equal(new NumberValue(-2.0), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new NumberValue(-2.0))); } - [Fact] + [Test] public void NegativeNumberExecuteTest() { var exp = new Root(new Number(-25), Number.Two); var result = (Complex)exp.Execute(); var expected = new Complex(0, 5); - Assert.Equal(expected.Real, result.Real, 14); - Assert.Equal(expected.Imaginary, result.Imaginary, 14); + Assert.That(result.Real, Is.EqualTo(expected.Real).Within(14)); + Assert.That(result.Imaginary, Is.EqualTo(expected.Imaginary).Within(14)); } - [Fact] + [Test] public void NegativeNumberExecuteTest2() { var exp = new Root(new Number(-25), new Number(-2)); - Assert.Equal(new Complex(0, -0.2), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new Complex(0, -0.2))); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new Root(Bool.False, Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Root(Variable.X, Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/RoundTest.cs b/xFunc.Tests/Expressions/RoundTest.cs index 46adc414d..05589ca96 100644 --- a/xFunc.Tests/Expressions/RoundTest.cs +++ b/xFunc.Tests/Expressions/RoundTest.cs @@ -5,107 +5,107 @@ namespace xFunc.Tests.Expressions; public class RoundTest : BaseExpressionTests { - [Fact] + [Test] public void CalculateRoundWithoutDigits() { var round = new Round(new Number(5.555555)); var result = round.Execute(); var expected = new NumberValue(6.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void CalculateRoundWithDigits() { var round = new Round(new Number(5.555555), Number.Two); var result = round.Execute(); var expected = new NumberValue(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundAngleWithDigits() { var round = new Round(AngleValue.Degree(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = AngleValue.Degree(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundPowerWithDigits() { var round = new Round(PowerValue.Watt(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = PowerValue.Watt(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundTemperatureWithDigits() { var round = new Round(TemperatureValue.Celsius(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = TemperatureValue.Celsius(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundMassWithDigits() { var round = new Round(MassValue.Gram(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = MassValue.Gram(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundLengthWithDigits() { var round = new Round(LengthValue.Meter(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = LengthValue.Meter(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundTimeWithDigits() { var round = new Round(TimeValue.Second(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = TimeValue.Second(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundAreaWithDigits() { var round = new Round(AreaValue.Meter(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = AreaValue.Meter(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void RoundVolumeWithDigits() { var round = new Round(VolumeValue.Meter(5.555555).AsExpression(), Number.Two); var result = round.Execute(); var expected = VolumeValue.Meter(5.56); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteArgumentIsNotNumber() { var exp = new Round(Bool.False, Number.Two); @@ -113,11 +113,11 @@ public void ExecuteArgumentIsNotNumber() TestNotSupported(exp); } - [Fact] + [Test] public void ExecuteDigitsIsNotNumber() => TestNotSupported(new Round(new Number(5.5), Bool.False)); - [Fact] + [Test] public void ExecuteArgumentIsNotInteger() { var exp = new Round(new Number(5.5), new Number(2.5)); @@ -125,12 +125,12 @@ public void ExecuteArgumentIsNotInteger() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new Round(new Number(5.555555), Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/SignTest.cs b/xFunc.Tests/Expressions/SignTest.cs index 97ca5c905..77b881054 100644 --- a/xFunc.Tests/Expressions/SignTest.cs +++ b/xFunc.Tests/Expressions/SignTest.cs @@ -5,106 +5,106 @@ namespace xFunc.Tests.Expressions; public class SignTest : BaseExpressionTests { - [Fact] + [Test] public void PositiveSignTest() { var exp = new Sign(new Number(5)); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void NegativeSignTest() { var exp = new Sign(new Number(-5)); var result = exp.Execute(); - Assert.Equal(new NumberValue(-1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(-1.0))); } - [Fact] + [Test] public void AngleSignTest() { var exp = new Sign(AngleValue.Degree(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void PowerSignTest() { var exp = new Sign(PowerValue.Watt(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void TemperatureSignTest() { var exp = new Sign(TemperatureValue.Celsius(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void MassSignTest() { var exp = new Sign(MassValue.Gram(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void LengthSignTest() { var exp = new Sign(LengthValue.Meter(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void TimeSignTest() { var exp = new Sign(TimeValue.Second(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void AreaSignTest() { var exp = new Sign(AreaValue.Meter(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void VolumeSignTest() { var exp = new Sign(VolumeValue.Meter(10).AsExpression()); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void InvalidParameterTest() => TestNotSupported(new Sign(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Sign(new Number(-5)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/SimplifyTest.cs b/xFunc.Tests/Expressions/SimplifyTest.cs index da6cc0356..9a435087b 100644 --- a/xFunc.Tests/Expressions/SimplifyTest.cs +++ b/xFunc.Tests/Expressions/SimplifyTest.cs @@ -7,11 +7,11 @@ namespace xFunc.Tests.Expressions; public class SimplifyTest { - [Fact] + [Test] public void SimplifierNull() => Assert.Throws(() => new Simplify(null, null)); - [Fact] + [Test] public void ExecuteTest() { var simplifier = Substitute.For(); @@ -20,10 +20,10 @@ public void ExecuteTest() var lambda = new Sin(Variable.X).ToLambda(Variable.X.Name); var exp = new Simplify(simplifier, lambda.AsExpression()); - Assert.Equal(lambda, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(lambda)); } - [Fact] + [Test] public void ExecuteNonLambdaTest() { var simplifier = Substitute.For(); @@ -32,18 +32,18 @@ public void ExecuteNonLambdaTest() Assert.Throws(() => simplify.Execute()); } - [Fact] + [Test] public void ExecuteNullTest() { Assert.Throws(() => new Simplify(null, new Sin(Variable.X)).Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new Simplify(new Simplifier(), new Sin(Variable.X)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/SqrtTest.cs b/xFunc.Tests/Expressions/SqrtTest.cs index d9ec4f2ec..5776bbf81 100644 --- a/xFunc.Tests/Expressions/SqrtTest.cs +++ b/xFunc.Tests/Expressions/SqrtTest.cs @@ -7,59 +7,59 @@ namespace xFunc.Tests.Expressions; public class SqrtTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Sqrt(new Number(4)); var expected = new NumberValue(Math.Sqrt(4)); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void NegativeNumberExecuteTest1() { var exp = new Sqrt(new Number(-25)); - Assert.Equal(new Complex(0, 5), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new Complex(0, 5))); } - [Fact] + [Test] public void NegativeNumberExecuteTest2() { var exp = new Sqrt(new Number(-1)); - Assert.Equal(new Complex(0, 1), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new Complex(0, 1))); } - [Fact] + [Test] public void ComplexExecuteTest() { var complex = new Complex(5, 3); var exp = new Sqrt(new ComplexNumber(complex)); - Assert.Equal(Complex.Sqrt(complex), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Sqrt(complex))); } - [Fact] + [Test] public void NegativeComplexNumberExecuteTest() { var complex = new Complex(-25, 13); var exp = new Sqrt(new ComplexNumber(complex)); - Assert.Equal(Complex.Sqrt(complex), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Sqrt(complex))); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new Sqrt(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Sqrt(Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/AvgTest.cs b/xFunc.Tests/Expressions/Statistical/AvgTest.cs index c1d52ed65..b678df1b2 100644 --- a/xFunc.Tests/Expressions/Statistical/AvgTest.cs +++ b/xFunc.Tests/Expressions/Statistical/AvgTest.cs @@ -5,39 +5,39 @@ namespace xFunc.Tests.Expressions.Statistical; public class AvgTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Avg(new[] { Number.Two }); var result = exp.Execute(); - Assert.Equal(new NumberValue(2.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(2.0))); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Avg(new[] { Number.Two, new Number(4) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(3.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(3.0))); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Avg(new[] { new Number(9), Number.Two, new Number(4) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(5.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(5.0))); } - [Fact] + [Test] public void VectorTest() { - var exp = new Avg(new[] { new Vector(new[] { Number.One, Number.Two, new Number(3) }) }); + var exp = new Avg(new[] { new Vector(new IExpression[] { Number.One, Number.Two, new Number(3) }) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(2.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(2.0))); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/CountTest.cs b/xFunc.Tests/Expressions/Statistical/CountTest.cs index 577ecabd4..460842f34 100644 --- a/xFunc.Tests/Expressions/Statistical/CountTest.cs +++ b/xFunc.Tests/Expressions/Statistical/CountTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Expressions.Statistical; public class CountTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Count(new[] { Number.Two }); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Count(new[] { Number.Two, new Number(4) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(2.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(2.0))); } - [Fact] + [Test] public void VectorTest() { - var exp = new Count(new[] { new Vector(new[] { Number.One, Number.Two, new Number(3) }) }); + var exp = new Count(new[] { new Vector(new IExpression[] { Number.One, Number.Two, new Number(3) }) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(3.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(3.0))); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/MaxTest.cs b/xFunc.Tests/Expressions/Statistical/MaxTest.cs index 2e835d6fd..932ed2bfa 100644 --- a/xFunc.Tests/Expressions/Statistical/MaxTest.cs +++ b/xFunc.Tests/Expressions/Statistical/MaxTest.cs @@ -5,43 +5,43 @@ namespace xFunc.Tests.Expressions.Statistical; public class MaxTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Max(new[] { Number.Two }); var result = exp.Execute(); var expected = new NumberValue(2.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Max(new[] { Number.Two, new Number(4) }); var result = exp.Execute(); var expected = new NumberValue(4.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Max(new[] { new Number(9), Number.Two, new Number(4) }); var result = exp.Execute(); var expected = new NumberValue(9.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { - var exp = new Max(new[] { new Vector(new[] { Number.One, Number.Two, new Number(3) }) }); + var exp = new Max(new[] { new Vector(new IExpression[] { Number.One, Number.Two, new Number(3) }) }); var result = exp.Execute(); var expected = new NumberValue(3.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/MinTest.cs b/xFunc.Tests/Expressions/Statistical/MinTest.cs index 976b5bcdc..0f201b43f 100644 --- a/xFunc.Tests/Expressions/Statistical/MinTest.cs +++ b/xFunc.Tests/Expressions/Statistical/MinTest.cs @@ -5,39 +5,39 @@ namespace xFunc.Tests.Expressions.Statistical; public class MinTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Min(new[] { Number.Two }); var result = exp.Execute(); - Assert.Equal(new NumberValue(2.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(2.0))); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Min(new[] { Number.Two, new Number(4) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(2.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(2.0))); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Min(new[] { new Number(9), Number.Two, new Number(4) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(2.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(2.0))); } - [Fact] + [Test] public void VectorTest() { - var exp = new Min(new[] { new Vector(new[] { Number.One, Number.Two, new Number(3) }) }); + var exp = new Min(new[] { new Vector(new IExpression[] { Number.One, Number.Two, new Number(3) }) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/ProductTest.cs b/xFunc.Tests/Expressions/Statistical/ProductTest.cs index 5b1897c08..e048bc510 100644 --- a/xFunc.Tests/Expressions/Statistical/ProductTest.cs +++ b/xFunc.Tests/Expressions/Statistical/ProductTest.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.Expressions.Statistical; public class ProductTest { - [Fact] + [Test] public void TwoNumbersTest() { var sum = new Product(new[] { new Number(3), Number.Two }); var actual = sum.Execute(); var expected = new NumberValue(6.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void OneNumberTest() { var sum = new Product(new[] { Number.Two }); var actual = sum.Execute(); var expected = new NumberValue(2.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { - var sum = new Product(new[] { new Vector(new[] { new Number(4), Number.Two }) }); + var sum = new Product(new[] { new Vector(new IExpression[] { new Number(4), Number.Two }) }); var actual = sum.Execute(); var expected = new NumberValue(8.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/StatisticalTests.cs b/xFunc.Tests/Expressions/Statistical/StatisticalTests.cs index 30a3adfa7..485e0b63e 100644 --- a/xFunc.Tests/Expressions/Statistical/StatisticalTests.cs +++ b/xFunc.Tests/Expressions/Statistical/StatisticalTests.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.Expressions.Statistical; -public class StatisticalTests : BaseExpressionTests +public class StatisticalTests : BaseExpressionTests { - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void NotSupportedException(Type type) { var exp = Create(type, new IExpression[] { Bool.False, Bool.False }); @@ -25,36 +25,36 @@ public void NotSupportedException(Type type) TestNotSupported(exp); } - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void CloneTest(Type type) { var exp = Create(type, new IExpression[] { Number.One, Number.Two }); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Theory] - [InlineData(typeof(Avg))] - [InlineData(typeof(Count))] - [InlineData(typeof(Max))] - [InlineData(typeof(Min))] - [InlineData(typeof(Product))] - [InlineData(typeof(Stdev))] - [InlineData(typeof(Stdevp))] - [InlineData(typeof(Sum))] - [InlineData(typeof(Var))] - [InlineData(typeof(Varp))] + [Test] + [TestCase(typeof(Avg))] + [TestCase(typeof(Count))] + [TestCase(typeof(Max))] + [TestCase(typeof(Min))] + [TestCase(typeof(Product))] + [TestCase(typeof(Stdev))] + [TestCase(typeof(Stdevp))] + [TestCase(typeof(Sum))] + [TestCase(typeof(Var))] + [TestCase(typeof(Varp))] public void CloneWithReplaceTest(Type type) { var exp = Create(type, new IExpression[] { Number.One, Number.Two }); @@ -62,6 +62,6 @@ public void CloneWithReplaceTest(Type type) var clone = exp.Clone(arg); var expected = Create(type, arg); - Assert.Equal(expected, clone); + Assert.That(clone, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/StdevTest.cs b/xFunc.Tests/Expressions/Statistical/StdevTest.cs index 71a81e910..2d022ed25 100644 --- a/xFunc.Tests/Expressions/Statistical/StdevTest.cs +++ b/xFunc.Tests/Expressions/Statistical/StdevTest.cs @@ -8,7 +8,7 @@ namespace xFunc.Tests.Expressions.Statistical; public class StdevTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Stdev(new[] { new Number(4) }); @@ -17,33 +17,33 @@ public void OneNumberTest() Assert.True(Complex.IsNaN(result)); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Stdev(new[] { new Number(4), new Number(9) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(3.53553390593274); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Stdev(new[] { new Number(9), Number.Two, new Number(4) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(3.60555127546399); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { - var exp = new Stdev(new[] { new Vector(new[] { Number.Two, new Number(4), new Number(9) }) }); + var exp = new Stdev(new[] { new Vector(new IExpression[] { Number.Two, new Number(4), new Number(9) }) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(3.60555127546399); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/StdevpTest.cs b/xFunc.Tests/Expressions/Statistical/StdevpTest.cs index c43732b4d..943d42984 100644 --- a/xFunc.Tests/Expressions/Statistical/StdevpTest.cs +++ b/xFunc.Tests/Expressions/Statistical/StdevpTest.cs @@ -5,43 +5,43 @@ namespace xFunc.Tests.Expressions.Statistical; public class StdevpTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Stdevp(new[] { new Number(4) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Stdevp(new[] { new Number(4), new Number(9) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(2.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Stdevp(new[] { new Number(9), Number.Two, new Number(4) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(2.94392028877595); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { var exp = new Stdevp(new[] { new Vector(new[] { Number.Two, new Number(4), new Number(9) }) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(2.94392028877595); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/SumTest.cs b/xFunc.Tests/Expressions/Statistical/SumTest.cs index aa3c6b806..31c36c921 100644 --- a/xFunc.Tests/Expressions/Statistical/SumTest.cs +++ b/xFunc.Tests/Expressions/Statistical/SumTest.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.Expressions.Statistical; public class SumTest { - [Fact] + [Test] public void TwoNumbersTest() { var sum = new Sum(new[] { Number.One, Number.Two }); var actual = sum.Execute(); var expected = new NumberValue(3.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void OneNumberTest() { var sum = new Sum(new[] { Number.Two }); var actual = sum.Execute(); var expected = new NumberValue(2.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { - var sum = new Sum(new[] { new Vector(new[] { Number.One, Number.Two }) }); + var sum = new Sum(new[] { new Vector(new IExpression[] { Number.One, Number.Two }) }); var actual = sum.Execute(); var expected = new NumberValue(3.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/VarTest.cs b/xFunc.Tests/Expressions/Statistical/VarTest.cs index db7af005f..a05ac5215 100644 --- a/xFunc.Tests/Expressions/Statistical/VarTest.cs +++ b/xFunc.Tests/Expressions/Statistical/VarTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Expressions.Statistical; public class VarTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Var(new[] { new Number(4) }); @@ -14,33 +14,33 @@ public void OneNumberTest() Assert.True(result.IsNaN); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Var(new[] { new Number(4), new Number(9) }); var result = exp.Execute(); var expected = new NumberValue(12.5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Var(new[] { new Number(9), Number.Two, new Number(4) }); var result = exp.Execute(); var expected = new NumberValue(13.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { - var exp = new Var(new[] { new Vector(new[] { Number.Two, new Number(4), new Number(9) }) }); + var exp = new Var(new[] { new Vector(new IExpression[] { Number.Two, new Number(4), new Number(9) }) }); var result = exp.Execute(); var expected = new NumberValue(13.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Statistical/VarpTest.cs b/xFunc.Tests/Expressions/Statistical/VarpTest.cs index aaa1c3360..598e90ad4 100644 --- a/xFunc.Tests/Expressions/Statistical/VarpTest.cs +++ b/xFunc.Tests/Expressions/Statistical/VarpTest.cs @@ -5,42 +5,42 @@ namespace xFunc.Tests.Expressions.Statistical; public class VarpTest { - [Fact] + [Test] public void OneNumberTest() { var exp = new Varp(new[] { new Number(4) }); var result = exp.Execute(); - Assert.Equal(new NumberValue(0.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(0.0))); } - [Fact] + [Test] public void TwoNumberTest() { var exp = new Varp(new[] { new Number(4), new Number(9) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(6.25); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ThreeNumberTest() { var exp = new Varp(new[] { new Number(9), Number.Two, new Number(4) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(8.66666666666667); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void VectorTest() { - var exp = new Varp(new[] { new Vector(new[] { Number.Two, new Number(4), new Number(9) }) }); + var exp = new Varp(new[] { new Vector(new IExpression[] { Number.Two, new Number(4), new Number(9) }) }); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(8.66666666666667); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/StringExpressionTests.cs b/xFunc.Tests/Expressions/StringExpressionTests.cs index 85614919a..f16e4358b 100644 --- a/xFunc.Tests/Expressions/StringExpressionTests.cs +++ b/xFunc.Tests/Expressions/StringExpressionTests.cs @@ -5,100 +5,98 @@ namespace xFunc.Tests.Expressions; public class StringExpressionTests : BaseExpressionTests { - [Fact] + [Test] public void NullCtor() { Assert.Throws(() => new StringExpression(null)); } - [Fact] + [Test] public void ExecuteTest() { var exp = new StringExpression("hello"); - var expected = "hello"; - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("hello")); } - [Fact] + [Test] public void ExecuteWithParamsTest() { var exp = new StringExpression("hello"); var parameters = new ExpressionParameters(); - var expected = "hello"; - Assert.Equal(expected, exp.Execute(parameters)); + Assert.That(exp.Execute(parameters), Is.EqualTo("hello")); } - [Fact] + [Test] public void EqualsNumberNullTest() { var exp = new StringExpression("hello"); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsObjectNullTest() { var exp = new StringExpression("hello"); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualsNumberThisTest() { var exp = new StringExpression("hello"); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualsObjectThisTest() { var exp = new StringExpression("hello"); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualsTest() { var left = new StringExpression("hello"); var right = new StringExpression("hello"); - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var left = new StringExpression("hello"); var right = new StringExpression("hello1"); - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void EqualsWithDifferentTypeTest() { var left = new StringExpression("hello"); var right = Number.One; - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void EqualsAsObjectTest() { var left = new StringExpression("hello"); var right = new StringExpression("hello") as object; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new StringExpression("hello"); @@ -106,7 +104,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new StringExpression("hello"); diff --git a/xFunc.Tests/Expressions/SubTest.cs b/xFunc.Tests/Expressions/SubTest.cs index 3eced5b66..1f5c0b000 100644 --- a/xFunc.Tests/Expressions/SubTest.cs +++ b/xFunc.Tests/Expressions/SubTest.cs @@ -9,52 +9,52 @@ namespace xFunc.Tests.Expressions; public class SubTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest1() { var exp = new Sub(Number.One, Number.Two); var expected = new NumberValue(-1.0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = new Sub(new ComplexNumber(7, 3), new ComplexNumber(2, 4)); var expected = new Complex(5, -1); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest3() { var exp = new Sub(new Number(7), new ComplexNumber(2, 4)); var expected = new Complex(5, -4); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest4() { var exp = new Sub(new ComplexNumber(7, 3), Number.Two); var expected = new Complex(5, 3); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest6() { var exp = new Sub(Number.Two, new Sqrt(new Number(-9))); var expected = new Complex(2, -3); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void SubTwoVectorsTest() { var vector1 = new Vector(new IExpression[] { Number.Two, new Number(3) }); @@ -64,10 +64,10 @@ public void SubTwoVectorsTest() var expected = VectorValue.Create(new NumberValue(-5), NumberValue.Two); var result = sub.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubTwoMatricesTest() { var matrix1 = new Matrix(new[] @@ -89,10 +89,10 @@ public void SubTwoMatricesTest() }); var result = sub.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void Sub4MatricesTest() { var vector1 = new Vector(new IExpression[] { Number.One, Number.Two }); @@ -105,30 +105,30 @@ public void Sub4MatricesTest() var expected = VectorValue.Create(NumberValue.Zero, NumberValue.Zero); - Assert.Equal(expected, sub3.Execute()); + Assert.That(sub3.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndDegree() { var exp = new Sub(Number.One, AngleValue.Degree(10).AsExpression()); var actual = exp.Execute(); var expected = AngleValue.Degree(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubRadianAndNumber() { var exp = new Sub(AngleValue.Radian(10).AsExpression(), Number.One); var actual = exp.Execute(); var expected = AngleValue.Radian(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubDegreeAndRadian() { var exp = new Sub( @@ -138,10 +138,10 @@ public void SubDegreeAndRadian() var actual = exp.Execute(); var expected = AngleValue.Degree(170); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubGradianAndGradian() { var exp = new Sub( @@ -151,10 +151,10 @@ public void SubGradianAndGradian() var actual = exp.Execute(); var expected = AngleValue.Gradian(20); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndPower() { var exp = new Sub( @@ -164,10 +164,10 @@ public void SubNumberAndPower() var actual = exp.Execute(); var expected = PowerValue.Watt(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubPowerAndNumber() { var exp = new Sub( @@ -177,10 +177,10 @@ public void SubPowerAndNumber() var actual = exp.Execute(); var expected = PowerValue.Watt(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubPowerAndPower() { var exp = new Sub( @@ -190,10 +190,10 @@ public void SubPowerAndPower() var actual = exp.Execute(); var expected = PowerValue.Watt(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndTemperature() { var exp = new Sub( @@ -203,10 +203,10 @@ public void SubNumberAndTemperature() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubTemperatureAndNumber() { var exp = new Sub( @@ -216,10 +216,10 @@ public void SubTemperatureAndNumber() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubTemperatureAndTemperature() { var exp = new Sub( @@ -229,10 +229,10 @@ public void SubTemperatureAndTemperature() var actual = exp.Execute(); var expected = TemperatureValue.Celsius(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndMass() { var exp = new Sub( @@ -242,10 +242,10 @@ public void SubNumberAndMass() var actual = exp.Execute(); var expected = MassValue.Gram(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubMassAndNumber() { var exp = new Sub( @@ -255,10 +255,10 @@ public void SubMassAndNumber() var actual = exp.Execute(); var expected = MassValue.Gram(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubMassAndMass() { var exp = new Sub( @@ -268,10 +268,10 @@ public void SubMassAndMass() var actual = exp.Execute(); var expected = MassValue.Gram(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndLength() { var exp = new Sub( @@ -281,10 +281,10 @@ public void SubNumberAndLength() var actual = exp.Execute(); var expected = LengthValue.Meter(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubLengthAndNumber() { var exp = new Sub( @@ -294,10 +294,10 @@ public void SubLengthAndNumber() var actual = exp.Execute(); var expected = LengthValue.Meter(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubLengthAndLength() { var exp = new Sub( @@ -307,10 +307,10 @@ public void SubLengthAndLength() var actual = exp.Execute(); var expected = LengthValue.Meter(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndTime() { var exp = new Sub( @@ -320,10 +320,10 @@ public void SubNumberAndTime() var actual = exp.Execute(); var expected = TimeValue.Second(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubTimeAndNumber() { var exp = new Sub( @@ -333,10 +333,10 @@ public void SubTimeAndNumber() var actual = exp.Execute(); var expected = TimeValue.Second(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubTimeAndTime() { var exp = new Sub( @@ -346,10 +346,10 @@ public void SubTimeAndTime() var actual = exp.Execute(); var expected = TimeValue.Second(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndArea() { var exp = new Sub( @@ -359,10 +359,10 @@ public void SubNumberAndArea() var actual = exp.Execute(); var expected = AreaValue.Meter(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubAreaAndNumber() { var exp = new Sub( @@ -372,10 +372,10 @@ public void SubAreaAndNumber() var actual = exp.Execute(); var expected = AreaValue.Meter(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubAreaAndArea() { var exp = new Sub( @@ -385,10 +385,10 @@ public void SubAreaAndArea() var actual = exp.Execute(); var expected = AreaValue.Meter(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubNumberAndVolume() { var exp = new Sub( @@ -398,10 +398,10 @@ public void SubNumberAndVolume() var actual = exp.Execute(); var expected = VolumeValue.Meter(-9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubVolumeAndNumber() { var exp = new Sub( @@ -411,10 +411,10 @@ public void SubVolumeAndNumber() var actual = exp.Execute(); var expected = VolumeValue.Meter(9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubVolumeAndVolume() { var exp = new Sub( @@ -424,10 +424,10 @@ public void SubVolumeAndVolume() var actual = exp.Execute(); var expected = VolumeValue.Meter(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndRational() { var exp = new Sub( @@ -437,10 +437,10 @@ public void ExecuteRationalAndRational() var expected = new RationalValue(-3, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNumberAndRational() { var exp = new Sub( @@ -450,10 +450,10 @@ public void ExecuteNumberAndRational() var expected = new RationalValue(1, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalAndNumber() { var exp = new Sub( @@ -463,19 +463,19 @@ public void ExecuteRationalAndNumber() var expected = new RationalValue(1, 2); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteWrongArgumentTypeTest() => TestNotSupported(new Sub(Bool.True, Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new Sub(new Number(5), Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ToBinTest.cs b/xFunc.Tests/Expressions/ToBinTest.cs index 9db0a759c..bf0a1a99c 100644 --- a/xFunc.Tests/Expressions/ToBinTest.cs +++ b/xFunc.Tests/Expressions/ToBinTest.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.Expressions; public class ToBinTest : BaseExpressionTests { - [Theory] - [InlineData(0x7F, "0b01111111")] - [InlineData(0x7FFF, "0b0111111111111111")] - [InlineData(0x7FFFFF, "0b011111111111111111111111")] - [InlineData(0x7FFFFFFF, "0b01111111111111111111111111111111")] + [Test] + [TestCase(0x7F, "0b01111111")] + [TestCase(0x7FFF, "0b0111111111111111")] + [TestCase(0x7FFFFF, "0b011111111111111111111111")] + [TestCase(0x7FFFFFFF, "0b01111111111111111111111111111111")] public void ExecuteNumberTest(double number, string result) { var exp = new ToBin(new Number(number)); - Assert.Equal(result, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(result)); } - [Fact] + [Test] public void ExecuteNumberExceptionTest() { var exp = new ToBin(new Number(2.5)); @@ -25,32 +25,32 @@ public void ExecuteNumberExceptionTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteLongMaxNumberTest() { var exp = new ToBin(new Number(int.MaxValue)); - Assert.Equal("0b01111111111111111111111111111111", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("0b01111111111111111111111111111111")); } - [Fact] + [Test] public void ExecuteNegativeNumberTest() { var exp = new ToBin(new Number(-2)); - Assert.Equal("0b11111111111111111111111111111110", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("0b11111111111111111111111111111110")); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new ToBin(Bool.False)); - [Fact] + [Test] public void CloseTest() { var exp = new ToBin(new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ToHexTest.cs b/xFunc.Tests/Expressions/ToHexTest.cs index 53ac0b863..e19a46cd4 100644 --- a/xFunc.Tests/Expressions/ToHexTest.cs +++ b/xFunc.Tests/Expressions/ToHexTest.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.Expressions; public class ToHexTest : BaseExpressionTests { - [Theory] - [InlineData(0x7, "0x07")] - [InlineData(0x7FF, "0x07FF")] - [InlineData(0x7FFFF, "0x07FFFF")] - [InlineData(0x7FFFFFF, "0x07FFFFFF")] + [Test] + [TestCase(0x7, "0x07")] + [TestCase(0x7FF, "0x07FF")] + [TestCase(0x7FFFF, "0x07FFFF")] + [TestCase(0x7FFFFFF, "0x07FFFFFF")] public void ExecuteNumberTest(double number, string result) { var exp = new ToHex(new Number(number)); - Assert.Equal(result, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(result)); } - [Fact] + [Test] public void ExecuteNumberExceptionTest() { var exp = new ToHex(new Number(2.5)); @@ -25,32 +25,32 @@ public void ExecuteNumberExceptionTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteLongMaxNumberTest() { var exp = new ToHex(new Number(int.MaxValue)); - Assert.Equal("0x7FFFFFFF", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("0x7FFFFFFF")); } - [Fact] + [Test] public void ExecuteNegativeNumberTest() { var exp = new ToHex(new Number(-2)); - Assert.Equal("0xFFFFFFFE", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("0xFFFFFFFE")); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new ToHex(Bool.False)); - [Fact] + [Test] public void CloseTest() { var exp = new ToHex(new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ToNumberTest.cs b/xFunc.Tests/Expressions/ToNumberTest.cs index 6a5ccbbbf..30545934c 100644 --- a/xFunc.Tests/Expressions/ToNumberTest.cs +++ b/xFunc.Tests/Expressions/ToNumberTest.cs @@ -5,102 +5,102 @@ namespace xFunc.Tests.Expressions; public class ToNumberTest { - [Fact] + [Test] public void ExecuteAngleTest() { var exp = new ToNumber(AngleValue.Degree(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerTest() { var exp = new ToNumber(PowerValue.Watt(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureTest() { var exp = new ToNumber(TemperatureValue.Celsius(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassTest() { var exp = new ToNumber(MassValue.Gram(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthTest() { var exp = new ToNumber(LengthValue.Meter(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeTest() { var exp = new ToNumber(TimeValue.Second(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAreaTest() { var exp = new ToNumber(AreaValue.Meter(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVolumeTest() { var exp = new ToNumber(VolumeValue.Meter(10).AsExpression()); var actual = exp.Execute(); var expected = new NumberValue(10.0); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRationalTest() { var exp = new ToNumber(new Rational(new Number(1), new Number(2))); var actual = exp.Execute(); - Assert.Equal(NumberValue.Half, actual); + Assert.That(actual, Is.EqualTo(NumberValue.Half)); } - [Fact] + [Test] public void ExecuteBoolTest() { Assert.Throws(() => new ToNumber(Bool.False).Execute()); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new ToNumber(new Number(10)); @@ -108,7 +108,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new ToNumber(new Number(10)); @@ -116,12 +116,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new ToNumber(AngleValue.Degree(10).AsExpression()); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ToOctTest.cs b/xFunc.Tests/Expressions/ToOctTest.cs index b17ea4ce0..95f625825 100644 --- a/xFunc.Tests/Expressions/ToOctTest.cs +++ b/xFunc.Tests/Expressions/ToOctTest.cs @@ -5,15 +5,15 @@ namespace xFunc.Tests.Expressions; public class ToOctTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new ToOct(Number.Two); - Assert.Equal("02", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("02")); } - [Fact] + [Test] public void ExecuteNumberExceptionTest() { var exp = new ToOct(new Number(2.5)); @@ -21,32 +21,32 @@ public void ExecuteNumberExceptionTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteLongMaxNumberTest() { var exp = new ToOct(new Number(int.MaxValue)); - Assert.Equal("017777777777", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("017777777777")); } - [Fact] + [Test] public void ExecuteNegativeNumberTest() { var exp = new ToOct(new Number(-2)); - Assert.Equal("037777777776", exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo("037777777776")); } - [Fact] + [Test] public void ExecuteBoolTest() => TestNotSupported(new ToOct(Bool.False)); - [Fact] + [Test] public void CloseTest() { var exp = new ToOct(new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/ToRationalTest.cs b/xFunc.Tests/Expressions/ToRationalTest.cs index 642cfc855..395e7977b 100644 --- a/xFunc.Tests/Expressions/ToRationalTest.cs +++ b/xFunc.Tests/Expressions/ToRationalTest.cs @@ -5,26 +5,26 @@ namespace xFunc.Tests.Expressions; public class ToRationalTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteTest() { var exp = new ToRational(Number.Two); var expected = new RationalValue(2, 1); var actual = exp.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteExceptionTest() => TestNotSupported(new ToRational(Bool.True)); - [Fact] + [Test] public void CloneTest() { var exp = new ToRational(Number.Two); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/ArccosTest.cs b/xFunc.Tests/Expressions/Trigonometric/ArccosTest.cs index 3a3453087..6646950a6 100644 --- a/xFunc.Tests/Expressions/Trigonometric/ArccosTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/ArccosTest.cs @@ -7,36 +7,36 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class ArccosTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arccos(Number.One); var expected = AngleValue.Radian(0); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arccos(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.60613782238729386, result.Real, 15); - Assert.Equal(-1.9686379257930964, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.60613782238729386).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-1.9686379257930964).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arccos(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arccos(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/ArccotTest.cs b/xFunc.Tests/Expressions/Trigonometric/ArccotTest.cs index 6b1443a27..564248bd5 100644 --- a/xFunc.Tests/Expressions/Trigonometric/ArccotTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/ArccotTest.cs @@ -7,36 +7,36 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class ArccotTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arccot(Number.One); var result = exp.Execute(); var expected = AngleValue.Radian(0.7853981633974483); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arccot(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.23182380450040308, result.Real, 15); - Assert.Equal(-0.14694666622552988, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.23182380450040308).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.14694666622552988).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arccot(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arccot(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/ArccscTest.cs b/xFunc.Tests/Expressions/Trigonometric/ArccscTest.cs index 011698949..46b8147a9 100644 --- a/xFunc.Tests/Expressions/Trigonometric/ArccscTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/ArccscTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class ArccscTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arccsc(Number.One); var result = exp.Execute(); var expected = AngleValue.Radian(1.5707963267948966); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arccsc(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.22996290237720782, result.Real, 15); - Assert.Equal(-0.15735549884498545, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.22996290237720782).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.15735549884498545).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arccsc(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arccsc(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/ArcsecTest.cs b/xFunc.Tests/Expressions/Trigonometric/ArcsecTest.cs index 3d727a009..a42a2753f 100644 --- a/xFunc.Tests/Expressions/Trigonometric/ArcsecTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/ArcsecTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class ArcsecTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arcsec(Number.One); var result = exp.Execute(); var expected = AngleValue.Radian(0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arcsec(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(1.3408334244176887, result.Real, 15); - Assert.Equal(0.15735549884498545, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(1.3408334244176887).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.15735549884498545).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arcsec(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arcsec(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/ArcsinTest.cs b/xFunc.Tests/Expressions/Trigonometric/ArcsinTest.cs index 5ec9be540..38d3ec0a3 100644 --- a/xFunc.Tests/Expressions/Trigonometric/ArcsinTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/ArcsinTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class ArcsinTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arcsin(Number.One); var result = exp.Execute(); var expected = AngleValue.Radian(1.5707963267948966); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arcsin(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.96465850440760248, result.Real, 14); - Assert.Equal(1.9686379257930975, result.Imaginary, 14); + Assert.That(result.Real, Is.EqualTo(0.96465850440760248).Within(14)); + Assert.That(result.Imaginary, Is.EqualTo(1.9686379257930975).Within(14)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arcsin(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arcsin(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/ArctanTest.cs b/xFunc.Tests/Expressions/Trigonometric/ArctanTest.cs index 659369ba1..e4424d9c8 100644 --- a/xFunc.Tests/Expressions/Trigonometric/ArctanTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/ArctanTest.cs @@ -7,37 +7,37 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class ArctanTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Arctan(Number.One); var result = exp.Execute(); var expected = AngleValue.Radian(0.7853981633974483); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Arctan(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(1.3389725222944935, result.Real, 15); - Assert.Equal(0.14694666622552977, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(1.3389725222944935).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.14694666622552977).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Arctan(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Arctan(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/CosecantTest.cs b/xFunc.Tests/Expressions/Trigonometric/CosecantTest.cs index a9fe72e20..8d0b9e752 100644 --- a/xFunc.Tests/Expressions/Trigonometric/CosecantTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/CosecantTest.cs @@ -7,86 +7,86 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class CosecantTest : BaseExpressionTests { - [Theory] - [InlineData(0.0, double.PositiveInfinity)] // - - [InlineData(30.0, 2.0)] // 2 - [InlineData(45.0, 1.4142135623730951)] // sqrt(2) - [InlineData(60.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(90.0, 1.0)] // 1 - [InlineData(120.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(135.0, 1.4142135623730951)] // sqrt(2) - [InlineData(150.0, 2.0)] // 2 - [InlineData(180.0, double.PositiveInfinity)] // - - [InlineData(210.0, -2.0)] // -2 - [InlineData(225.0, -1.4142135623730951)] // -sqrt(2) - [InlineData(240.0, -1.1547005383792515)] // -2sqrt(3) / 3 - [InlineData(270.0, -1.0)] // -1 - [InlineData(300.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(315.0, 1.4142135623730951)] // sqrt(2) - [InlineData(330.0, 2.0)] // 2 - [InlineData(360.0, double.PositiveInfinity)] // - - [InlineData(1110.0, 2.0)] // 2 - [InlineData(1770.0, 2.0)] // 2 - [InlineData(-390.0, 2.0)] // 2 + [Test] + [TestCase(0.0, double.PositiveInfinity)] // - + [TestCase(30.0, 2.0)] // 2 + [TestCase(45.0, 1.4142135623730951)] // sqrt(2) + [TestCase(60.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(90.0, 1.0)] // 1 + [TestCase(120.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(135.0, 1.4142135623730951)] // sqrt(2) + [TestCase(150.0, 2.0)] // 2 + [TestCase(180.0, double.PositiveInfinity)] // - + [TestCase(210.0, -2.0)] // -2 + [TestCase(225.0, -1.4142135623730951)] // -sqrt(2) + [TestCase(240.0, -1.1547005383792515)] // -2sqrt(3) / 3 + [TestCase(270.0, -1.0)] // -1 + [TestCase(300.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(315.0, 1.4142135623730951)] // sqrt(2) + [TestCase(330.0, 2.0)] // 2 + [TestCase(360.0, double.PositiveInfinity)] // - + [TestCase(1110.0, 2.0)] // 2 + [TestCase(1770.0, 2.0)] // 2 + [TestCase(-390.0, 2.0)] // 2 public void ExecuteNumberTest(double degree, double expected) { var exp = new Csc(new Number(degree)); var result = (NumberValue)exp.Execute(); - Assert.Equal(expected, result.Number, 15); + Assert.That(result.Number, Is.EqualTo(expected).Within(15)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Csc(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(57.298688498550185); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Csc(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.1883951057781212); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Csc(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(63.664595306000564); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Csc(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.040300578856891527, result.Real, 15); - Assert.Equal(0.27254866146294021, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.040300578856891527).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.27254866146294021).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Csc(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Csc(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/CosineTest.cs b/xFunc.Tests/Expressions/Trigonometric/CosineTest.cs index cae17507c..d40c965d3 100644 --- a/xFunc.Tests/Expressions/Trigonometric/CosineTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/CosineTest.cs @@ -7,86 +7,86 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class CosineTest : BaseExpressionTests { - [Theory] - [InlineData(0.0, 1.0)] // 1 - [InlineData(30.0, 0.86602540378443864)] // sqrt(3) / 2 - [InlineData(45.0, 0.70710678118654757)] // sqrt(2) / 2 - [InlineData(60.0, 0.5)] // 1 / 2 - [InlineData(90.0, 0.0)] // 0 - [InlineData(120.0, -0.5)] // -1 / 2 - [InlineData(135.0, -0.70710678118654757)] // -sqrt(2) / 2 - [InlineData(150.0, -0.86602540378443864)] // -sqrt(3) / 2 - [InlineData(180.0, -1.0)] // -1 - [InlineData(210.0, -0.86602540378443864)] // -sqrt(3) / 2 - [InlineData(225.0, -0.70710678118654757)] // -sqrt(2) / 2 - [InlineData(240.0, -0.5)] // -1 / 2 - [InlineData(270.0, 0.0)] // 0 - [InlineData(300.0, 0.5)] // 1 / 2 - [InlineData(315.0, 0.70710678118654757)] // sqrt(2) / 2 - [InlineData(330.0, 0.86602540378443864)] // sqrt(3) / 2 - [InlineData(360.0, 1.0)] // 1 - [InlineData(1110.0, 0.86602540378443864)] // sqrt(3) / 2 - [InlineData(1770.0, 0.86602540378443864)] // sqrt(3) / 2 - [InlineData(-390.0, 0.86602540378443864)] // sqrt(3) / 2 + [Test] + [TestCase(0.0, 1.0)] // 1 + [TestCase(30.0, 0.86602540378443864)] // sqrt(3) / 2 + [TestCase(45.0, 0.70710678118654757)] // sqrt(2) / 2 + [TestCase(60.0, 0.5)] // 1 / 2 + [TestCase(90.0, 0.0)] // 0 + [TestCase(120.0, -0.5)] // -1 / 2 + [TestCase(135.0, -0.70710678118654757)] // -sqrt(2) / 2 + [TestCase(150.0, -0.86602540378443864)] // -sqrt(3) / 2 + [TestCase(180.0, -1.0)] // -1 + [TestCase(210.0, -0.86602540378443864)] // -sqrt(3) / 2 + [TestCase(225.0, -0.70710678118654757)] // -sqrt(2) / 2 + [TestCase(240.0, -0.5)] // -1 / 2 + [TestCase(270.0, 0.0)] // 0 + [TestCase(300.0, 0.5)] // 1 / 2 + [TestCase(315.0, 0.70710678118654757)] // sqrt(2) / 2 + [TestCase(330.0, 0.86602540378443864)] // sqrt(3) / 2 + [TestCase(360.0, 1.0)] // 1 + [TestCase(1110.0, 0.86602540378443864)] // sqrt(3) / 2 + [TestCase(1770.0, 0.86602540378443864)] // sqrt(3) / 2 + [TestCase(-390.0, 0.86602540378443864)] // sqrt(3) / 2 public void ExecuteNumberTest(double degree, double expected) { var exp = new Cos(new Number(degree)); var result = (NumberValue)exp.Execute(); - Assert.Equal(expected, result.Number, 15); + Assert.That(result.Number, Is.EqualTo(expected).Within(15)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Cos(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.5403023058681398); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Cos(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.9998476951563913); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Cos(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.9998766324816606); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Cos(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-3.7245455049153224, result.Real, 15); - Assert.Equal(-0.51182256998738462, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-3.7245455049153224).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-0.51182256998738462).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Cos(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Cos(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/CotangentTest.cs b/xFunc.Tests/Expressions/Trigonometric/CotangentTest.cs index 8b8e43165..1121b55b3 100644 --- a/xFunc.Tests/Expressions/Trigonometric/CotangentTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/CotangentTest.cs @@ -7,86 +7,86 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class CotangentTest : BaseExpressionTests { - [Theory] - [InlineData(0.0, double.PositiveInfinity)] // - - [InlineData(30.0, 1.7320508075688772)] // sqrt(3) - [InlineData(45.0, 1.0)] // 1 - [InlineData(60.0, 0.57735026918962573)] // sqrt(3) / 3 - [InlineData(90.0, 0.0)] // 0 - [InlineData(120.0, -0.57735026918962573)] // -sqrt(3) / 3 - [InlineData(135.0, -1)] // -1 - [InlineData(150.0, -1.7320508075688772)] // -sqrt(3) - [InlineData(180.0, double.PositiveInfinity)] // - - [InlineData(210.0, 1.7320508075688772)] // sqrt(3) - [InlineData(225.0, 1.0)] // 1 - [InlineData(240.0, 0.57735026918962573)] // sqrt(3) / 3 - [InlineData(270.0, 0.0)] // 0 - [InlineData(300.0, -1.7320508075688772)] // -sqrt(3) - [InlineData(315.0, -1.0)] // -1 - [InlineData(330.0, -0.57735026918962573)] // -sqrt(3) / 3 - [InlineData(360.0, double.PositiveInfinity)] // - - [InlineData(1110.0, 1.7320508075688772)] // sqrt(3) - [InlineData(1770.0, -0.57735026918962573)] // -sqrt(3) / 3 - [InlineData(-390.0, -0.57735026918962573)] // -sqrt(3) / 3 + [Test] + [TestCase(0.0, double.PositiveInfinity)] // - + [TestCase(30.0, 1.7320508075688772)] // sqrt(3) + [TestCase(45.0, 1.0)] // 1 + [TestCase(60.0, 0.57735026918962573)] // sqrt(3) / 3 + [TestCase(90.0, 0.0)] // 0 + [TestCase(120.0, -0.57735026918962573)] // -sqrt(3) / 3 + [TestCase(135.0, -1)] // -1 + [TestCase(150.0, -1.7320508075688772)] // -sqrt(3) + [TestCase(180.0, double.PositiveInfinity)] // - + [TestCase(210.0, 1.7320508075688772)] // sqrt(3) + [TestCase(225.0, 1.0)] // 1 + [TestCase(240.0, 0.57735026918962573)] // sqrt(3) / 3 + [TestCase(270.0, 0.0)] // 0 + [TestCase(300.0, -1.7320508075688772)] // -sqrt(3) + [TestCase(315.0, -1.0)] // -1 + [TestCase(330.0, -0.57735026918962573)] // -sqrt(3) / 3 + [TestCase(360.0, double.PositiveInfinity)] // - + [TestCase(1110.0, 1.7320508075688772)] // sqrt(3) + [TestCase(1770.0, -0.57735026918962573)] // -sqrt(3) / 3 + [TestCase(-390.0, -0.57735026918962573)] // -sqrt(3) / 3 public void ExecuteNumberTest(double degree, double expected) { var exp = new Cot(new Number(degree)); var actual = (NumberValue)exp.Execute(); - Assert.Equal(expected, actual.Number); + Assert.That(actual.Number, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Cot(AngleValue.Radian(1).AsExpression()); var actual = (NumberValue)exp.Execute(); var expected = new NumberValue(0.6420926159343308); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Cot(AngleValue.Degree(1).AsExpression()); var actual = (NumberValue)exp.Execute(); var expected = new NumberValue(57.28996163075943); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Cot(AngleValue.Gradian(1).AsExpression()); var actual = (NumberValue)exp.Execute(); var expected = new NumberValue(63.65674116287158); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Cot(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-0.010604783470337083, result.Real, 14); - Assert.Equal(-1.0357466377649953, result.Imaginary, 14); + Assert.That(result.Real, Is.EqualTo(-0.010604783470337083).Within(14)); + Assert.That(result.Imaginary, Is.EqualTo(-1.0357466377649953).Within(14)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Cot(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Cot(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/SecantTest.cs b/xFunc.Tests/Expressions/Trigonometric/SecantTest.cs index 5af74d2a9..477b92eae 100644 --- a/xFunc.Tests/Expressions/Trigonometric/SecantTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/SecantTest.cs @@ -7,86 +7,86 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class SecantTest : BaseExpressionTests { - [Theory] - [InlineData(0.0, 1.0)] // 1 - [InlineData(30.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(45.0, 1.4142135623730951)] // sqrt(2) - [InlineData(60.0, 2.0)] // 2 - [InlineData(90.0, double.PositiveInfinity)] // - - [InlineData(120.0, -2.0)] // -2 - [InlineData(135.0, -1.4142135623730951)] // -sqrt(2) - [InlineData(150.0, -1.1547005383792515)] // -2sqrt(3) / 3 - [InlineData(180.0, -1.0)] // -1 - [InlineData(210.0, -1.1547005383792515)] // -2sqrt(3) / 3 - [InlineData(225.0, -1.4142135623730951)] // -sqrt(2) - [InlineData(240.0, -2.0)] // -2 - [InlineData(270.0, double.PositiveInfinity)] // - - [InlineData(300.0, -2.0)] // -2 - [InlineData(315.0, 1.4142135623730951)] // sqrt(2) - [InlineData(330.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(360.0, 1.0)] // 1 - [InlineData(1110.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(1770.0, 1.1547005383792515)] // 2sqrt(3) / 3 - [InlineData(-390.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [Test] + [TestCase(0.0, 1.0)] // 1 + [TestCase(30.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(45.0, 1.4142135623730951)] // sqrt(2) + [TestCase(60.0, 2.0)] // 2 + [TestCase(90.0, double.PositiveInfinity)] // - + [TestCase(120.0, -2.0)] // -2 + [TestCase(135.0, -1.4142135623730951)] // -sqrt(2) + [TestCase(150.0, -1.1547005383792515)] // -2sqrt(3) / 3 + [TestCase(180.0, -1.0)] // -1 + [TestCase(210.0, -1.1547005383792515)] // -2sqrt(3) / 3 + [TestCase(225.0, -1.4142135623730951)] // -sqrt(2) + [TestCase(240.0, -2.0)] // -2 + [TestCase(270.0, double.PositiveInfinity)] // - + [TestCase(300.0, -2.0)] // -2 + [TestCase(315.0, 1.4142135623730951)] // sqrt(2) + [TestCase(330.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(360.0, 1.0)] // 1 + [TestCase(1110.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(1770.0, 1.1547005383792515)] // 2sqrt(3) / 3 + [TestCase(-390.0, 1.1547005383792515)] // 2sqrt(3) / 3 public void ExecuteNumberTest(double degree, double expected) { var exp = new Sec(new Number(degree)); var result = (NumberValue)exp.Execute(); - Assert.Equal(expected, result.Number); + Assert.That(result.Number, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Sec(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.0001523280439077); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Sec(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.8508157176809255); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Sec(AngleValue.Gradian(1).AsExpression()); var actual = (NumberValue)exp.Execute(); var expected = new NumberValue(1.0001233827397618); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Sec(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-0.26351297515838928, result.Real, 15); - Assert.Equal(0.036211636558768523, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-0.26351297515838928).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.036211636558768523).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Sec(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Sec(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/SineTest.cs b/xFunc.Tests/Expressions/Trigonometric/SineTest.cs index f1fbd2c42..758ee6158 100644 --- a/xFunc.Tests/Expressions/Trigonometric/SineTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/SineTest.cs @@ -7,86 +7,86 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class SineTest : BaseExpressionTests { - [Theory] - [InlineData(0.0, 0.0)] // 0 - [InlineData(30.0, 0.5)] // 1 / 2 - [InlineData(45.0, 0.70710678118654757)] // sqrt(2) / 2 - [InlineData(60.0, 0.86602540378443864)] // sqrt(3) / 2 - [InlineData(90.0, 1.0)] // 1 - [InlineData(120.0, 0.86602540378443864)] // sqrt(3) / 2 - [InlineData(135.0, 0.70710678118654757)] // sqrt(2) / 2 - [InlineData(150.0, 0.5)] // 1 / 2 - [InlineData(180.0, 0.0)] // 0 - [InlineData(210.0, -0.5)] // -1 / 2 - [InlineData(225.0, -0.70710678118654757)] // -sqrt(2) / 2 - [InlineData(240.0, -0.86602540378443864)] // -sqrt(3) / 2 - [InlineData(270.0, -1.0)] // -1 - [InlineData(300.0, -0.86602540378443864)] // -sqrt(3) / 2 - [InlineData(315.0, -0.70710678118654757)] // -sqrt(2) / 2 - [InlineData(330.0, -0.5)] // -1 / 2 - [InlineData(360.0, 0)] // 0 - [InlineData(1110.0, 0.5)] // 1 / 2 - [InlineData(1770.0, -0.5)] // -1 / 2 - [InlineData(-390.0, -0.5)] // -1 / 2 + [Test] + [TestCase(0.0, 0.0)] // 0 + [TestCase(30.0, 0.5)] // 1 / 2 + [TestCase(45.0, 0.70710678118654757)] // sqrt(2) / 2 + [TestCase(60.0, 0.86602540378443864)] // sqrt(3) / 2 + [TestCase(90.0, 1.0)] // 1 + [TestCase(120.0, 0.86602540378443864)] // sqrt(3) / 2 + [TestCase(135.0, 0.70710678118654757)] // sqrt(2) / 2 + [TestCase(150.0, 0.5)] // 1 / 2 + [TestCase(180.0, 0.0)] // 0 + [TestCase(210.0, -0.5)] // -1 / 2 + [TestCase(225.0, -0.70710678118654757)] // -sqrt(2) / 2 + [TestCase(240.0, -0.86602540378443864)] // -sqrt(3) / 2 + [TestCase(270.0, -1.0)] // -1 + [TestCase(300.0, -0.86602540378443864)] // -sqrt(3) / 2 + [TestCase(315.0, -0.70710678118654757)] // -sqrt(2) / 2 + [TestCase(330.0, -0.5)] // -1 / 2 + [TestCase(360.0, 0)] // 0 + [TestCase(1110.0, 0.5)] // 1 / 2 + [TestCase(1770.0, -0.5)] // -1 / 2 + [TestCase(-390.0, -0.5)] // -1 / 2 public void ExecuteNumberTest(double degree, double expected) { var exp = new Sin(new Number(degree)); var result = (NumberValue)exp.Execute(); - Assert.Equal(expected, result.Number, 15); + Assert.That(result.Number, Is.EqualTo(expected).Within(15)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Sin(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.8414709848078965); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Sin(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.017452406437283512); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Sin(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.015707317311820675); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Sin(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(0.53092108624851986, result.Real, 15); - Assert.Equal(-3.59056458998578, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(0.53092108624851986).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(-3.59056458998578).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Sin(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Sin(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Trigonometric/TangentTest.cs b/xFunc.Tests/Expressions/Trigonometric/TangentTest.cs index 7933fa9a6..936c6702b 100644 --- a/xFunc.Tests/Expressions/Trigonometric/TangentTest.cs +++ b/xFunc.Tests/Expressions/Trigonometric/TangentTest.cs @@ -7,86 +7,86 @@ namespace xFunc.Tests.Expressions.Trigonometric; public class TangentTest : BaseExpressionTests { - [Theory] - [InlineData(0.0, 0.0)] // 0 - [InlineData(30.0, 0.57735026918962573)] // sqrt(3) / 3 - [InlineData(45.0, 1.0)] // 1 - [InlineData(60.0, 1.7320508075688772)] // sqrt(3) - [InlineData(90.0, double.PositiveInfinity)] // - - [InlineData(120.0, -1.7320508075688772)] // -sqrt(3) - [InlineData(135.0, -1)] // -1 - [InlineData(150.0, -0.57735026918962573)] // -sqrt(3) / 3 - [InlineData(180.0, 0.0)] // 0 - [InlineData(210.0, 0.57735026918962573)] // sqrt(3) / 3 - [InlineData(225.0, 1.0)] // 1 - [InlineData(240.0, 1.7320508075688772)] // sqrt(3) - [InlineData(270.0, double.PositiveInfinity)] // - - [InlineData(300.0, -1.7320508075688772)] // -sqrt(3) - [InlineData(315.0, -1.0)] // -1 - [InlineData(330.0, -0.57735026918962573)] // -sqrt(3) / 3 - [InlineData(360.0, 0.0)] // 0 - [InlineData(1110.0, 0.57735026918962573)] // sqrt(3) / 3 - [InlineData(1770.0, -0.57735026918962573)] // -sqrt(3) / 3 - [InlineData(-390.0, -0.57735026918962573)] // -sqrt(3) / 3 + [Test] + [TestCase(0.0, 0.0)] // 0 + [TestCase(30.0, 0.57735026918962573)] // sqrt(3) / 3 + [TestCase(45.0, 1.0)] // 1 + [TestCase(60.0, 1.7320508075688772)] // sqrt(3) + [TestCase(90.0, double.PositiveInfinity)] // - + [TestCase(120.0, -1.7320508075688772)] // -sqrt(3) + [TestCase(135.0, -1)] // -1 + [TestCase(150.0, -0.57735026918962573)] // -sqrt(3) / 3 + [TestCase(180.0, 0.0)] // 0 + [TestCase(210.0, 0.57735026918962573)] // sqrt(3) / 3 + [TestCase(225.0, 1.0)] // 1 + [TestCase(240.0, 1.7320508075688772)] // sqrt(3) + [TestCase(270.0, double.PositiveInfinity)] // - + [TestCase(300.0, -1.7320508075688772)] // -sqrt(3) + [TestCase(315.0, -1.0)] // -1 + [TestCase(330.0, -0.57735026918962573)] // -sqrt(3) / 3 + [TestCase(360.0, 0.0)] // 0 + [TestCase(1110.0, 0.57735026918962573)] // sqrt(3) / 3 + [TestCase(1770.0, -0.57735026918962573)] // -sqrt(3) / 3 + [TestCase(-390.0, -0.57735026918962573)] // -sqrt(3) / 3 public void ExecuteNumberTest(double degree, double expected) { var exp = new Tan(new Number(degree)); var result = (NumberValue)exp.Execute(); - Assert.Equal(expected, result.Number); + Assert.That(result.Number, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteRadianTest() { var exp = new Tan(AngleValue.Radian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(1.5574077246549021); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteDegreeTest() { var exp = new Tan(AngleValue.Degree(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.017455064928217585); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteGradianTest() { var exp = new Tan(AngleValue.Gradian(1).AsExpression()); var result = (NumberValue)exp.Execute(); var expected = new NumberValue(0.015709255323664916); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Tan(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); - Assert.Equal(-0.0098843750383224935, result.Real, 15); - Assert.Equal(0.96538587902213313, result.Imaginary, 15); + Assert.That(result.Real, Is.EqualTo(-0.0098843750383224935).Within(15)); + Assert.That(result.Imaginary, Is.EqualTo(0.96538587902213313).Within(15)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Tan(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Tan(Number.One); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/TruncTest.cs b/xFunc.Tests/Expressions/TruncTest.cs index b9e87a753..69af30d43 100644 --- a/xFunc.Tests/Expressions/TruncTest.cs +++ b/xFunc.Tests/Expressions/TruncTest.cs @@ -5,106 +5,106 @@ namespace xFunc.Tests.Expressions; public class TruncTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new Trunc(new Number(5.55555555)); var result = exp.Execute(); var expected = new NumberValue(5.0); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAngleTest() { var exp = new Trunc(AngleValue.Degree(5.55555555).AsExpression()); var result = exp.Execute(); var expected = AngleValue.Degree(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerTest() { var exp = new Trunc(PowerValue.Watt(5.55555555).AsExpression()); var result = exp.Execute(); var expected = PowerValue.Watt(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureTest() { var exp = new Trunc(TemperatureValue.Celsius(5.55555555).AsExpression()); var result = exp.Execute(); var expected = TemperatureValue.Celsius(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassTest() { var exp = new Trunc(MassValue.Gram(5.55555555).AsExpression()); var result = exp.Execute(); var expected = MassValue.Gram(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthTest() { var exp = new Trunc(LengthValue.Meter(5.55555555).AsExpression()); var result = exp.Execute(); var expected = LengthValue.Meter(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeTest() { var exp = new Trunc(TimeValue.Second(5.55555555).AsExpression()); var result = exp.Execute(); var expected = TimeValue.Second(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAreaTest() { var exp = new Trunc(AreaValue.Meter(5.55555555).AsExpression()); var result = exp.Execute(); var expected = AreaValue.Meter(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVolumeTest() { var exp = new Trunc(VolumeValue.Meter(5.55555555).AsExpression()); var result = exp.Execute(); var expected = VolumeValue.Meter(5); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTestException() => TestNotSupported(new Trunc(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new Trunc(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/UnaryMinusTest.cs b/xFunc.Tests/Expressions/UnaryMinusTest.cs index 067dad319..383608b14 100644 --- a/xFunc.Tests/Expressions/UnaryMinusTest.cs +++ b/xFunc.Tests/Expressions/UnaryMinusTest.cs @@ -7,119 +7,119 @@ namespace xFunc.Tests.Expressions; public class UnaryMinusTest : BaseExpressionTests { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new UnaryMinus(new Number(10)); - Assert.Equal(new NumberValue(-10.0), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(new NumberValue(-10.0))); } - [Fact] + [Test] public void ExecuteAngleNumberTest() { var exp = new UnaryMinus(AngleValue.Degree(10).AsExpression()); var expected = AngleValue.Degree(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecutePowerNumberTest() { var exp = new UnaryMinus(PowerValue.Watt(10).AsExpression()); var expected = PowerValue.Watt(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTemperatureNumberTest() { var exp = new UnaryMinus(TemperatureValue.Celsius(10).AsExpression()); var expected = TemperatureValue.Celsius(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteMassNumberTest() { var exp = new UnaryMinus(MassValue.Gram(10).AsExpression()); var expected = MassValue.Gram(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteLengthNumberTest() { var exp = new UnaryMinus(LengthValue.Meter(10).AsExpression()); var expected = LengthValue.Meter(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTimeNumberTest() { var exp = new UnaryMinus(TimeValue.Second(10).AsExpression()); var expected = TimeValue.Second(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAreaNumberTest() { var exp = new UnaryMinus(AreaValue.Meter(10).AsExpression()); var expected = AreaValue.Meter(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteVolumeNumberTest() { var exp = new UnaryMinus(VolumeValue.Meter(10).AsExpression()); var expected = VolumeValue.Meter(-10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteComplexTest() { var complex = new Complex(2, 3); var exp = new UnaryMinus(new ComplexNumber(complex)); - Assert.Equal(Complex.Negate(complex), exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(Complex.Negate(complex))); } - [Fact] + [Test] public void ExecuteRationalNumberTest() { var rational = new UnaryMinus(new Rational(Number.One, Number.Two)); var expected = new RationalValue(-1, 2); var actual = rational.Execute(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void NotSupportedException() => TestNotSupported(new UnaryMinus(Bool.False)); - [Fact] + [Test] public void CloneTest() { var exp = new UnaryMinus(Number.Zero); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new UnaryMinus(Number.One); @@ -127,7 +127,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new UnaryMinus(Number.One); diff --git a/xFunc.Tests/Expressions/UnaryTest.cs b/xFunc.Tests/Expressions/UnaryTest.cs index 1af48ad52..937031b79 100644 --- a/xFunc.Tests/Expressions/UnaryTest.cs +++ b/xFunc.Tests/Expressions/UnaryTest.cs @@ -5,25 +5,25 @@ namespace xFunc.Tests.Expressions; public class UnaryTest { - [Fact] + [Test] public void EqualsTest1() { var sine1 = new Sin(Number.Two); var sine2 = new Sin(Number.Two); - Assert.Equal(sine1, sine2); + Assert.That(sine2, Is.EqualTo(sine1)); } - [Fact] + [Test] public void EqualsTest2() { - var sine = new Sin(Number.Two); - var ln = new Ln(Number.Two); + var sine = new Sin(Number.Two) as IExpression; + var ln = new Ln(Number.Two) as IExpression; - Assert.NotEqual(sine, ln); + Assert.That(ln, Is.Not.EqualTo(sine)); } - [Fact] + [Test] public void ArgNullExceptionTest() { Assert.Throws(() => new Sin(null)); diff --git a/xFunc.Tests/Expressions/UnassignTest.cs b/xFunc.Tests/Expressions/UnassignTest.cs index 338c2e99a..2d245da41 100644 --- a/xFunc.Tests/Expressions/UnassignTest.cs +++ b/xFunc.Tests/Expressions/UnassignTest.cs @@ -5,70 +5,70 @@ namespace xFunc.Tests.Expressions; public class UnassignTest { - [Fact] + [Test] public void ExecuteFailTest() { Assert.Throws(() => new Unassign(Variable.X).Execute()); } - [Fact] + [Test] public void ExecuteParamNullTest() { Assert.Throws(() => new Unassign(Variable.X).Execute(null)); } - [Fact] + [Test] public void KeyNullTest() { Assert.Throws(() => new Unassign(null)); } - [Fact] + [Test] public void EqualRefTest() { var exp = new Unassign(Variable.X); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypesTest() { var exp1 = new Unassign(Variable.X); var exp2 = Number.Two; - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void EqualTest() { var exp1 = new Unassign(Variable.X); var exp2 = new Unassign(Variable.X); - Assert.True(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.True); } - [Fact] + [Test] public void Equal2Test() { var exp1 = new Unassign(Variable.X); var exp2 = new Unassign(Variable.Y); - Assert.False(exp1.Equals(exp2)); + Assert.That(exp1.Equals(exp2), Is.False); } - [Fact] + [Test] public void UndefVarTest() { var parameters = new ExpressionParameters { { "a", new NumberValue(1) } }; var undef = new Unassign(new Variable("a")); undef.Execute(parameters); - Assert.False(parameters.ContainsKey("a")); + Assert.That(parameters.ContainsKey("a"), Is.False); } - [Fact] + [Test] public void UndefFuncTest() { var lambda = Variable.X.ToLambda(Variable.X.Name); @@ -80,10 +80,10 @@ public void UndefFuncTest() var result = undef.Execute(parameters); - Assert.Equal("(x) => x", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("(x) => x")); } - [Fact] + [Test] public void UndefConstTest() { var parameters = new ExpressionParameters(); @@ -93,16 +93,16 @@ public void UndefConstTest() Assert.Throws(() => undef.Execute(parameters)); } - [Fact] + [Test] public void CloneTest() { var exp = new Unassign(Variable.X); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new Unassign(Variable.X); @@ -110,7 +110,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new Unassign(Variable.X); diff --git a/xFunc.Tests/Expressions/Units/AngleUnits/AngleTest.cs b/xFunc.Tests/Expressions/Units/AngleUnits/AngleTest.cs index 922a4c619..88b942d6a 100644 --- a/xFunc.Tests/Expressions/Units/AngleUnits/AngleTest.cs +++ b/xFunc.Tests/Expressions/Units/AngleUnits/AngleTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.AngleUnits; public class AngleTest { - [Fact] + [Test] public void EqualNullTest() { var exp = AngleValue.Degree(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = AngleValue.Degree(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = AngleValue.Degree(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = AngleValue.Degree(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = AngleValue.Degree(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = AngleValue.Degree(10).AsExpression(); var expected = AngleValue.Degree(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = AngleValue.Degree(10).AsExpression(); var expected = AngleValue.Degree(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = AngleValue.Degree(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = AngleValue.Degree(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/AngleUnits/AngleUnitTest.cs b/xFunc.Tests/Expressions/Units/AngleUnits/AngleUnitTest.cs index 266aa07e9..c76cef912 100644 --- a/xFunc.Tests/Expressions/Units/AngleUnits/AngleUnitTest.cs +++ b/xFunc.Tests/Expressions/Units/AngleUnits/AngleUnitTest.cs @@ -2,88 +2,88 @@ namespace xFunc.Tests.Expressions.Units.AngleUnits; public class AngleUnitTest { - [Fact] + [Test] public void EqualsNullTest() { var a = AngleUnit.Degree; - Assert.False(a.Equals(null)); + Assert.That(a.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsTest() { var a = AngleUnit.Degree; var b = AngleUnit.Degree; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var a = AngleUnit.Degree; var b = AngleUnit.Radian; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualsNullTest() { var a = AngleUnit.Degree; - Assert.False(a.Equals(null as object)); + Assert.That(a.Equals(null as object), Is.False); } - [Fact] + [Test] public void ObjectEqualsTest() { var a = AngleUnit.Degree; var b = AngleUnit.Degree as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectNotEqualsTest() { var a = AngleUnit.Degree; var b = 1 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var a = AngleUnit.Degree; var b = AngleUnit.Degree; - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest() { var a = AngleUnit.Degree; var b = AngleUnit.Radian; - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = AngleUnit.Degree; - Assert.Equal("degree", a.ToString()); + Assert.That(a.ToString(), Is.EqualTo("degree")); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => AngleUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/AngleUnits/AngleValueTest.cs b/xFunc.Tests/Expressions/Units/AngleUnits/AngleValueTest.cs index c4b71a9e2..d2ac77f64 100644 --- a/xFunc.Tests/Expressions/Units/AngleUnits/AngleValueTest.cs +++ b/xFunc.Tests/Expressions/Units/AngleUnits/AngleValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.AngleUnits; public class AngleValueTest { - [Fact] + [Test] public void EqualTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(10); - Assert.True(angle1.Equals(angle2)); + Assert.That(angle1.Equals(angle2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(10); - Assert.True(angle1 == angle2); + Assert.That(angle1 == angle2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(12); - Assert.True(angle1 != angle2); + Assert.That(angle1 != angle2, Is.True); } - [Fact] + [Test] public void LessTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(12); - Assert.True(angle1 < angle2); + Assert.That(angle1 < angle2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var angle1 = AngleValue.Degree(20); var angle2 = AngleValue.Degree(12); - Assert.False(angle1 < angle2); + Assert.That(angle1 < angle2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var angle1 = AngleValue.Degree(20); var angle2 = AngleValue.Degree(12); - Assert.True(angle1 > angle2); + Assert.That(angle1 > angle2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(12); - Assert.False(angle1 > angle2); + Assert.That(angle1 > angle2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(10); - Assert.True(angle1 <= angle2); + Assert.That(angle1 <= angle2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(10); - Assert.True(angle1 >= angle2); + Assert.That(angle1 >= angle2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var angle = AngleValue.Degree(10); - Assert.True(angle.CompareTo(null) > 0); + Assert.That(angle.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var angle1 = AngleValue.Degree(10); var angle2 = (object)AngleValue.Degree(10); - Assert.True(angle1.CompareTo(angle2) == 0); + Assert.That(angle1.CompareTo(angle2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var angle = AngleValue.Degree(10); @@ -111,163 +111,163 @@ public void CompareToDouble() Assert.Throws(() => angle.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(12); - Assert.False(angle1.Equals(angle2)); + Assert.That(angle1.Equals(angle2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Radian(10); - Assert.False(angle1.Equals(angle2)); + Assert.That(angle1.Equals(angle2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var angle1 = AngleValue.Degree(10); var angle2 = 3; - Assert.False(angle1.Equals(angle2)); + Assert.That(angle1.Equals(angle2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(10); - Assert.True(angle1.Equals(angle2 as object)); + Assert.That(angle1.Equals(angle2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var angle1 = AngleValue.Degree(10); var angle2 = AngleValue.Degree(20); - Assert.False(angle1.Equals(angle2 as object)); + Assert.That(angle1.Equals(angle2 as object), Is.False); } - [Fact] + [Test] public void ToStringDegreeTest() { var angle = AngleValue.Degree(10); - Assert.Equal("10 degree", angle.ToString()); + Assert.That(angle.ToString(), Is.EqualTo("10 degree")); } - [Fact] + [Test] public void ToStringRadianTest() { var angle = AngleValue.Radian(10); - Assert.Equal("10 radian", angle.ToString()); + Assert.That(angle.ToString(), Is.EqualTo("10 radian")); } - [Fact] + [Test] public void ToStringGradianTest() { var angle = AngleValue.Gradian(10); - Assert.Equal("10 gradian", angle.ToString()); + Assert.That(angle.ToString(), Is.EqualTo("10 gradian")); } - [Fact] + [Test] public void DegreeToDegreeTest() { var angle = AngleValue.Degree(10); var actual = angle.To(AngleUnit.Degree); var expected = AngleValue.Degree(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DegreeToRadianTest() { var angle = AngleValue.Degree(10); var actual = angle.To(AngleUnit.Radian); var expected = AngleValue.Radian(10 * Math.PI / 180); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void DegreeToGradianTest() { var angle = AngleValue.Degree(10); var actual = angle.To(AngleUnit.Gradian); var expected = AngleValue.Gradian(10 / 0.9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void RadianToDegreeTest() { var angle = AngleValue.Radian(10); var actual = angle.To(AngleUnit.Degree); var expected = AngleValue.Degree(10 * 180 / Math.PI); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void RadianToRadianTest() { var angle = AngleValue.Radian(10); var actual = angle.To(AngleUnit.Radian); var expected = AngleValue.Radian(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void RadianToGradianTest() { var angle = AngleValue.Radian(10); var actual = angle.To(AngleUnit.Gradian); var expected = AngleValue.Gradian(10 * 200 / Math.PI); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void GradianToDegreeTest() { var angle = AngleValue.Gradian(10); var actual = angle.To(AngleUnit.Degree); var expected = AngleValue.Degree(10 * 0.9); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void GradianToRadianTest() { var angle = AngleValue.Gradian(10); var actual = angle.To(AngleUnit.Radian); var expected = AngleValue.Radian(10 * Math.PI / 200); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void GradianToGradianTest() { var angle = AngleValue.Gradian(10); var actual = angle.To(AngleUnit.Gradian); var expected = AngleValue.Gradian(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } public static IEnumerable NormalizeTestsCases() @@ -292,14 +292,14 @@ public static IEnumerable NormalizeTestsCases() yield return new object[] { -434.0, AngleUnit.Gradian, 366 }; } - [Theory] - [MemberData(nameof(NormalizeTestsCases))] + [Test] + [TestCaseSource(nameof(NormalizeTestsCases))] public void NormalizeTests(double angleValue, AngleUnit unit, double expectedValue) { var angle = new AngleValue(new NumberValue(angleValue), unit); var normalized = angle.Normalize(); var expected = new AngleValue(new NumberValue(expectedValue), unit); - Assert.Equal(expected, normalized); + Assert.That(normalized, Is.EqualTo(expected)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/AngleUnits/ToDegreeTest.cs b/xFunc.Tests/Expressions/Units/AngleUnits/ToDegreeTest.cs index b09b17ce2..13ac1597c 100644 --- a/xFunc.Tests/Expressions/Units/AngleUnits/ToDegreeTest.cs +++ b/xFunc.Tests/Expressions/Units/AngleUnits/ToDegreeTest.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.Expressions.Units.AngleUnits; public class ToDegreeTest { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new ToDegree(new Number(10)); var actual = exp.Execute(); var expected = AngleValue.Degree(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAngleTest() { var exp = new ToDegree(AngleValue.Degree(10).AsExpression()); var actual = exp.Execute(); var expected = AngleValue.Degree(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteBoolTest() { Assert.Throws(() => new ToDegree(Bool.False).Execute()); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new ToDegree(new Number(10)); @@ -39,7 +39,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new ToDegree(new Number(10)); @@ -47,12 +47,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new ToDegree(new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/AngleUnits/ToGradianTest.cs b/xFunc.Tests/Expressions/Units/AngleUnits/ToGradianTest.cs index 5c50a4d8c..603b25c8d 100644 --- a/xFunc.Tests/Expressions/Units/AngleUnits/ToGradianTest.cs +++ b/xFunc.Tests/Expressions/Units/AngleUnits/ToGradianTest.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.Expressions.Units.AngleUnits; public class ToGradianTest { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new ToGradian(new Number(10)); var actual = exp.Execute(); var expected = AngleValue.Gradian(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAngleTest() { var exp = new ToGradian(AngleValue.Gradian(10).AsExpression()); var actual = exp.Execute(); var expected = AngleValue.Gradian(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteBoolTest() { Assert.Throws(() => new ToGradian(Bool.False).Execute()); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new ToGradian(new Number(10)); @@ -39,7 +39,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new ToGradian(new Number(10)); @@ -47,12 +47,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new ToGradian(new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/AngleUnits/ToRadianTest.cs b/xFunc.Tests/Expressions/Units/AngleUnits/ToRadianTest.cs index eafed5fbd..0e6bba379 100644 --- a/xFunc.Tests/Expressions/Units/AngleUnits/ToRadianTest.cs +++ b/xFunc.Tests/Expressions/Units/AngleUnits/ToRadianTest.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.Expressions.Units.AngleUnits; public class ToRadianTest { - [Fact] + [Test] public void ExecuteNumberTest() { var exp = new ToRadian(new Number(10)); var actual = exp.Execute(); var expected = AngleValue.Radian(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteAngleTest() { var exp = new ToRadian(AngleValue.Radian(10).AsExpression()); var actual = exp.Execute(); var expected = AngleValue.Radian(10); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteBoolTest() { Assert.Throws(() => new ToRadian(Bool.False).Execute()); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = new ToRadian(new Number(10)); @@ -39,7 +39,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = new ToRadian(new Number(10)); @@ -47,12 +47,12 @@ public void NullAnalyzerTest2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void CloneTest() { var exp = new ToRadian(new Number(10)); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/AreaUnits/AreaTest.cs b/xFunc.Tests/Expressions/Units/AreaUnits/AreaTest.cs index f73d07134..51b0f4380 100644 --- a/xFunc.Tests/Expressions/Units/AreaUnits/AreaTest.cs +++ b/xFunc.Tests/Expressions/Units/AreaUnits/AreaTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.AreaUnits; public class AreaTest { - [Fact] + [Test] public void EqualNullTest() { var exp = AreaValue.Meter(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = AreaValue.Meter(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = AreaValue.Meter(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = AreaValue.Meter(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = AreaValue.Meter(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = AreaValue.Meter(10).AsExpression(); var expected = AreaValue.Meter(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = AreaValue.Meter(10).AsExpression(); var expected = AreaValue.Meter(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = AreaValue.Meter(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = AreaValue.Meter(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/AreaUnits/AreaUnitTest.cs b/xFunc.Tests/Expressions/Units/AreaUnits/AreaUnitTest.cs index 8ea30272e..fcca8f5d4 100644 --- a/xFunc.Tests/Expressions/Units/AreaUnits/AreaUnitTest.cs +++ b/xFunc.Tests/Expressions/Units/AreaUnits/AreaUnitTest.cs @@ -5,82 +5,82 @@ namespace xFunc.Tests.Expressions.Units.AreaUnits; public class AreaUnitTest { - [Fact] + [Test] public void EqualsNullTest() { var a = AreaUnit.Meter; - Assert.False(a.Equals(null)); + Assert.That(a.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsTest() { var a = AreaUnit.Meter; var b = AreaUnit.Meter; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var a = AreaUnit.Meter; var b = AreaUnit.Kilometer; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualsNullTest() { var a = AreaUnit.Meter; - Assert.False(a.Equals(null as object)); + Assert.That(a.Equals(null as object), Is.False); } - [Fact] + [Test] public void ObjectEqualsTest() { var a = AreaUnit.Meter; var b = AreaUnit.Meter as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectEqualsWithDifferentTypesTest() { var a = AreaUnit.Meter; var b = 1 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var a = AreaUnit.Meter; var b = AreaUnit.Meter; - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest() { var a = AreaUnit.Meter; var b = AreaUnit.Kilometer; - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = AreaUnit.Meter; - Assert.Equal("m^2", a.ToString()); + Assert.That(a.ToString(), Is.EqualTo("m^2")); } public static IEnumerable GetToVolumeUnitTest() @@ -92,13 +92,13 @@ public static IEnumerable GetToVolumeUnitTest() yield return new object[] { AreaUnit.Yard, VolumeUnit.Yard }; } - [Theory] - [MemberData(nameof(GetToVolumeUnitTest))] + [Test] + [TestCaseSource(nameof(GetToVolumeUnitTest))] public void ToVolumeUnitTest(AreaUnit unit, VolumeUnit expected) { var actual = unit.ToVolumeUnit(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } public static IEnumerable GetToVolumeUnitExceptionTest() @@ -110,15 +110,15 @@ public static IEnumerable GetToVolumeUnitExceptionTest() yield return new object[] { AreaUnit.Acre }; } - [Theory] - [MemberData(nameof(GetToVolumeUnitExceptionTest))] + [Test] + [TestCaseSource(nameof(GetToVolumeUnitExceptionTest))] public void ToVolumeUnitExceptionTest(AreaUnit unit) - => Assert.Throws(unit.ToVolumeUnit); + => Assert.Throws(() => unit.ToVolumeUnit()); - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => AreaUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/AreaUnits/AreaValueTest.cs b/xFunc.Tests/Expressions/Units/AreaUnits/AreaValueTest.cs index 477dce04e..e0c5ab87d 100644 --- a/xFunc.Tests/Expressions/Units/AreaUnits/AreaValueTest.cs +++ b/xFunc.Tests/Expressions/Units/AreaUnits/AreaValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.AreaUnits; public class AreaValueTest { - [Fact] + [Test] public void EqualTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(10); - Assert.True(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(10); - Assert.True(area1 == area2); + Assert.That(area1 == area2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(12); - Assert.True(area1 != area2); + Assert.That(area1 != area2, Is.True); } - [Fact] + [Test] public void LessTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(12); - Assert.True(area1 < area2); + Assert.That(area1 < area2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var area1 = AreaValue.Meter(20); var area2 = AreaValue.Meter(12); - Assert.False(area1 < area2); + Assert.That(area1 < area2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var area1 = AreaValue.Meter(20); var area2 = AreaValue.Meter(12); - Assert.True(area1 > area2); + Assert.That(area1 > area2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(12); - Assert.False(area1 > area2); + Assert.That(area1 > area2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(10); - Assert.True(area1 <= area2); + Assert.That(area1 <= area2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(10); - Assert.True(area1 >= area2); + Assert.That(area1 >= area2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var areaValue = AreaValue.Meter(10); - Assert.True(areaValue.CompareTo(null) > 0); + Assert.That(areaValue.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var area1 = AreaValue.Meter(10); var area2 = (object)AreaValue.Meter(10); - Assert.True(area1.CompareTo(area2) == 0); + Assert.That(area1.CompareTo(area2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var areaValue = AreaValue.Meter(10); @@ -111,60 +111,60 @@ public void CompareToDouble() Assert.Throws(() => areaValue.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(12); - Assert.False(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Kilometer(10); - Assert.False(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var area1 = AreaValue.Meter(10); var area2 = 3; - Assert.False(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(10); - Assert.True(area1.Equals(area2 as object)); + Assert.That(area1.Equals(area2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var area1 = AreaValue.Meter(10); var area2 = AreaValue.Meter(20); - Assert.False(area1.Equals(area2 as object)); + Assert.That(area1.Equals(area2 as object), Is.False); } - [Fact] + [Test] public void ToStringSecondTest() { var areaValue = AreaValue.Meter(10); - Assert.Equal("10 m^2", areaValue.ToString()); + Assert.That(areaValue.ToString(), Is.EqualTo("10 m^2")); } - [Fact] + [Test] public void AddOperatorTest() { var area1 = AreaValue.Meter(1); @@ -172,10 +172,10 @@ public void AddOperatorTest() var expected = AreaValue.Meter(1000001); var result = area1 + area2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperatorTest() { var area1 = AreaValue.Kilometer(1); @@ -183,7 +183,7 @@ public void SubOperatorTest() var expected = AreaValue.Kilometer(0.5); var result = area1 - area2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConversionTestCases() @@ -299,13 +299,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, AreaUnit.Acre, AreaUnit.Hectare, 4.0468564224 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, AreaUnit unit, AreaUnit to, double expected) { var area = new AreaValue(new NumberValue(value), unit); var converted = area.To(to); - Assert.Equal(expected, converted.Value.Number, 5); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(5)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/ConvertTests.cs b/xFunc.Tests/Expressions/Units/ConvertTests.cs index 8e3fcc8d5..018837627 100644 --- a/xFunc.Tests/Expressions/Units/ConvertTests.cs +++ b/xFunc.Tests/Expressions/Units/ConvertTests.cs @@ -7,13 +7,13 @@ namespace xFunc.Tests.Expressions.Units; public class ConvertTests { - [Fact] + [Test] public void NullConverterTest() { Assert.Throws(() => new Convert(null, null, null)); } - [Fact] + [Test] public void NullValueTest() { var converter = new Converter(); @@ -21,7 +21,7 @@ public void NullValueTest() Assert.Throws(() => new Convert(converter, null, null)); } - [Fact] + [Test] public void NullUnitTest() { var converter = new Converter(); @@ -30,65 +30,65 @@ public void NullUnitTest() Assert.Throws(() => new Convert(converter, value, null)); } - [Fact] + [Test] public void EqualSameObjects() { var converter = new Converter(); var convert = new Convert(converter, Number.One, new StringExpression("deg")); - Assert.True(convert.Equals(convert)); + Assert.That(convert.Equals(convert), Is.True); } - [Fact] + [Test] public void EqualNull() { var converter = new Converter(); var convert = new Convert(converter, Number.One, new StringExpression("deg")); - Assert.False(convert.Equals(null)); + Assert.That(convert.Equals(null), Is.False); } - [Fact] + [Test] public void EqualDifferentObject() { var converter = new Converter(); var convert = new Convert(converter, Number.One, new StringExpression("deg")); var number = Number.One; - Assert.False(convert.Equals(number)); + Assert.That(convert.Equals(number), Is.False); } - [Fact] + [Test] public void EqualDifferentValues() { var converter = new Converter(); var convert1 = new Convert(converter, Number.One, new StringExpression("deg")); var convert2 = new Convert(converter, Number.Two, new StringExpression("deg")); - Assert.False(convert1.Equals(convert2)); + Assert.That(convert1.Equals(convert2), Is.False); } - [Fact] + [Test] public void EqualDifferentUnits() { var converter = new Converter(); var convert1 = new Convert(converter, Number.One, new StringExpression("deg")); var convert2 = new Convert(converter, Number.One, new StringExpression("rad")); - Assert.False(convert1.Equals(convert2)); + Assert.That(convert1.Equals(convert2), Is.False); } - [Fact] + [Test] public void EqualObjects() { var converter = new Converter(); var convert1 = new Convert(converter, Number.One, new StringExpression("deg")); var convert2 = new Convert(converter, Number.One, new StringExpression("deg")); - Assert.True(convert1.Equals(convert2)); + Assert.That(convert1.Equals(convert2), Is.True); } - [Fact] + [Test] public void Execute() { var converter = new Converter(); @@ -97,10 +97,10 @@ public void Execute() var result = convert.Execute(); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteNotSupported() { var converter = new Converter(); @@ -109,16 +109,16 @@ public void ExecuteNotSupported() Assert.Throws(() => convert.Execute()); } - [Fact] + [Test] public void CloneTest() { var exp = new Convert(new Converter(), Number.One, new StringExpression("deg")); var clone = exp.Clone(); - Assert.Equal(exp, clone); + Assert.That(clone, Is.EqualTo(exp)); } - [Fact] + [Test] public void MatrixAnalyzeNull() { var exp = new Convert(new Converter(), Number.One, new StringExpression("deg")); @@ -126,7 +126,7 @@ public void MatrixAnalyzeNull() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void MatrixAnalyzeNull2() { var exp = new Convert(new Converter(), Number.One, new StringExpression("deg")); @@ -134,7 +134,7 @@ public void MatrixAnalyzeNull2() Assert.Throws(() => exp.Analyze(null, null)); } - [Fact] + [Test] public void AnalyzeNotSupported() { var diff = new Differentiator(); diff --git a/xFunc.Tests/Expressions/Units/Converters/AngleConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/AngleConverterTests.cs index 329e2451e..a13ae7cbd 100644 --- a/xFunc.Tests/Expressions/Units/Converters/AngleConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/AngleConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class AngleConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new AngleConverter(); @@ -42,14 +42,14 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "gradians", AngleValue.Gradian(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new AngleConverter(); var result = converter.Convert(value, unit); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -58,8 +58,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new AngleConverter(); @@ -67,7 +67,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new AngleConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/AreaConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/AreaConverterTests.cs index c79bb6bc2..e36fc46e6 100644 --- a/xFunc.Tests/Expressions/Units/Converters/AreaConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/AreaConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class AreaConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new AreaConverter(); @@ -44,16 +44,16 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "ac", AreaValue.Acre(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new AreaConverter(); var result = converter.Convert(value, unit); var resultAsObject = ((IConverter)converter).Convert(value, unit); - Assert.Equal(expected, result); - Assert.Equal(expected, resultAsObject); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(resultAsObject, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -62,8 +62,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new AreaConverter(); @@ -71,7 +71,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new AreaConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/ConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/ConverterTests.cs index d119201a4..2a8d1fc4c 100644 --- a/xFunc.Tests/Expressions/Units/Converters/ConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/ConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class ConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new Converter(); @@ -30,17 +30,17 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { temperature, "k", temperature.ToKelvin() }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new Converter(); var result = converter.Convert(value, unit); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ConvertUnsupportedUnit() { var converter = new Converter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/LengthConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/LengthConverterTests.cs index 5a624cf1b..b07fc3517 100644 --- a/xFunc.Tests/Expressions/Units/Converters/LengthConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/LengthConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class LengthConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new LengthConverter(); @@ -58,16 +58,16 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "pc", LengthValue.Parsec(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new LengthConverter(); var result = converter.Convert(value, unit); var resultAsObject = ((IConverter)converter).Convert(value, unit); - Assert.Equal(expected, result); - Assert.Equal(expected, resultAsObject); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(resultAsObject, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -76,8 +76,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new LengthConverter(); @@ -85,7 +85,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new LengthConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/MassConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/MassConverterTests.cs index 4147106bf..a5e0a6c3b 100644 --- a/xFunc.Tests/Expressions/Units/Converters/MassConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/MassConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class MassConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new MassConverter(); @@ -36,16 +36,16 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "lb", MassValue.Pound(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new MassConverter(); var result = converter.Convert(value, unit); var resultAsObject = ((IConverter)converter).Convert(value, unit); - Assert.Equal(expected, result); - Assert.Equal(expected, resultAsObject); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(resultAsObject, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -54,8 +54,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new MassConverter(); @@ -63,7 +63,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new MassConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/PowerConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/PowerConverterTests.cs index 3cb323873..1ff7b35a3 100644 --- a/xFunc.Tests/Expressions/Units/Converters/PowerConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/PowerConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class PowerConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new PowerConverter(); @@ -30,14 +30,14 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "hp", PowerValue.Horsepower(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new PowerConverter(); var result = converter.Convert(value, unit); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -46,8 +46,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new PowerConverter(); @@ -55,7 +55,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new PowerConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/TemperatureConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/TemperatureConverterTests.cs index 9437935d3..2adec2f85 100644 --- a/xFunc.Tests/Expressions/Units/Converters/TemperatureConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/TemperatureConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class TemperatureConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new TemperatureConverter(); @@ -30,14 +30,14 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "k", TemperatureValue.Kelvin(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new TemperatureConverter(); var result = converter.Convert(value, unit); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -46,8 +46,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new TemperatureConverter(); @@ -55,7 +55,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new TemperatureConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/TimeConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/TimeConverterTests.cs index 237575805..5579ef110 100644 --- a/xFunc.Tests/Expressions/Units/Converters/TimeConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/TimeConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class TimeConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new TimeConverter(); @@ -42,16 +42,16 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "year", TimeValue.Year(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new TimeConverter(); var result = converter.Convert(value, unit); var resultAsObject = ((IConverter)converter).Convert(value, unit); - Assert.Equal(expected, result); - Assert.Equal(expected, resultAsObject); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(resultAsObject, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -60,8 +60,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new TimeConverter(); @@ -69,7 +69,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new TimeConverter(); diff --git a/xFunc.Tests/Expressions/Units/Converters/VolumeConverterTests.cs b/xFunc.Tests/Expressions/Units/Converters/VolumeConverterTests.cs index d270925b7..9452cd03d 100644 --- a/xFunc.Tests/Expressions/Units/Converters/VolumeConverterTests.cs +++ b/xFunc.Tests/Expressions/Units/Converters/VolumeConverterTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.Expressions.Units.Converters; public class VolumeConverterTests { - [Theory] - [InlineData(null, null)] - [InlineData(1, null)] + [Test] + [TestCase(null, null)] + [TestCase(1, null)] public void ConvertNull(object value, string unit) { var converter = new VolumeConverter(); @@ -38,16 +38,16 @@ public static IEnumerable GetConvertTestsData() yield return new object[] { number, "gal", VolumeValue.Gallon(number) }; } - [Theory] - [MemberData(nameof(GetConvertTestsData))] + [Test] + [TestCaseSource(nameof(GetConvertTestsData))] public void ConvertTests(object value, string unit, object expected) { var converter = new VolumeConverter(); var result = converter.Convert(value, unit); var resultAsObject = ((IConverter)converter).Convert(value, unit); - Assert.Equal(expected, result); - Assert.Equal(expected, resultAsObject); + Assert.That(result, Is.EqualTo(expected)); + Assert.That(resultAsObject, Is.EqualTo(expected)); } public static IEnumerable GetConvertUnsupportedUnitData() @@ -56,8 +56,8 @@ public static IEnumerable GetConvertUnsupportedUnitData() yield return new object[] { new NumberValue(10), "xxx" }; } - [Theory] - [MemberData(nameof(GetConvertUnsupportedUnitData))] + [Test] + [TestCaseSource(nameof(GetConvertUnsupportedUnitData))] public void ConvertUnsupportedUnit(object value, string unit) { var converter = new VolumeConverter(); @@ -65,7 +65,7 @@ public void ConvertUnsupportedUnit(object value, string unit) Assert.Throws(() => converter.Convert(value, unit)); } - [Fact] + [Test] public void ConvertUnsupportedValue() { var converter = new VolumeConverter(); diff --git a/xFunc.Tests/Expressions/Units/LengthUnits/LengthTest.cs b/xFunc.Tests/Expressions/Units/LengthUnits/LengthTest.cs index 3a39d326a..350d23e33 100644 --- a/xFunc.Tests/Expressions/Units/LengthUnits/LengthTest.cs +++ b/xFunc.Tests/Expressions/Units/LengthUnits/LengthTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.LengthUnits; public class LengthTest { - [Fact] + [Test] public void EqualNullTest() { var exp = LengthValue.Meter(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = LengthValue.Meter(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = LengthValue.Meter(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = LengthValue.Meter(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = LengthValue.Meter(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = LengthValue.Meter(10).AsExpression(); var expected = LengthValue.Meter(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = LengthValue.Meter(10).AsExpression(); var expected = LengthValue.Meter(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = LengthValue.Meter(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = LengthValue.Meter(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/LengthUnits/LengthUnitTest.cs b/xFunc.Tests/Expressions/Units/LengthUnits/LengthUnitTest.cs index 747e04b2f..49102b4fb 100644 --- a/xFunc.Tests/Expressions/Units/LengthUnits/LengthUnitTest.cs +++ b/xFunc.Tests/Expressions/Units/LengthUnits/LengthUnitTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.LengthUnits; public class LengthUnitTest { - [Fact] + [Test] public void EqualsTest() { var a = LengthUnit.Meter; var b = LengthUnit.Meter; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var a = LengthUnit.Meter; var b = LengthUnit.Millimeter; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualsTest() { var a = LengthUnit.Meter; var b = LengthUnit.Meter as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectEqualsWithDifferentTypesTest() { var a = LengthUnit.Meter; var b = 1 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var a = LengthUnit.Meter; var b = LengthUnit.Meter; - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest() { var a = LengthUnit.Meter; var b = LengthUnit.Millimeter; - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = LengthUnit.Meter; - Assert.Equal("m", a.ToString()); + Assert.That(a.ToString(), Is.EqualTo("m")); } public static IEnumerable GetToAreaUnitTest() @@ -79,13 +79,13 @@ public static IEnumerable GetToAreaUnitTest() yield return new object[] { LengthUnit.Mile, AreaUnit.Mile }; } - [Theory] - [MemberData(nameof(GetToAreaUnitTest))] + [Test] + [TestCaseSource(nameof(GetToAreaUnitTest))] public void ToAreaUnitTest(LengthUnit unit, AreaUnit expected) { var actual = unit.ToAreaUnit(); - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } public static IEnumerable GetToAreaUnitExceptionTest() @@ -101,15 +101,15 @@ public static IEnumerable GetToAreaUnitExceptionTest() yield return new object[] { LengthUnit.Parsec }; } - [Theory] - [MemberData(nameof(GetToAreaUnitExceptionTest))] + [Test] + [TestCaseSource(nameof(GetToAreaUnitExceptionTest))] public void ToAreaUnitExceptionTest(LengthUnit unit) - => Assert.Throws(unit.ToAreaUnit); + => Assert.Throws(() => unit.ToAreaUnit()); - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => LengthUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/LengthUnits/LengthValueTest.cs b/xFunc.Tests/Expressions/Units/LengthUnits/LengthValueTest.cs index 0bf5901c2..7e6d35915 100644 --- a/xFunc.Tests/Expressions/Units/LengthUnits/LengthValueTest.cs +++ b/xFunc.Tests/Expressions/Units/LengthUnits/LengthValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.LengthUnits; public class LengthValueTest { - [Fact] + [Test] public void EqualTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(10); - Assert.True(length1.Equals(length2)); + Assert.That(length1.Equals(length2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(10); - Assert.True(length1 == length2); + Assert.That(length1 == length2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(12); - Assert.True(length1 != length2); + Assert.That(length1 != length2, Is.True); } - [Fact] + [Test] public void LessTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(12); - Assert.True(length1 < length2); + Assert.That(length1 < length2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var length1 = LengthValue.Meter(20); var length2 = LengthValue.Meter(12); - Assert.False(length1 < length2); + Assert.That(length1 < length2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var length1 = LengthValue.Meter(20); var length2 = LengthValue.Meter(12); - Assert.True(length1 > length2); + Assert.That(length1 > length2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(12); - Assert.False(length1 > length2); + Assert.That(length1 > length2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(10); - Assert.True(length1 <= length2); + Assert.That(length1 <= length2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(10); - Assert.True(length1 >= length2); + Assert.That(length1 >= length2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var length = LengthValue.Meter(10); - Assert.True(length.CompareTo(null) > 0); + Assert.That(length.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var length1 = LengthValue.Meter(10); var length2 = (object)LengthValue.Meter(10); - Assert.True(length1.CompareTo(length2) == 0); + Assert.That(length1.CompareTo(length2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var length = LengthValue.Meter(10); @@ -111,188 +111,188 @@ public void CompareToDouble() Assert.Throws(() => length.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(12); - Assert.False(length1.Equals(length2)); + Assert.That(length1.Equals(length2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Kilometer(10); - Assert.False(length1.Equals(length2)); + Assert.That(length1.Equals(length2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var length1 = LengthValue.Meter(10); var length2 = 3; - Assert.False(length1.Equals(length2)); + Assert.That(length1.Equals(length2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(10); - Assert.True(length1.Equals(length2 as object)); + Assert.That(length1.Equals(length2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var length1 = LengthValue.Meter(10); var length2 = LengthValue.Meter(20); - Assert.False(length1.Equals(length2 as object)); + Assert.That(length1.Equals(length2 as object), Is.False); } - [Fact] + [Test] public void ToStringMeterTest() { var length = LengthValue.Meter(10); - Assert.Equal("10 m", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 m")); } - [Fact] + [Test] public void ToStringNanometerTest() { var length = LengthValue.Nanometer(10); - Assert.Equal("10 nm", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 nm")); } - [Fact] + [Test] public void ToStringMicrometerTest() { var length = LengthValue.Micrometer(10); - Assert.Equal("10 µm", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 µm")); } - [Fact] + [Test] public void ToStringMillimeterTest() { var length = LengthValue.Millimeter(10); - Assert.Equal("10 mm", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 mm")); } - [Fact] + [Test] public void ToStringCentimeterTest() { var length = LengthValue.Centimeter(10); - Assert.Equal("10 cm", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 cm")); } - [Fact] + [Test] public void ToStringDecimeterTest() { var length = LengthValue.Decimeter(10); - Assert.Equal("10 dm", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 dm")); } - [Fact] + [Test] public void ToStringKilometerTest() { var length = LengthValue.Kilometer(10); - Assert.Equal("10 km", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 km")); } - [Fact] + [Test] public void ToStringInchTest() { var length = LengthValue.Inch(10); - Assert.Equal("10 in", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 in")); } - [Fact] + [Test] public void ToStringFootTest() { var length = LengthValue.Foot(10); - Assert.Equal("10 ft", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 ft")); } - [Fact] + [Test] public void ToStringYardTest() { var length = LengthValue.Yard(10); - Assert.Equal("10 yd", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 yd")); } - [Fact] + [Test] public void ToStringMileTest() { var length = LengthValue.Mile(10); - Assert.Equal("10 mi", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 mi")); } - [Fact] + [Test] public void ToStringNauticalMileTest() { var length = LengthValue.NauticalMile(10); - Assert.Equal("10 nmi", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 nmi")); } - [Fact] + [Test] public void ToStringChainTest() { var length = LengthValue.Chain(10); - Assert.Equal("10 ch", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 ch")); } - [Fact] + [Test] public void ToStringRodTest() { var length = LengthValue.Rod(10); - Assert.Equal("10 rd", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 rd")); } - [Fact] + [Test] public void ToStringAstronomicalUnitTest() { var length = LengthValue.AstronomicalUnit(10); - Assert.Equal("10 au", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 au")); } - [Fact] + [Test] public void ToStringLightYearTest() { var length = LengthValue.LightYear(10); - Assert.Equal("10 ly", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 ly")); } - [Fact] + [Test] public void ToStringParsecTest() { var length = LengthValue.Parsec(10); - Assert.Equal("10 pc", length.ToString()); + Assert.That(length.ToString(), Is.EqualTo("10 pc")); } - [Fact] + [Test] public void AddOperatorTest() { var length1 = LengthValue.Meter(1); @@ -300,10 +300,10 @@ public void AddOperatorTest() var expected = LengthValue.Meter(1001); var result = length1 + length2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperatorTest() { var length1 = LengthValue.Kilometer(1); @@ -311,10 +311,10 @@ public void SubOperatorTest() var expected = LengthValue.Kilometer(0.999); var result = length1 - length2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulOperatorTest() { var length1 = LengthValue.Kilometer(2); @@ -322,10 +322,10 @@ public void MulOperatorTest() var expected = AreaValue.Kilometer(4); var result = length1 * length2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulOperatorAreaLengthTest() { var length1 = AreaValue.Centimeter(20000); @@ -333,10 +333,10 @@ public void MulOperatorAreaLengthTest() var expected = VolumeValue.Centimeter(40000); var result = length1 * length2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void MulOperatorLengthAreaTest() { var length1 = LengthValue.Meter(2); @@ -344,7 +344,7 @@ public void MulOperatorLengthAreaTest() var expected = VolumeValue.Centimeter(40000); var result = length1 * length2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConversionTestCases() @@ -656,13 +656,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, LengthUnit.Parsec, LengthUnit.LightYear, 32.615637769 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, LengthUnit unit, LengthUnit to, double expected) { var length = new LengthValue(new NumberValue(value), unit); var converted = length.To(to); - Assert.Equal(expected, converted.Value.Number, 5); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(5)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/MassUnits/MassTest.cs b/xFunc.Tests/Expressions/Units/MassUnits/MassTest.cs index 88b30c7f5..71a7a30b2 100644 --- a/xFunc.Tests/Expressions/Units/MassUnits/MassTest.cs +++ b/xFunc.Tests/Expressions/Units/MassUnits/MassTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.MassUnits; public class MassTest { - [Fact] + [Test] public void EqualNullTest() { var exp = MassValue.Gram(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = MassValue.Gram(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = MassValue.Gram(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = MassValue.Gram(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = MassValue.Gram(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = MassValue.Gram(10).AsExpression(); var expected = MassValue.Gram(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = MassValue.Gram(10).AsExpression(); var expected = MassValue.Gram(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = MassValue.Gram(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = MassValue.Gram(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/MassUnits/MassUnitTest.cs b/xFunc.Tests/Expressions/Units/MassUnits/MassUnitTest.cs index 5db721b2b..106e4ebb7 100644 --- a/xFunc.Tests/Expressions/Units/MassUnits/MassUnitTest.cs +++ b/xFunc.Tests/Expressions/Units/MassUnits/MassUnitTest.cs @@ -5,72 +5,72 @@ namespace xFunc.Tests.Expressions.Units.MassUnits; public class MassUnitTest { - [Fact] + [Test] public void EqualsTest() { var a = MassUnit.Kilogram; var b = MassUnit.Kilogram; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var a = MassUnit.Kilogram; var b = MassUnit.Gram; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualsTest() { var a = MassUnit.Kilogram; var b = MassUnit.Kilogram as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectEqualsWithDifferentTypesTest() { var a = MassUnit.Kilogram; var b = 1 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var a = MassUnit.Kilogram; var b = MassUnit.Kilogram; - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest() { var a = MassUnit.Kilogram; var b = MassUnit.Gram; - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = MassUnit.Kilogram; - Assert.Equal("kg", a.ToString()); + Assert.That(a.ToString(), Is.EqualTo("kg")); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => MassUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/MassUnits/MassValueTest.cs b/xFunc.Tests/Expressions/Units/MassUnits/MassValueTest.cs index 6aa04b99e..23ca47ba5 100644 --- a/xFunc.Tests/Expressions/Units/MassUnits/MassValueTest.cs +++ b/xFunc.Tests/Expressions/Units/MassUnits/MassValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.MassUnits; public class MassValueTest { - [Fact] + [Test] public void EqualTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(10); - Assert.True(mass1.Equals(mass2)); + Assert.That(mass1.Equals(mass2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(10); - Assert.True(mass1 == mass2); + Assert.That(mass1 == mass2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(12); - Assert.True(mass1 != mass2); + Assert.That(mass1 != mass2, Is.True); } - [Fact] + [Test] public void LessTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(12); - Assert.True(mass1 < mass2); + Assert.That(mass1 < mass2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var mass1 = MassValue.Gram(20); var mass2 = MassValue.Gram(12); - Assert.False(mass1 < mass2); + Assert.That(mass1 < mass2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var mass1 = MassValue.Gram(20); var mass2 = MassValue.Gram(12); - Assert.True(mass1 > mass2); + Assert.That(mass1 > mass2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(12); - Assert.False(mass1 > mass2); + Assert.That(mass1 > mass2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(10); - Assert.True(mass1 <= mass2); + Assert.That(mass1 <= mass2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(10); - Assert.True(mass1 >= mass2); + Assert.That(mass1 >= mass2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var mass = MassValue.Gram(10); - Assert.True(mass.CompareTo(null) > 0); + Assert.That(mass.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var mass1 = MassValue.Gram(10); var mass2 = (object)MassValue.Gram(10); - Assert.True(mass1.CompareTo(mass2) == 0); + Assert.That(mass1.CompareTo(mass2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var mass = MassValue.Gram(10); @@ -111,100 +111,100 @@ public void CompareToDouble() Assert.Throws(() => mass.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(12); - Assert.False(mass1.Equals(mass2)); + Assert.That(mass1.Equals(mass2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Kilogram(10); - Assert.False(mass1.Equals(mass2)); + Assert.That(mass1.Equals(mass2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var mass1 = MassValue.Gram(10); var mass2 = 3; - Assert.False(mass1.Equals(mass2)); + Assert.That(mass1.Equals(mass2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(10); - Assert.True(mass1.Equals(mass2 as object)); + Assert.That(mass1.Equals(mass2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var mass1 = MassValue.Gram(10); var mass2 = MassValue.Gram(20); - Assert.False(mass1.Equals(mass2 as object)); + Assert.That(mass1.Equals(mass2 as object), Is.False); } - [Fact] + [Test] public void ToStringMilligramTest() { var mass = MassValue.Milligram(10); - Assert.Equal("10 mg", mass.ToString()); + Assert.That(mass.ToString(), Is.EqualTo("10 mg")); } - [Fact] + [Test] public void ToStringGramTest() { var mass = MassValue.Gram(10); - Assert.Equal("10 g", mass.ToString()); + Assert.That(mass.ToString(), Is.EqualTo("10 g")); } - [Fact] + [Test] public void ToStringKilogramTest() { var mass = MassValue.Kilogram(10); - Assert.Equal("10 kg", mass.ToString()); + Assert.That(mass.ToString(), Is.EqualTo("10 kg")); } - [Fact] + [Test] public void ToStringTonneTest() { var mass = MassValue.Tonne(10); - Assert.Equal("10 t", mass.ToString()); + Assert.That(mass.ToString(), Is.EqualTo("10 t")); } - [Fact] + [Test] public void ToStringOunceTest() { var mass = MassValue.Ounce(10); - Assert.Equal("10 oz", mass.ToString()); + Assert.That(mass.ToString(), Is.EqualTo("10 oz")); } - [Fact] + [Test] public void ToStringPoundTest() { var mass = MassValue.Pound(10); - Assert.Equal("10 lb", mass.ToString()); + Assert.That(mass.ToString(), Is.EqualTo("10 lb")); } - [Fact] + [Test] public void AddOperatorTest() { var mass1 = MassValue.Gram(1); @@ -212,10 +212,10 @@ public void AddOperatorTest() var expected = MassValue.Gram(1001); var result = mass1 + mass2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperatorTest() { var mass1 = MassValue.Kilogram(1); @@ -223,7 +223,7 @@ public void SubOperatorTest() var expected = MassValue.Kilogram(0.999); var result = mass1 - mass2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConversionTestCases() @@ -266,13 +266,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, MassUnit.Pound, MassUnit.Ounce, 160.0 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, MassUnit unit, MassUnit to, double expected) { var mass = new MassValue(new NumberValue(value), unit); var converted = mass.To(to); - Assert.Equal(expected, converted.Value.Number, 6); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(6)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/PowerUnits/PowerTest.cs b/xFunc.Tests/Expressions/Units/PowerUnits/PowerTest.cs index dfe1be0e6..8878de807 100644 --- a/xFunc.Tests/Expressions/Units/PowerUnits/PowerTest.cs +++ b/xFunc.Tests/Expressions/Units/PowerUnits/PowerTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.PowerUnits; public class PowerTest { - [Fact] + [Test] public void EqualNullTest() { var exp = PowerValue.Watt(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = PowerValue.Watt(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = PowerValue.Watt(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = PowerValue.Watt(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = PowerValue.Watt(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = PowerValue.Watt(10).AsExpression(); var expected = PowerValue.Watt(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = PowerValue.Watt(10).AsExpression(); var expected = PowerValue.Watt(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = PowerValue.Watt(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = PowerValue.Watt(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/PowerUnits/PowerUnitTests.cs b/xFunc.Tests/Expressions/Units/PowerUnits/PowerUnitTests.cs index 1b4990a24..f4fdf8e23 100644 --- a/xFunc.Tests/Expressions/Units/PowerUnits/PowerUnitTests.cs +++ b/xFunc.Tests/Expressions/Units/PowerUnits/PowerUnitTests.cs @@ -2,64 +2,64 @@ namespace xFunc.Tests.Expressions.Units.PowerUnits; public class PowerUnitTests { - [Fact] + [Test] public void EqualTest() { var left = PowerUnit.Watt; var right = PowerUnit.Watt; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void NotEqualTest() { var left = PowerUnit.Watt; var right = PowerUnit.Kilowatt; - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void ObjectEqualTest() { var left = PowerUnit.Watt; var right = PowerUnit.Watt as object; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void ObjectNotEqualTest() { var left = PowerUnit.Watt; var right = new object(); - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void EqualOperatorTest() { var left = PowerUnit.Watt; var right = PowerUnit.Watt; - Assert.True(left == right); + Assert.That(left == right, Is.True); } - [Fact] + [Test] public void NotEqualOperatorTest() { var left = PowerUnit.Watt; var right = PowerUnit.Kilowatt; - Assert.True(left != right); + Assert.That(left != right, Is.True); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => PowerUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/PowerUnits/PowerValueTest.cs b/xFunc.Tests/Expressions/Units/PowerUnits/PowerValueTest.cs index 7278e0c0f..2d64ea866 100644 --- a/xFunc.Tests/Expressions/Units/PowerUnits/PowerValueTest.cs +++ b/xFunc.Tests/Expressions/Units/PowerUnits/PowerValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.PowerUnits; public class PowerValueTest { - [Fact] + [Test] public void EqualTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(10); - Assert.True(power1.Equals(power2)); + Assert.That(power1.Equals(power2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(10); - Assert.True(power1 == power2); + Assert.That(power1 == power2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(12); - Assert.True(power1 != power2); + Assert.That(power1 != power2, Is.True); } - [Fact] + [Test] public void LessTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(12); - Assert.True(power1 < power2); + Assert.That(power1 < power2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var power1 = PowerValue.Watt(20); var power2 = PowerValue.Watt(12); - Assert.False(power1 < power2); + Assert.That(power1 < power2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var power1 = PowerValue.Watt(20); var power2 = PowerValue.Watt(12); - Assert.True(power1 > power2); + Assert.That(power1 > power2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(12); - Assert.False(power1 > power2); + Assert.That(power1 > power2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(10); - Assert.True(power1 <= power2); + Assert.That(power1 <= power2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(10); - Assert.True(power1 >= power2); + Assert.That(power1 >= power2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var power = PowerValue.Watt(10); - Assert.True(power.CompareTo(null) > 0); + Assert.That(power.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var power1 = PowerValue.Watt(10); var power2 = (object)PowerValue.Watt(10); - Assert.True(power1.CompareTo(power2) == 0); + Assert.That(power1.CompareTo(power2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var power = PowerValue.Watt(10); @@ -111,73 +111,73 @@ public void CompareToDouble() Assert.Throws(() => power.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(12); - Assert.False(power1.Equals(power2)); + Assert.That(power1.Equals(power2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Kilowatt(10); - Assert.False(power1.Equals(power2)); + Assert.That(power1.Equals(power2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var power1 = PowerValue.Watt(10); var power2 = 3; - Assert.False(power1.Equals(power2)); + Assert.That(power1.Equals(power2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(10); - Assert.True(power1.Equals(power2 as object)); + Assert.That(power1.Equals(power2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var power1 = PowerValue.Watt(10); var power2 = PowerValue.Watt(20); - Assert.False(power1.Equals(power2 as object)); + Assert.That(power1.Equals(power2 as object), Is.False); } - [Fact] + [Test] public void ToStringWattTest() { var power = PowerValue.Watt(10); - Assert.Equal("10 W", power.ToString()); + Assert.That(power.ToString(), Is.EqualTo("10 W")); } - [Fact] + [Test] public void ToStringKilowattTest() { var power = PowerValue.Kilowatt(10); - Assert.Equal("10 kW", power.ToString()); + Assert.That(power.ToString(), Is.EqualTo("10 kW")); } - [Fact] + [Test] public void ToStringHorsepowerTest() { var power = PowerValue.Horsepower(10); - Assert.Equal("10 hp", power.ToString()); + Assert.That(power.ToString(), Is.EqualTo("10 hp")); } public static IEnumerable GetConversionTestCases() @@ -193,13 +193,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, PowerUnit.Horsepower, PowerUnit.Kilowatt, 10.0 * 745.69987158227022 / 1000 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, PowerUnit unit, PowerUnit to, double expected) { var temperatureValue = new PowerValue(new NumberValue(value), unit); var converted = temperatureValue.To(to); - Assert.Equal(expected, converted.Value.Number, 6); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(6)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureTest.cs b/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureTest.cs index 407f7468a..a5a8d8a9a 100644 --- a/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureTest.cs +++ b/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.TemperatureUnits; public class TemperatureTest { - [Fact] + [Test] public void EqualNullTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = TemperatureValue.Celsius(10).AsExpression(); var expected = TemperatureValue.Celsius(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = TemperatureValue.Celsius(10).AsExpression(); var expected = TemperatureValue.Celsius(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = TemperatureValue.Celsius(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = TemperatureValue.Celsius(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureUnitTests.cs b/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureUnitTests.cs index 0dc87a65b..ccbdf1bf7 100644 --- a/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureUnitTests.cs +++ b/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureUnitTests.cs @@ -2,64 +2,64 @@ namespace xFunc.Tests.Expressions.Units.TemperatureUnits; public class TemperatureUnitTests { - [Fact] + [Test] public void EqualTest() { var left = TemperatureUnit.Celsius; var right = TemperatureUnit.Celsius; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void NotEqualTest() { var left = TemperatureUnit.Celsius; var right = TemperatureUnit.Fahrenheit; - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void ObjectEqualTest() { var left = TemperatureUnit.Celsius; var right = TemperatureUnit.Celsius as object; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void ObjectNotEqualTest() { var left = TemperatureUnit.Celsius; var right = new object(); - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void EqualOperatorTest() { var left = TemperatureUnit.Celsius; var right = TemperatureUnit.Celsius; - Assert.True(left == right); + Assert.That(left == right, Is.True); } - [Fact] + [Test] public void NotEqualOperatorTest() { var left = TemperatureUnit.Celsius; var right = TemperatureUnit.Fahrenheit; - Assert.True(left != right); + Assert.That(left != right, Is.True); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => TemperatureUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureValueTest.cs b/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureValueTest.cs index 692252b43..ad1887ad7 100644 --- a/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureValueTest.cs +++ b/xFunc.Tests/Expressions/Units/TemperatureUnits/TemperatureValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.TemperatureUnits; public class TemperatureValueTest { - [Fact] + [Test] public void EqualTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(10); - Assert.True(temperature1.Equals(temperature2)); + Assert.That(temperature1.Equals(temperature2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(10); - Assert.True(temperature1 == temperature2); + Assert.That(temperature1 == temperature2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(12); - Assert.True(temperature1 != temperature2); + Assert.That(temperature1 != temperature2, Is.True); } - [Fact] + [Test] public void LessTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(12); - Assert.True(temperature1 < temperature2); + Assert.That(temperature1 < temperature2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var temperature1 = TemperatureValue.Celsius(20); var temperature2 = TemperatureValue.Celsius(12); - Assert.False(temperature1 < temperature2); + Assert.That(temperature1 < temperature2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var temperature1 = TemperatureValue.Celsius(20); var temperature2 = TemperatureValue.Celsius(12); - Assert.True(temperature1 > temperature2); + Assert.That(temperature1 > temperature2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(12); - Assert.False(temperature1 > temperature2); + Assert.That(temperature1 > temperature2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(10); - Assert.True(temperature1 <= temperature2); + Assert.That(temperature1 <= temperature2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(10); - Assert.True(temperature1 >= temperature2); + Assert.That(temperature1 >= temperature2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var temperature = TemperatureValue.Celsius(10); - Assert.True(temperature.CompareTo(null) > 0); + Assert.That(temperature.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = (object)TemperatureValue.Celsius(10); - Assert.True(temperature1.CompareTo(temperature2) == 0); + Assert.That(temperature1.CompareTo(temperature2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var temperature = TemperatureValue.Celsius(10); @@ -111,52 +111,52 @@ public void CompareToDouble() Assert.Throws(() => temperature.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(12); - Assert.False(temperature1.Equals(temperature2)); + Assert.That(temperature1.Equals(temperature2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Fahrenheit(10); - Assert.False(temperature1.Equals(temperature2)); + Assert.That(temperature1.Equals(temperature2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = 3; - Assert.False(temperature1.Equals(temperature2)); + Assert.That(temperature1.Equals(temperature2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(10); - Assert.True(temperature1.Equals(temperature2 as object)); + Assert.That(temperature1.Equals(temperature2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var temperature1 = TemperatureValue.Celsius(10); var temperature2 = TemperatureValue.Celsius(20); - Assert.False(temperature1.Equals(temperature2 as object)); + Assert.That(temperature1.Equals(temperature2 as object), Is.False); } - [Fact] + [Test] public void AddOperatorTest() { var temperature1 = TemperatureValue.Celsius(10); @@ -164,10 +164,10 @@ public void AddOperatorTest() var expected = TemperatureValue.Celsius(10 - 263.15); var actual = temperature1 + temperature2; - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperatorTest() { var temperature1 = TemperatureValue.Celsius(10); @@ -175,31 +175,31 @@ public void SubOperatorTest() var expected = TemperatureValue.Celsius(10 + 263.15); var actual = temperature1 - temperature2; - Assert.Equal(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } - [Fact] + [Test] public void ToStringCelsiusTest() { var temperature = TemperatureValue.Celsius(10); - Assert.Equal("10 °C", temperature.ToString()); + Assert.That(temperature.ToString(), Is.EqualTo("10 °C")); } - [Fact] + [Test] public void ToStringFahrenheitTest() { var temperature = TemperatureValue.Fahrenheit(10); - Assert.Equal("10 °F", temperature.ToString()); + Assert.That(temperature.ToString(), Is.EqualTo("10 °F")); } - [Fact] + [Test] public void ToStringKelvinTest() { var temperature = TemperatureValue.Kelvin(10); - Assert.Equal("10 K", temperature.ToString()); + Assert.That(temperature.ToString(), Is.EqualTo("10 K")); } public static IEnumerable GetConversionTestCases() @@ -217,13 +217,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, TemperatureUnit.Kelvin, TemperatureUnit.Fahrenheit, -441.66999999999996 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, TemperatureUnit unit, TemperatureUnit to, double expected) { var temperatureValue = new TemperatureValue(new NumberValue(value), unit); var converted = temperatureValue.To(to); - Assert.Equal(expected, converted.Value.Number, 6); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(6)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/TimeUnits/TimeTest.cs b/xFunc.Tests/Expressions/Units/TimeUnits/TimeTest.cs index 89472cdd0..70c87c99e 100644 --- a/xFunc.Tests/Expressions/Units/TimeUnits/TimeTest.cs +++ b/xFunc.Tests/Expressions/Units/TimeUnits/TimeTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.TimeUnits; public class TimeTest { - [Fact] + [Test] public void EqualNullTest() { var exp = TimeValue.Second(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = TimeValue.Second(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = TimeValue.Second(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = TimeValue.Second(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = TimeValue.Second(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = TimeValue.Second(10).AsExpression(); var expected = TimeValue.Second(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = TimeValue.Second(10).AsExpression(); var expected = TimeValue.Second(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = TimeValue.Second(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = TimeValue.Second(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/TimeUnits/TimeUnitTest.cs b/xFunc.Tests/Expressions/Units/TimeUnits/TimeUnitTest.cs index a6aa49dbd..875b5a226 100644 --- a/xFunc.Tests/Expressions/Units/TimeUnits/TimeUnitTest.cs +++ b/xFunc.Tests/Expressions/Units/TimeUnits/TimeUnitTest.cs @@ -5,72 +5,72 @@ namespace xFunc.Tests.Expressions.Units.TimeUnits; public class TimeUnitTest { - [Fact] + [Test] public void EqualsTest() { var a = TimeUnit.Second; var b = TimeUnit.Second; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var a = TimeUnit.Second; var b = LengthUnit.Millimeter; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualsTest() { var a = TimeUnit.Second; var b = TimeUnit.Second as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectEqualsWithDifferentTypesTest() { var a = TimeUnit.Second; var b = 1 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var a = TimeUnit.Second; var b = TimeUnit.Second; - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest() { var a = TimeUnit.Second; var b = TimeUnit.Millisecond; - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = TimeUnit.Second; - Assert.Equal("s", a.ToString()); + Assert.That(a.ToString(), Is.EqualTo("s")); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => TimeUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/TimeUnits/TimeValueTest.cs b/xFunc.Tests/Expressions/Units/TimeUnits/TimeValueTest.cs index ae6795a74..8d988b397 100644 --- a/xFunc.Tests/Expressions/Units/TimeUnits/TimeValueTest.cs +++ b/xFunc.Tests/Expressions/Units/TimeUnits/TimeValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.TimeUnits; public class TimeValueTest { - [Fact] + [Test] public void EqualTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(10); - Assert.True(time1.Equals(time2)); + Assert.That(time1.Equals(time2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(10); - Assert.True(time1 == time2); + Assert.That(time1 == time2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(12); - Assert.True(time1 != time2); + Assert.That(time1 != time2, Is.True); } - [Fact] + [Test] public void LessTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(12); - Assert.True(time1 < time2); + Assert.That(time1 < time2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var time1 = TimeValue.Second(20); var time2 = TimeValue.Second(12); - Assert.False(time1 < time2); + Assert.That(time1 < time2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var time1 = TimeValue.Second(20); var time2 = TimeValue.Second(12); - Assert.True(time1 > time2); + Assert.That(time1 > time2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(12); - Assert.False(time1 > time2); + Assert.That(time1 > time2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(10); - Assert.True(time1 <= time2); + Assert.That(time1 <= time2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(10); - Assert.True(time1 >= time2); + Assert.That(time1 >= time2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var timeValue = TimeValue.Second(10); - Assert.True(timeValue.CompareTo(null) > 0); + Assert.That(timeValue.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var time1 = TimeValue.Second(10); var time2 = (object)TimeValue.Second(10); - Assert.True(time1.CompareTo(time2) == 0); + Assert.That(time1.CompareTo(time2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var timeValue = TimeValue.Second(10); @@ -111,124 +111,124 @@ public void CompareToDouble() Assert.Throws(() => timeValue.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(12); - Assert.False(time1.Equals(time2)); + Assert.That(time1.Equals(time2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Minute(10); - Assert.False(time1.Equals(time2)); + Assert.That(time1.Equals(time2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var time1 = TimeValue.Second(10); var time2 = 3; - Assert.False(time1.Equals(time2)); + Assert.That(time1.Equals(time2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(10); - Assert.True(time1.Equals(time2 as object)); + Assert.That(time1.Equals(time2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var time1 = TimeValue.Second(10); var time2 = TimeValue.Second(20); - Assert.False(time1.Equals(time2 as object)); + Assert.That(time1.Equals(time2 as object), Is.False); } - [Fact] + [Test] public void ToStringSecondTest() { var timeValue = TimeValue.Second(10); - Assert.Equal("10 s", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 s")); } - [Fact] + [Test] public void ToStringNanosecondTest() { var timeValue = TimeValue.Nanosecond(10); - Assert.Equal("10 ns", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 ns")); } - [Fact] + [Test] public void ToStringMicrosecondTest() { var timeValue = TimeValue.Microsecond(10); - Assert.Equal("10 μs", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 μs")); } - [Fact] + [Test] public void ToStringMillisecondTest() { var timeValue = TimeValue.Millisecond(10); - Assert.Equal("10 ms", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 ms")); } - [Fact] + [Test] public void ToStringMinuteTest() { var timeValue = TimeValue.Minute(10); - Assert.Equal("10 min", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 min")); } - [Fact] + [Test] public void ToStringHourTest() { var timeValue = TimeValue.Hour(10); - Assert.Equal("10 h", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 h")); } - [Fact] + [Test] public void ToStringDayTest() { var timeValue = TimeValue.Day(10); - Assert.Equal("10 day", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 day")); } - [Fact] + [Test] public void ToStringWeekTest() { var timeValue = TimeValue.Week(10); - Assert.Equal("10 week", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 week")); } - [Fact] + [Test] public void ToStringYearTest() { var timeValue = TimeValue.Year(10); - Assert.Equal("10 year", timeValue.ToString()); + Assert.That(timeValue.ToString(), Is.EqualTo("10 year")); } - [Fact] + [Test] public void AddOperatorTest() { var time1 = TimeValue.Second(1); @@ -236,10 +236,10 @@ public void AddOperatorTest() var expected = TimeValue.Second(61); var result = time1 + time2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperatorTest() { var time1 = TimeValue.Minute(1); @@ -247,7 +247,7 @@ public void SubOperatorTest() var expected = TimeValue.Minute(0.5); var result = time1 - time2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConversionTestCases() @@ -342,13 +342,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, TimeUnit.Year, TimeUnit.Day, 3650.0 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, TimeUnit unit, TimeUnit to, double expected) { var time = new TimeValue(new NumberValue(value), unit); var converted = time.To(to); - Assert.Equal(expected, converted.Value.Number, 5); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(5)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeTest.cs b/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeTest.cs index 31ca7f8a6..8db698d6f 100644 --- a/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeTest.cs +++ b/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeTest.cs @@ -5,66 +5,66 @@ namespace xFunc.Tests.Expressions.Units.VolumeUnits; public class VolumeTest { - [Fact] + [Test] public void EqualNullTest() { var exp = VolumeValue.Meter(10).AsExpression(); - Assert.False(exp.Equals(null)); + Assert.That(exp.Equals(null), Is.False); } - [Fact] + [Test] public void EqualNullObjectTest() { var exp = VolumeValue.Meter(10).AsExpression(); - Assert.False(exp.Equals((object)null)); + Assert.That(exp.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualSameTest() { var exp = VolumeValue.Meter(10).AsExpression(); - Assert.True(exp.Equals(exp)); + Assert.That(exp.Equals(exp), Is.True); } - [Fact] + [Test] public void EqualSameObjectTest() { var exp = VolumeValue.Meter(10).AsExpression(); - Assert.True(exp.Equals((object)exp)); + Assert.That(exp.Equals((object)exp), Is.True); } - [Fact] + [Test] public void EqualDiffTypeTest() { var exp = VolumeValue.Meter(10).AsExpression(); var number = Number.One; - Assert.False(exp.Equals(number)); + Assert.That(exp.Equals(number), Is.False); } - [Fact] + [Test] public void ExecuteTest() { var exp = VolumeValue.Meter(10).AsExpression(); var expected = VolumeValue.Meter(10); - Assert.Equal(expected, exp.Execute()); + Assert.That(exp.Execute(), Is.EqualTo(expected)); } - [Fact] + [Test] public void ExecuteTest2() { var exp = VolumeValue.Meter(10).AsExpression(); var expected = VolumeValue.Meter(10); - Assert.Equal(expected, exp.Execute(null)); + Assert.That(exp.Execute(null), Is.EqualTo(expected)); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = VolumeValue.Meter(10).AsExpression(); @@ -72,7 +72,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = VolumeValue.Meter(10).AsExpression(); diff --git a/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeUnitTest.cs b/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeUnitTest.cs index 5bb4da71b..cb25b3384 100644 --- a/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeUnitTest.cs +++ b/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeUnitTest.cs @@ -5,88 +5,88 @@ namespace xFunc.Tests.Expressions.Units.VolumeUnits; public class VolumeUnitTest { - [Fact] + [Test] public void EqualsNullTest() { var a = VolumeUnit.Meter; - Assert.False(a.Equals(null)); + Assert.That(a.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsTest() { var a = VolumeUnit.Meter; var b = VolumeUnit.Meter; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var a = VolumeUnit.Meter; var b = VolumeUnit.Centimeter; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void ObjectEqualsNullTest() { var a = VolumeUnit.Meter; - Assert.False(a.Equals(null as object)); + Assert.That(a.Equals(null as object), Is.False); } - [Fact] + [Test] public void ObjectEqualsTest() { var a = VolumeUnit.Meter; var b = VolumeUnit.Meter as object; - Assert.True(a.Equals(b)); + Assert.That(a.Equals(b), Is.True); } - [Fact] + [Test] public void ObjectEqualsWithDifferentTypesTest() { var a = VolumeUnit.Meter; var b = 1 as object; - Assert.False(a.Equals(b)); + Assert.That(a.Equals(b), Is.False); } - [Fact] + [Test] public void EqualsOperatorTest() { var a = VolumeUnit.Meter; var b = VolumeUnit.Meter; - Assert.True(a == b); + Assert.That(a == b, Is.True); } - [Fact] + [Test] public void NotEqualsOperatorTest() { var a = VolumeUnit.Meter; var b = VolumeUnit.Centimeter; - Assert.True(a != b); + Assert.That(a != b, Is.True); } - [Fact] + [Test] public void ToStringTest() { var a = VolumeUnit.Meter; - Assert.Equal("m^3", a.ToString()); + Assert.That(a.ToString(), Is.EqualTo("m^3")); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] public void FromNameEmptyString(string name) => Assert.Throws(() => VolumeUnit.FromName(name, out _)); } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeValueTest.cs b/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeValueTest.cs index 62237044d..56f7521a3 100644 --- a/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeValueTest.cs +++ b/xFunc.Tests/Expressions/Units/VolumeUnits/VolumeValueTest.cs @@ -5,105 +5,105 @@ namespace xFunc.Tests.Expressions.Units.VolumeUnits; public class VolumeValueTest { - [Fact] + [Test] public void EqualTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(10); - Assert.True(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.True); } - [Fact] + [Test] public void EqualOperatorTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(10); - Assert.True(area1 == area2); + Assert.That(area1 == area2, Is.True); } - [Fact] + [Test] public void NotEqualTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(12); - Assert.True(area1 != area2); + Assert.That(area1 != area2, Is.True); } - [Fact] + [Test] public void LessTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(12); - Assert.True(area1 < area2); + Assert.That(area1 < area2, Is.True); } - [Fact] + [Test] public void LessFalseTest() { var area1 = VolumeValue.Meter(20); var area2 = VolumeValue.Meter(12); - Assert.False(area1 < area2); + Assert.That(area1 < area2, Is.False); } - [Fact] + [Test] public void GreaterTest() { var area1 = VolumeValue.Meter(20); var area2 = VolumeValue.Meter(12); - Assert.True(area1 > area2); + Assert.That(area1 > area2, Is.True); } - [Fact] + [Test] public void GreaterFalseTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(12); - Assert.False(area1 > area2); + Assert.That(area1 > area2, Is.False); } - [Fact] + [Test] public void LessOrEqualTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(10); - Assert.True(area1 <= area2); + Assert.That(area1 <= area2, Is.True); } - [Fact] + [Test] public void GreaterOrEqualTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(10); - Assert.True(area1 >= area2); + Assert.That(area1 >= area2, Is.True); } - [Fact] + [Test] public void CompareToNull() { var areaValue = VolumeValue.Meter(10); - Assert.True(areaValue.CompareTo(null) > 0); + Assert.That(areaValue.CompareTo(null) > 0, Is.True); } - [Fact] + [Test] public void CompareToObject() { var area1 = VolumeValue.Meter(10); var area2 = (object)VolumeValue.Meter(10); - Assert.True(area1.CompareTo(area2) == 0); + Assert.That(area1.CompareTo(area2) == 0, Is.True); } - [Fact] + [Test] public void CompareToDouble() { var areaValue = VolumeValue.Meter(10); @@ -111,60 +111,60 @@ public void CompareToDouble() Assert.Throws(() => areaValue.CompareTo(1)); } - [Fact] + [Test] public void ValueNotEqualTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(12); - Assert.False(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.False); } - [Fact] + [Test] public void UnitNotEqualTest2() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Centimeter(10); - Assert.False(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.False); } - [Fact] + [Test] public void EqualDiffTypeTest() { var area1 = VolumeValue.Meter(10); var area2 = 3; - Assert.False(area1.Equals(area2)); + Assert.That(area1.Equals(area2), Is.False); } - [Fact] + [Test] public void EqualObjectTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(10); - Assert.True(area1.Equals(area2 as object)); + Assert.That(area1.Equals(area2 as object), Is.True); } - [Fact] + [Test] public void NotEqualObjectTest() { var area1 = VolumeValue.Meter(10); var area2 = VolumeValue.Meter(20); - Assert.False(area1.Equals(area2 as object)); + Assert.That(area1.Equals(area2 as object), Is.False); } - [Fact] + [Test] public void ToStringSecondTest() { var areaValue = VolumeValue.Meter(10); - Assert.Equal("10 m^3", areaValue.ToString()); + Assert.That(areaValue.ToString(), Is.EqualTo("10 m^3")); } - [Fact] + [Test] public void AddOperatorTest() { var area1 = VolumeValue.Centimeter(1); @@ -172,10 +172,10 @@ public void AddOperatorTest() var expected = VolumeValue.Centimeter(1000001); var result = area1 + area2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SubOperatorTest() { var area1 = VolumeValue.Meter(1); @@ -183,7 +183,7 @@ public void SubOperatorTest() var expected = VolumeValue.Meter(0.5); var result = area1 - area2; - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } public static IEnumerable GetConversionTestCases() @@ -245,13 +245,13 @@ public static IEnumerable GetConversionTestCases() yield return new object[] { 10.0, VolumeUnit.Gallon, VolumeUnit.Yard, 0.0495113169 }; } - [Theory] - [MemberData(nameof(GetConversionTestCases))] + [Test] + [TestCaseSource(nameof(GetConversionTestCases))] public void ConversionTests(double value, VolumeUnit unit, VolumeUnit to, double expected) { var area = new VolumeValue(new NumberValue(value), unit); var converted = area.To(to); - Assert.Equal(expected, converted.Value.Number, 5); + Assert.That(converted.Value.Number, Is.EqualTo(expected).Within(5)); } } \ No newline at end of file diff --git a/xFunc.Tests/Expressions/VariableTest.cs b/xFunc.Tests/Expressions/VariableTest.cs index c9b2de472..2e5232e01 100644 --- a/xFunc.Tests/Expressions/VariableTest.cs +++ b/xFunc.Tests/Expressions/VariableTest.cs @@ -5,13 +5,13 @@ namespace xFunc.Tests.Expressions; public class VariableTest { - [Fact] + [Test] public void NullTest() { Assert.Throws(() => new Variable(null)); } - [Fact] + [Test] public void ExecuteNotSupportedTest() { var exp = Variable.X; @@ -19,7 +19,7 @@ public void ExecuteNotSupportedTest() Assert.Throws(() => exp.Execute()); } - [Fact] + [Test] public void ExecuteNullTest() { var exp = Variable.X; @@ -27,7 +27,7 @@ public void ExecuteNullTest() Assert.Throws(() => exp.Execute(null)); } - [Fact] + [Test] public void ExecuteTest() { var exp = Variable.X; @@ -36,94 +36,97 @@ public void ExecuteTest() var result = exp.Execute(parameters); - Assert.Equal(new NumberValue(1.0), result); + Assert.That(result, Is.EqualTo(new NumberValue(1.0))); } - [Fact] + [Test] public void ConvertToString() { - var exp = Variable.X; + var exp = (string)Variable.X; - Assert.Equal("x", exp); + Assert.That(exp, Is.EqualTo("x")); } - [Fact] + [Test] public void StringToConvert() { - var exp = "x"; + var exp = (Variable)"x"; var result = Variable.X; - Assert.Equal(result, exp); + Assert.That(exp, Is.EqualTo(result)); } - [Fact] + [Test] public void EqualsVariableNullTest() { var variable = Variable.X; - Assert.False(variable.Equals(null)); + Assert.That(variable.Equals(null), Is.False); } - [Fact] + [Test] public void EqualsObjectNullTest() { var variable = Variable.X; - Assert.False(variable.Equals((object)null)); + Assert.That(variable.Equals((object)null), Is.False); } - [Fact] + [Test] public void EqualsVariableThisTest() { var variable = Variable.X; - Assert.True(variable.Equals(variable)); + Assert.That(variable.Equals(variable), Is.True); } - [Fact] + [Test] public void EqualsObjectThisTest() { var variable = Variable.X; - Assert.True(variable.Equals((object)variable)); + Assert.That(variable.Equals((object)variable), Is.True); } - [Fact] + [Test] public void EqualsTest() { var left = Variable.X; var right = Variable.X; - Assert.True(left.Equals(right)); + Assert.That(left.Equals(right), Is.True); } - [Fact] + [Test] public void NotEqualsTest() { var left = Variable.X; var right = Variable.Y; - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void EqualsDiffTypesTest() { var left = Variable.X; var right = Number.Two; - Assert.False(left.Equals(right)); + Assert.That(left.Equals(right), Is.False); } - [Fact] + [Test] public void ImplicitNullToString() { Variable x = null; - Assert.Throws(() => (string)x); + Assert.Throws(() => + { + var temp = (string)x; + }); } - [Fact] + [Test] public void NullAnalyzerTest1() { var exp = Variable.X; @@ -131,7 +134,7 @@ public void NullAnalyzerTest1() Assert.Throws(() => exp.Analyze(null)); } - [Fact] + [Test] public void NullAnalyzerTest2() { var exp = Variable.X; diff --git a/xFunc.Tests/ParserTests/AngleTests.cs b/xFunc.Tests/ParserTests/AngleTests.cs index caa844562..41cee15b7 100644 --- a/xFunc.Tests/ParserTests/AngleTests.cs +++ b/xFunc.Tests/ParserTests/AngleTests.cs @@ -5,47 +5,47 @@ namespace xFunc.Tests.ParserTests; public class AngleTests : BaseParserTests { - [Theory] - [InlineData("1 'deg'")] - [InlineData("1 'degree'")] - [InlineData("1 'degrees'")] - [InlineData("1°")] + [Test] + [TestCase("1 'deg'")] + [TestCase("1 'degree'")] + [TestCase("1 'degrees'")] + [TestCase("1°")] public void AngleDeg(string function) => ParseTest(function, AngleValue.Degree(1).AsExpression()); - [Theory] - [InlineData("1 'rad'")] - [InlineData("1 'radian'")] - [InlineData("1 'radians'")] + [Test] + [TestCase("1 'rad'")] + [TestCase("1 'radian'")] + [TestCase("1 'radians'")] public void AngleRad(string function) => ParseTest(function, AngleValue.Radian(1).AsExpression()); - [Theory] - [InlineData("1 'grad'")] - [InlineData("1 'gradian'")] - [InlineData("1 'gradians'")] + [Test] + [TestCase("1 'grad'")] + [TestCase("1 'gradian'")] + [TestCase("1 'gradians'")] public void AngleGrad(string function) => ParseTest(function, AngleValue.Gradian(1).AsExpression()); - [Theory] - [InlineData("todeg(1 'deg')")] - [InlineData("todegree(1 'deg')")] + [Test] + [TestCase("todeg(1 'deg')")] + [TestCase("todegree(1 'deg')")] public void ToDegTest(string function) => ParseTest(function, new ToDegree(AngleValue.Degree(1).AsExpression())); - [Theory] - [InlineData("torad(1 'deg')")] - [InlineData("toradian(1 'deg')")] + [Test] + [TestCase("torad(1 'deg')")] + [TestCase("toradian(1 'deg')")] public void ToRadTest(string function) => ParseTest(function, new ToRadian(AngleValue.Degree(1).AsExpression())); - [Theory] - [InlineData("tograd(1 'deg')")] - [InlineData("togradian(1 'deg')")] + [Test] + [TestCase("tograd(1 'deg')")] + [TestCase("togradian(1 'deg')")] public void ToGradTest(string function) => ParseTest(function, new ToGradian(AngleValue.Degree(1).AsExpression())); - [Fact] + [Test] public void ToNumberTest() => ParseTest("tonumber(1 'deg')", new ToNumber(AngleValue.Degree(1).AsExpression())); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/AreaUnitTests.cs b/xFunc.Tests/ParserTests/AreaUnitTests.cs index a91e179f1..d3111492f 100644 --- a/xFunc.Tests/ParserTests/AreaUnitTests.cs +++ b/xFunc.Tests/ParserTests/AreaUnitTests.cs @@ -5,47 +5,47 @@ namespace xFunc.Tests.ParserTests; public class AreaUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseSquareMeter() => ParseTest("1 'm^2'", AreaValue.Meter(1).AsExpression()); - [Fact] + [Test] public void ParseSquareMillimeter() => ParseTest("1 'mm^2'", AreaValue.Millimeter(1).AsExpression()); - [Fact] + [Test] public void ParseSquareCentimeter() => ParseTest("1 'cm^2'", AreaValue.Centimeter(1).AsExpression()); - [Fact] + [Test] public void ParseSquareKilometer() => ParseTest("1 'km^2'", AreaValue.Kilometer(1).AsExpression()); - [Fact] + [Test] public void ParseSquareInch() => ParseTest("1 'in^2'", AreaValue.Inch(1).AsExpression()); - [Fact] + [Test] public void ParseSquareFoot() => ParseTest("1 'ft^2'", AreaValue.Foot(1).AsExpression()); - [Fact] + [Test] public void ParseSquareYard() => ParseTest("1 'yd^2'", AreaValue.Yard(1).AsExpression()); - [Fact] + [Test] public void ParseSquareMile() => ParseTest("1 'mi^2'", AreaValue.Mile(1).AsExpression()); - [Fact] + [Test] public void ParseHectare() => ParseTest("1 'ha'", AreaValue.Hectare(1).AsExpression()); - [Fact] + [Test] public void ParseAcre() => ParseTest("1 'ac'", AreaValue.Acre(1).AsExpression()); - [Fact] + [Test] public void ParseSquareUnitWithoutExponent() => ParseErrorTest("1 'mi^'"); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/AssignTests.cs b/xFunc.Tests/ParserTests/AssignTests.cs index f5e952e2a..9311a04cf 100644 --- a/xFunc.Tests/ParserTests/AssignTests.cs +++ b/xFunc.Tests/ParserTests/AssignTests.cs @@ -5,20 +5,20 @@ namespace xFunc.Tests.ParserTests; public class AssignTests : BaseParserTests { - [Fact] + [Test] public void DefTest() => ParseTest("assign(x, 2)", new Assign(Variable.X, Number.Two)); - [Theory] - [InlineData("assign x, 2)")] - [InlineData("assign(, 2)")] - [InlineData("assign(x 2)")] - [InlineData("assign(x,)")] - [InlineData("assign(x, 2")] + [Test] + [TestCase("assign x, 2)")] + [TestCase("assign(, 2)")] + [TestCase("assign(x 2)")] + [TestCase("assign(x,)")] + [TestCase("assign(x, 2")] public void DefMissingOpenParen(string function) => ParseErrorTest(function); - [Fact] + [Test] public void ParseDefine() { var expected = new Assign(Variable.X, new Number(3)); @@ -26,11 +26,11 @@ public void ParseDefine() ParseTest("x := 3", expected); } - [Fact] + [Test] public void ParseDefineFirstParamIsNotVar() => ParseErrorTest("5 := 3"); - [Fact] + [Test] public void DefineComplexParserTest() { var expected = new Assign( @@ -46,7 +46,7 @@ public void DefineComplexParserTest() ParseTest("aaa := 3+2*i", expected); } - [Fact] + [Test] public void DefineUserFuncTest() { var expected = new Assign( @@ -56,7 +56,7 @@ public void DefineUserFuncTest() ParseTest("f := (x) => x", expected); } - [Fact] + [Test] public void UnaryMinusAssignTest() { var expected = new Assign( @@ -67,7 +67,7 @@ public void UnaryMinusAssignTest() ParseTest("x := -sin(2)", expected); } - [Fact] + [Test] public void AddAssign() { var expected = new AddAssign(Variable.X, Number.Two); @@ -75,7 +75,7 @@ public void AddAssign() ParseTest("x += 2", expected); } - [Fact] + [Test] public void UnaryMinusAddAssignTest() { var expected = new AddAssign( @@ -86,7 +86,7 @@ public void UnaryMinusAddAssignTest() ParseTest("x += -sin(2)", expected); } - [Fact] + [Test] public void AddAssignAsExpression() { var expected = new Add( @@ -96,7 +96,7 @@ public void AddAssignAsExpression() ParseTest("1 + (x += 2)", expected); } - [Fact] + [Test] public void SubAssign() { var expected = new SubAssign(Variable.X, Number.Two); @@ -104,7 +104,7 @@ public void SubAssign() ParseTest("x -= 2", expected); } - [Fact] + [Test] public void UnaryMinusSubAssignTest() { var expected = new SubAssign( @@ -115,7 +115,7 @@ public void UnaryMinusSubAssignTest() ParseTest("x -= -sin(2)", expected); } - [Fact] + [Test] public void SubAssignAsExpression() { var expected = new Add( @@ -125,7 +125,7 @@ public void SubAssignAsExpression() ParseTest("1 + (x -= 2)", expected); } - [Fact] + [Test] public void MulAssign() { var expected = new MulAssign(Variable.X, Number.Two); @@ -133,7 +133,7 @@ public void MulAssign() ParseTest("x *= 2", expected); } - [Fact] + [Test] public void UnaryMinusMulAssignTest() { var expected = new MulAssign( @@ -144,7 +144,7 @@ public void UnaryMinusMulAssignTest() ParseTest("x *= -sin(2)", expected); } - [Fact] + [Test] public void MulAssignAsExpression() { var expected = new Add( @@ -154,7 +154,7 @@ public void MulAssignAsExpression() ParseTest("1 + (x *= 2)", expected); } - [Fact] + [Test] public void DivAssign() { var expected = new DivAssign(Variable.X, Number.Two); @@ -162,7 +162,7 @@ public void DivAssign() ParseTest("x /= 2", expected); } - [Fact] + [Test] public void UnaryMinusDivAssignTest() { var expected = new DivAssign( @@ -173,7 +173,7 @@ public void UnaryMinusDivAssignTest() ParseTest("x /= -sin(2)", expected); } - [Fact] + [Test] public void DivAssignAsExpression() { var expected = new Add( @@ -183,7 +183,7 @@ public void DivAssignAsExpression() ParseTest("1 + (x /= 2)", expected); } - [Fact] + [Test] public void LeftShiftAssignTest() { var expected = new LeftShiftAssign(Variable.X, new Number(10)); @@ -191,7 +191,7 @@ public void LeftShiftAssignTest() ParseTest("x <<= 10", expected); } - [Fact] + [Test] public void LeftShiftAssignAsExpressionTest() { var expected = new Add( @@ -201,7 +201,7 @@ public void LeftShiftAssignAsExpressionTest() ParseTest("1 + (x <<= 10)", expected); } - [Fact] + [Test] public void RightShiftAssignTest() { var expected = new RightShiftAssign(Variable.X, new Number(10)); @@ -209,7 +209,7 @@ public void RightShiftAssignTest() ParseTest("x >>= 10", expected); } - [Fact] + [Test] public void RightShiftAssignAsExpressionTest() { var expected = new Add( @@ -219,34 +219,34 @@ public void RightShiftAssignAsExpressionTest() ParseTest("1 + (x >>= 10)", expected); } - [Theory] - [InlineData("x :=")] - [InlineData("x +=")] - [InlineData("x -=")] - [InlineData("x −=")] - [InlineData("x *=")] - [InlineData("x ×=")] - [InlineData("x /=")] - [InlineData("x <<=")] - [InlineData("x >>=")] + [Test] + [TestCase("x :=")] + [TestCase("x +=")] + [TestCase("x -=")] + [TestCase("x −=")] + [TestCase("x *=")] + [TestCase("x ×=")] + [TestCase("x /=")] + [TestCase("x <<=")] + [TestCase("x >>=")] public void AssignMissingValue(string function) => ParseErrorTest(function); - [Theory] - [InlineData("1 + x += 1")] - [InlineData("1 + x -= 1")] - [InlineData("1 + x *= 1")] - [InlineData("1 + x /= 1")] - [InlineData("1 + x <<= 1")] - [InlineData("1 + x >>= 1")] + [Test] + [TestCase("1 + x += 1")] + [TestCase("1 + x -= 1")] + [TestCase("1 + x *= 1")] + [TestCase("1 + x /= 1")] + [TestCase("1 + x <<= 1")] + [TestCase("1 + x >>= 1")] public void AssignAsExpressionError(string function) => ParseErrorTest(function); - [Fact] + [Test] public void IncTest() => ParseTest("x++", new Inc(Variable.X)); - [Fact] + [Test] public void IncAsExpression() { var expected = new Add(Number.One, new Inc(Variable.X)); @@ -254,9 +254,9 @@ public void IncAsExpression() ParseTest("1 + x++", expected); } - [Theory] - [InlineData("x--")] - [InlineData("x−−")] + [Test] + [TestCase("x--")] + [TestCase("x−−")] public void DecTest(string function) { var expected = new Dec(Variable.X); @@ -264,7 +264,7 @@ public void DecTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void DecAsExpression() { var expected = new Add(Number.One, new Dec(Variable.X)); @@ -272,9 +272,9 @@ public void DecAsExpression() ParseTest("1 + x--", expected); } - [Theory] - [InlineData("1 + (x := 2)")] - [InlineData("1 + assign(x, 2)")] + [Test] + [TestCase("1 + (x := 2)")] + [TestCase("1 + assign(x, 2)")] public void AssignAsExpression(string function) { var expected = new Add( @@ -284,7 +284,7 @@ public void AssignAsExpression(string function) ParseTest(function, expected); } - [Fact] + [Test] public void UnassignAsExpression() { var expected = new Add( @@ -294,9 +294,9 @@ public void UnassignAsExpression() ParseTest("1 + unassign(x)", expected); } - [Theory] - [InlineData("(f := (x) => x * x)(2)")] - [InlineData("(assign(f, (x) => x * x))(2)")] + [Test] + [TestCase("(f := (x) => x * x)(2)")] + [TestCase("(assign(f, (x) => x * x))(2)")] public void AssignLambdaAsExpression(string function) { var expected = new CallExpression( diff --git a/xFunc.Tests/ParserTests/BaseParserTests.cs b/xFunc.Tests/ParserTests/BaseParserTests.cs index 00e2009b7..5156079bb 100644 --- a/xFunc.Tests/ParserTests/BaseParserTests.cs +++ b/xFunc.Tests/ParserTests/BaseParserTests.cs @@ -13,7 +13,7 @@ protected void ParseTest(string function, IExpression expected) { var exp = parser.Parse(function); - Assert.Equal(expected, exp); + Assert.That(exp, Is.EqualTo(expected)); } protected void ParseErrorTest(string function) diff --git a/xFunc.Tests/ParserTests/ComplexNumberTests.cs b/xFunc.Tests/ParserTests/ComplexNumberTests.cs index 40da269a3..63df4f2f0 100644 --- a/xFunc.Tests/ParserTests/ComplexNumberTests.cs +++ b/xFunc.Tests/ParserTests/ComplexNumberTests.cs @@ -7,9 +7,9 @@ namespace xFunc.Tests.ParserTests; public class ComplexNumberTests : BaseParserTests { - [Theory] - [InlineData("3+2i")] - [InlineData("+3+2i")] + [Test] + [TestCase("3+2i")] + [TestCase("+3+2i")] public void ComplexNumberTest(string exp) { var expected = new Add( @@ -23,7 +23,7 @@ public void ComplexNumberTest(string exp) ParseTest(exp, expected); } - [Fact] + [Test] public void ComplexNumberNegativeTest() { var expected = new Sub( @@ -37,7 +37,7 @@ public void ComplexNumberNegativeTest() ParseTest("3-2i", expected); } - [Fact] + [Test] public void ComplexNumberNegativeAllPartsTest() { var expected = new Sub( @@ -51,7 +51,7 @@ public void ComplexNumberNegativeAllPartsTest() ParseTest("-3-2i", expected); } - [Fact] + [Test] public void ComplexOnlyRePartTest() { var expected = new Add( @@ -65,7 +65,7 @@ public void ComplexOnlyRePartTest() ParseTest("3+0i", expected); } - [Fact] + [Test] public void ComplexOnlyImPartTest() { var expected = new Add( @@ -79,7 +79,7 @@ public void ComplexOnlyImPartTest() ParseTest("0+2i", expected); } - [Fact] + [Test] public void ComplexOnlyImPartNegativeTest() { var expected = new Sub( @@ -93,7 +93,7 @@ public void ComplexOnlyImPartNegativeTest() ParseTest("0-2i", expected); } - [Fact] + [Test] public void ComplexWithVarTest1() { var expected = new Sub( @@ -110,7 +110,7 @@ public void ComplexWithVarTest1() ParseTest("x - (0+2i)", expected); } - [Fact] + [Test] public void ComplexWithVarTest2() { var expected = new Add( @@ -127,9 +127,9 @@ public void ComplexWithVarTest2() ParseTest("x + (3-2i)", expected); } - [Theory] - [InlineData("10∠0.78539816339744828°")] - [InlineData("10∠+0.78539816339744828°")] + [Test] + [TestCase("10∠0.78539816339744828°")] + [TestCase("10∠+0.78539816339744828°")] public void ComplexFromPolarTest(string exp) { var complex = Complex.FromPolarCoordinates(10, 0.78539816339744828 * Math.PI / 180); @@ -138,9 +138,9 @@ public void ComplexFromPolarTest(string exp) ParseTest(exp, expected); } - [Theory] - [InlineData("10∠-7.1°")] - [InlineData("+10∠-7.1°")] + [Test] + [TestCase("10∠-7.1°")] + [TestCase("+10∠-7.1°")] public void ComplexFromPolarNegativePhaseTest(string exp) { var complex = Complex.FromPolarCoordinates(10, -7.1 * Math.PI / 180); @@ -149,7 +149,7 @@ public void ComplexFromPolarNegativePhaseTest(string exp) ParseTest(exp, expected); } - [Fact] + [Test] public void ComplexFromPolarNegativeMagnitudeTest() { var complex = Complex.FromPolarCoordinates(10, 7.1 * Math.PI / 180); @@ -158,16 +158,16 @@ public void ComplexFromPolarNegativeMagnitudeTest() ParseTest("-10∠7.1°", expected); } - [Theory] - [InlineData("10∠°")] - [InlineData("10∠0.78539816339744828")] - [InlineData("x°")] + [Test] + [TestCase("10∠°")] + [TestCase("10∠0.78539816339744828")] + [TestCase("x°")] public void ComplexFromPolarMissingPartsTest(string exp) => ParseErrorTest(exp); - [Theory] - [InlineData("im(3-2i)")] - [InlineData("imaginary(3-2i)")] + [Test] + [TestCase("im(3-2i)")] + [TestCase("imaginary(3-2i)")] public void ImTest(string function) { var expected = new Im( @@ -183,9 +183,9 @@ public void ImTest(string function) ParseTest(function, expected); } - [Theory] - [InlineData("re(3-2i)")] - [InlineData("real(3-2i)")] + [Test] + [TestCase("re(3-2i)")] + [TestCase("real(3-2i)")] public void ReTest(string function) { var expected = new Re( @@ -201,7 +201,7 @@ public void ReTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void PhaseTest() { var expected = new Phase( @@ -217,7 +217,7 @@ public void PhaseTest() ParseTest("phase(3-2i)", expected); } - [Fact] + [Test] public void ConjugateTest() { var expected = new Conjugate( @@ -233,7 +233,7 @@ public void ConjugateTest() ParseTest("conjugate(3-2i)", expected); } - [Fact] + [Test] public void ReciprocalTest() { var expected = new Reciprocal( @@ -249,7 +249,7 @@ public void ReciprocalTest() ParseTest("reciprocal(3-2i)", expected); } - [Fact] + [Test] public void ToComplexTest() => ParseTest("tocomplex(2)", new ToComplex(Number.Two)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/ConditionalOperatorTests.cs b/xFunc.Tests/ParserTests/ConditionalOperatorTests.cs index 0db9246b8..59f8a5ca2 100644 --- a/xFunc.Tests/ParserTests/ConditionalOperatorTests.cs +++ b/xFunc.Tests/ParserTests/ConditionalOperatorTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.ParserTests; public class ConditionalOperatorTests : BaseParserTests { - [Fact] + [Test] public void ConditionalAndTest() { var expected = new ConditionalAnd( @@ -16,7 +16,7 @@ public void ConditionalAndTest() ParseTest("x == 0 && y != 0", expected); } - [Fact] + [Test] public void ConditionalOrTest() { var expected = new ConditionalOr( @@ -27,7 +27,7 @@ public void ConditionalOrTest() ParseTest("x == 0 || y != 0", expected); } - [Fact] + [Test] public void ConditionalPrecedenceTest() { var expected = new ConditionalOr( @@ -38,9 +38,9 @@ public void ConditionalPrecedenceTest() ParseTest("x || y && z", expected); } - [Theory] - [InlineData("x == 0 &&")] - [InlineData("x == 0 ||")] + [Test] + [TestCase("x == 0 &&")] + [TestCase("x == 0 ||")] public void ConditionalMissingSecondOperand(string function) => ParseErrorTest(function); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/EqualityOperatorTests.cs b/xFunc.Tests/ParserTests/EqualityOperatorTests.cs index a1a233633..280b3853f 100644 --- a/xFunc.Tests/ParserTests/EqualityOperatorTests.cs +++ b/xFunc.Tests/ParserTests/EqualityOperatorTests.cs @@ -5,15 +5,15 @@ namespace xFunc.Tests.ParserTests; public class EqualityOperatorTests : BaseParserTests { - [Fact] + [Test] public void EqualTest() => ParseTest("x == 0", new Equal(Variable.X, Number.Zero)); - [Fact] + [Test] public void NotEqualTest() => ParseTest("x != 0", new NotEqual(Variable.X, Number.Zero)); - [Fact] + [Test] public void PrecedenceTest() { var expected = new And( diff --git a/xFunc.Tests/ParserTests/ForTests.cs b/xFunc.Tests/ParserTests/ForTests.cs index 467fa853b..2a056f13f 100644 --- a/xFunc.Tests/ParserTests/ForTests.cs +++ b/xFunc.Tests/ParserTests/ForTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.ParserTests; public class ForTests : BaseParserTests { - [Fact] + [Test] public void ForTest() { var expected = new For( @@ -18,7 +18,7 @@ public void ForTest() ParseTest("for(2, x := 0, x < 10, x := x + 1)", expected); } - [Fact] + [Test] public void ForWithIncTest() { var expected = new For( @@ -31,16 +31,16 @@ public void ForWithIncTest() ParseTest("for(2, x := 0, x < 10, x++)", expected); } - [Theory] - [InlineData("for 2, x := 0, x < 10, x++)")] - [InlineData("for(, x := 0, x < 10, x++)")] - [InlineData("for(2 x := 0, x < 10, x++)")] - [InlineData("for(2, , x < 10, x++)")] - [InlineData("for(2, x := z x < 10, x++)")] - [InlineData("for(2, x := 0, , x++)")] - [InlineData("for(2, x := 0, x < 10 x++)")] - [InlineData("for(2, x := 0, x < 10, )")] - [InlineData("for(2, x := 0, x < 10, x++")] + [Test] + [TestCase("for 2, x := 0, x < 10, x++)")] + [TestCase("for(, x := 0, x < 10, x++)")] + [TestCase("for(2 x := 0, x < 10, x++)")] + [TestCase("for(2, , x < 10, x++)")] + [TestCase("for(2, x := z x < 10, x++)")] + [TestCase("for(2, x := 0, , x++)")] + [TestCase("for(2, x := 0, x < 10 x++)")] + [TestCase("for(2, x := 0, x < 10, )")] + [TestCase("for(2, x := 0, x < 10, x++")] public void ForMissingPartsTest(string function) => ParseErrorTest(function); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/GCDTests.cs b/xFunc.Tests/ParserTests/GCDTests.cs index fbc06aebb..a27aa40f2 100644 --- a/xFunc.Tests/ParserTests/GCDTests.cs +++ b/xFunc.Tests/ParserTests/GCDTests.cs @@ -7,18 +7,18 @@ namespace xFunc.Tests.ParserTests; public class GCDTests : BaseParserTests { - [Fact] + [Test] public void CtorNullTest() => Assert.Throws(() => new GCD(new ImmutableArray())); - [Theory] - [InlineData("gcd(12, 16)")] - [InlineData("gcf(12, 16)")] - [InlineData("hcf(12, 16)")] + [Test] + [TestCase("gcd(12, 16)")] + [TestCase("gcf(12, 16)")] + [TestCase("hcf(12, 16)")] public void GCDTest(string function) => ParseTest(function, new GCD(new Number(12), new Number(16))); - [Fact] + [Test] public void GCDOfThreeTest() { var expected = new GCD(new IExpression[] { new Number(12), new Number(16), new Number(8) }); @@ -26,7 +26,7 @@ public void GCDOfThreeTest() ParseTest("gcd(12, 16, 8)", expected); } - [Fact] + [Test] public void UnaryMinusAfterCommaTest() { var expected = new GCD(Number.Two, new UnaryMinus(Variable.X)); @@ -34,9 +34,9 @@ public void UnaryMinusAfterCommaTest() ParseTest("gcd(2, -x)", expected); } - [Theory] - [InlineData("lcm(12, 16)")] - [InlineData("scm(12, 16)")] + [Test] + [TestCase("lcm(12, 16)")] + [TestCase("scm(12, 16)")] public void LCMTest(string function) => ParseTest(function, new LCM(new Number(12), new Number(16))); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/HyperbolicTests.cs b/xFunc.Tests/ParserTests/HyperbolicTests.cs index 21db5ceb7..52dd94bfb 100644 --- a/xFunc.Tests/ParserTests/HyperbolicTests.cs +++ b/xFunc.Tests/ParserTests/HyperbolicTests.cs @@ -5,35 +5,35 @@ namespace xFunc.Tests.ParserTests; public class HyperbolicTests : BaseParserTests { - [Theory] - [InlineData("sinh(2)")] - [InlineData("sh(2)")] + [Test] + [TestCase("sinh(2)")] + [TestCase("sh(2)")] public void SinhTest(string function) => ParseTest(function, new Sinh(Number.Two)); - [Theory] - [InlineData("cosh(2)")] - [InlineData("ch(2)")] + [Test] + [TestCase("cosh(2)")] + [TestCase("ch(2)")] public void CoshTest(string function) => ParseTest(function, new Cosh(Number.Two)); - [Theory] - [InlineData("tanh(2)")] - [InlineData("th(2)")] + [Test] + [TestCase("tanh(2)")] + [TestCase("th(2)")] public void TanhTest(string function) => ParseTest(function, new Tanh(Number.Two)); - [Theory] - [InlineData("coth(2)")] - [InlineData("cth(2)")] + [Test] + [TestCase("coth(2)")] + [TestCase("cth(2)")] public void CothTest(string function) => ParseTest(function, new Coth(Number.Two)); - [Fact] + [Test] public void SechTest() => ParseTest("sech(2)", new Sech(Number.Two)); - [Fact] + [Test] public void CschTest() => ParseTest("csch(2)", new Csch(Number.Two)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/IfTests.cs b/xFunc.Tests/ParserTests/IfTests.cs index d6c316e72..456325d73 100644 --- a/xFunc.Tests/ParserTests/IfTests.cs +++ b/xFunc.Tests/ParserTests/IfTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.ParserTests; public class IfTests : BaseParserTests { - [Fact] + [Test] public void IfThenElseTest() { var expected = new If( @@ -19,7 +19,7 @@ public void IfThenElseTest() ParseTest("if(x == 0 && y != 0, 2, 8)", expected); } - [Fact] + [Test] public void IfThenElseAsExpressionTest() { var expected = new Add( @@ -34,7 +34,7 @@ public void IfThenElseAsExpressionTest() ParseTest("1 + if(x == 0, 2, 8)", expected); } - [Fact] + [Test] public void IfThenTest() { var expected = new If( @@ -48,18 +48,18 @@ public void IfThenTest() ParseTest("if(x == 0 && y != 0, 2)", expected); } - [Theory] - [InlineData("if x == 0 && y != 0, 2, 8)")] - [InlineData("if(, 2, 8)")] - [InlineData("if(x == 0 && y != 0 2, 8)")] - [InlineData("if(x == 0 && y != 0, , 8)")] - [InlineData("if(x == 0 && y != 0, 2 8)")] - [InlineData("if(x == 0 && y != 0, 2, )")] - [InlineData("if(x == 0 && y != 0, 2, 8")] + [Test] + [TestCase("if x == 0 && y != 0, 2, 8)")] + [TestCase("if(, 2, 8)")] + [TestCase("if(x == 0 && y != 0 2, 8)")] + [TestCase("if(x == 0 && y != 0, , 8)")] + [TestCase("if(x == 0 && y != 0, 2 8)")] + [TestCase("if(x == 0 && y != 0, 2, )")] + [TestCase("if(x == 0 && y != 0, 2, 8")] public void IfMissingPartsTest(string function) => ParseErrorTest(function); - [Fact] + [Test] public void TernaryTest() { var expected = new If( @@ -71,14 +71,14 @@ public void TernaryTest() ParseTest("true ? 1 : -1", expected); } - [Theory] - [InlineData("true ? 1 :")] - [InlineData("true ? : -1")] - [InlineData("true ? 1")] + [Test] + [TestCase("true ? 1 :")] + [TestCase("true ? : -1")] + [TestCase("true ? 1")] public void TernaryMissingTest(string function) => ParseErrorTest(function); - [Fact] + [Test] public void TernaryAsExpressionTest() { var expected = new Sin( diff --git a/xFunc.Tests/ParserTests/LambdaTests.cs b/xFunc.Tests/ParserTests/LambdaTests.cs index 818e9a52c..5d12864c7 100644 --- a/xFunc.Tests/ParserTests/LambdaTests.cs +++ b/xFunc.Tests/ParserTests/LambdaTests.cs @@ -5,11 +5,11 @@ namespace xFunc.Tests.ParserTests; public class LambdaTests : BaseParserTests { - [Theory] - [InlineData("(x) -> x")] - [InlineData("(x) −> x")] - [InlineData("(x) => x")] - [InlineData("((x) => x)")] + [Test] + [TestCase("(x) -> x")] + [TestCase("(x) −> x")] + [TestCase("(x) => x")] + [TestCase("((x) => x)")] public void ParseLambdaWithOneParameterTest(string function) { var expected = new Lambda(new[] { "x" }, Variable.X) @@ -18,7 +18,7 @@ public void ParseLambdaWithOneParameterTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void ParseLambdaWithoutParametersTest() { var expected = new Lambda(Array.Empty(), Number.One) @@ -27,7 +27,7 @@ public void ParseLambdaWithoutParametersTest() ParseTest("() => 1", expected); } - [Fact] + [Test] public void ParseLambdaWithTwoParametersTest() { var expected = new Lambda( @@ -38,7 +38,7 @@ public void ParseLambdaWithTwoParametersTest() ParseTest("(x, y) => x + y", expected); } - [Fact] + [Test] public void ParseLambdaOfLambdaTest() { var expected = new Lambda( @@ -52,17 +52,17 @@ public void ParseLambdaOfLambdaTest() ParseTest("(x) => (y) => x + y", expected); } - [Theory] - [InlineData("(x, ")] - [InlineData("(x, y")] - [InlineData("(x, y)")] - [InlineData("(x, y) =>")] - [InlineData("(x, x) => x + x")] - [InlineData("(x,) => x")] + [Test] + [TestCase("(x, ")] + [TestCase("(x, y")] + [TestCase("(x, y)")] + [TestCase("(x, y) =>")] + [TestCase("(x, x) => x + x")] + [TestCase("(x,) => x")] public void ParseLambdaErrorTests(string function) => ParseErrorTest(function); - [Fact] + [Test] public void ParseInlineTest() { var expected = new CallExpression( @@ -75,7 +75,7 @@ public void ParseInlineTest() ParseTest("((x) => sin(x))(90)", expected); } - [Fact] + [Test] public void ParseInlineWithoutParametersTest() { var expected = new CallExpression( @@ -85,7 +85,7 @@ public void ParseInlineWithoutParametersTest() ParseTest("(() => 1)()", expected); } - [Fact] + [Test] public void ParseInlineTwoParametersTest() { var expected = new CallExpression( @@ -99,7 +99,7 @@ public void ParseInlineTwoParametersTest() ParseTest("((x, y) => x + y)(1, 2)", expected); } - [Fact] + [Test] public void ParseFunctionWithCallExpression() { var simplifier = Substitute.For(); @@ -112,7 +112,7 @@ public void ParseFunctionWithCallExpression() ParseTest("simplify((x) => x * x)(1)", expected); } - [Fact] + [Test] public void ParseNestedCallExpression() { var expected = new CallExpression( @@ -124,7 +124,7 @@ public void ParseNestedCallExpression() ParseTest("f(g)(1)(2)", expected); } - [Fact] + [Test] public void ParseComplexCallExpression() { var expected = new Add( diff --git a/xFunc.Tests/ParserTests/LengthUnitTests.cs b/xFunc.Tests/ParserTests/LengthUnitTests.cs index 58fd962b7..8d12b5f47 100644 --- a/xFunc.Tests/ParserTests/LengthUnitTests.cs +++ b/xFunc.Tests/ParserTests/LengthUnitTests.cs @@ -5,71 +5,71 @@ namespace xFunc.Tests.ParserTests; public class LengthUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseMeter() => ParseTest("1 'm'", LengthValue.Meter(1).AsExpression()); - [Fact] + [Test] public void ParseNanometer() => ParseTest("1 'nm'", LengthValue.Nanometer(1).AsExpression()); - [Fact] + [Test] public void ParseMicrometer() => ParseTest("1 'µm'", LengthValue.Micrometer(1).AsExpression()); - [Fact] + [Test] public void ParseMillimeter() => ParseTest("1 'mm'", LengthValue.Millimeter(1).AsExpression()); - [Fact] + [Test] public void ParseCentimeter() => ParseTest("1 'cm'", LengthValue.Centimeter(1).AsExpression()); - [Fact] + [Test] public void ParseDecimeter() => ParseTest("1 'dm'", LengthValue.Decimeter(1).AsExpression()); - [Fact] + [Test] public void ParseKilometer() => ParseTest("1 'km'", LengthValue.Kilometer(1).AsExpression()); - [Fact] + [Test] public void ParseInch() => ParseTest("1 'in'", LengthValue.Inch(1).AsExpression()); - [Fact] + [Test] public void ParseFoot() => ParseTest("1 'ft'", LengthValue.Foot(1).AsExpression()); - [Fact] + [Test] public void ParseYard() => ParseTest("1 'yd'", LengthValue.Yard(1).AsExpression()); - [Fact] + [Test] public void ParseMile() => ParseTest("1 'mi'", LengthValue.Mile(1).AsExpression()); - [Fact] + [Test] public void ParseNauticalMile() => ParseTest("1 'nmi'", LengthValue.NauticalMile(1).AsExpression()); - [Fact] + [Test] public void ParseChain() => ParseTest("1 'ch'", LengthValue.Chain(1).AsExpression()); - [Fact] + [Test] public void ParseRod() => ParseTest("1 'rd'", LengthValue.Rod(1).AsExpression()); - [Fact] + [Test] public void ParseAstronomicalUnit() => ParseTest("1 'au'", LengthValue.AstronomicalUnit(1).AsExpression()); - [Fact] + [Test] public void ParseLightYear() => ParseTest("1 'ly'", LengthValue.LightYear(1).AsExpression()); - [Fact] + [Test] public void ParseParsec() => ParseTest("1 'pc'", LengthValue.Parsec(1).AsExpression()); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/LogTests.cs b/xFunc.Tests/ParserTests/LogTests.cs index 63700524c..8aab0914e 100644 --- a/xFunc.Tests/ParserTests/LogTests.cs +++ b/xFunc.Tests/ParserTests/LogTests.cs @@ -5,25 +5,25 @@ namespace xFunc.Tests.ParserTests; public class LogTests : BaseParserTests { - [Fact] + [Test] public void ParseLog() => ParseTest("log(9, 3)", new Log(new Number(9), new Number(3))); - [Fact] + [Test] public void ParseLogWithOneParam() => ParseErrorTest("log(9)"); - [Theory] - [InlineData("lb(2)")] - [InlineData("log2(2)")] + [Test] + [TestCase("lb(2)")] + [TestCase("log2(2)")] public void LbTest(string function) => ParseTest(function, new Lb(Number.Two)); - [Fact] + [Test] public void LgTest() => ParseTest("lg(2)", new Lg(Number.Two)); - [Fact] + [Test] public void LnTest() => ParseTest("ln(2)", new Ln(Number.Two)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/LogicalOperatorTests.cs b/xFunc.Tests/ParserTests/LogicalOperatorTests.cs index d0988cf6c..cc37721c4 100644 --- a/xFunc.Tests/ParserTests/LogicalOperatorTests.cs +++ b/xFunc.Tests/ParserTests/LogicalOperatorTests.cs @@ -5,19 +5,19 @@ namespace xFunc.Tests.ParserTests; public class LogicalOperatorTests : BaseParserTests { - [Theory] - [InlineData("~2")] - [InlineData("not(2)")] + [Test] + [TestCase("~2")] + [TestCase("not(2)")] public void NotTest(string function) => ParseTest(function, new Not(Number.Two)); - [Theory] - [InlineData("true & false")] - [InlineData("true and false")] + [Test] + [TestCase("true & false")] + [TestCase("true and false")] public void BoolConstTest(string function) => ParseTest(function, new And(Bool.True, Bool.False)); - [Fact] + [Test] public void LogicAddPriorityTest() { var expected = new And( @@ -28,33 +28,33 @@ public void LogicAddPriorityTest() ParseTest("3 > 4 & 1 < 3", expected); } - [Theory] - [InlineData("1 | 2")] - [InlineData("1 or 2")] + [Test] + [TestCase("1 | 2")] + [TestCase("1 or 2")] public void OrTest(string function) => ParseTest(function, new Or(Number.One, Number.Two)); - [Fact] + [Test] public void XOrTest() => ParseTest("1 xor 2", new XOr(Number.One, Number.Two)); - [Fact] + [Test] public void NOrTest() => ParseTest("true nor true", new NOr(Bool.True, Bool.True)); - [Fact] + [Test] public void NAndTest() => ParseTest("true nand true", new NAnd(Bool.True, Bool.True)); - [Fact] + [Test] public void ImplicationTest() => ParseTest("true impl true", new Implication(Bool.True, Bool.True)); - [Fact] + [Test] public void EqualityTest() => ParseTest("true eq true", new Equality(Bool.True, Bool.True)); - [Fact] + [Test] public void AndXOrOrPrecedenceTest() { var expected = new Or( diff --git a/xFunc.Tests/ParserTests/MassUnitTests.cs b/xFunc.Tests/ParserTests/MassUnitTests.cs index a6d0f5132..391f01da9 100644 --- a/xFunc.Tests/ParserTests/MassUnitTests.cs +++ b/xFunc.Tests/ParserTests/MassUnitTests.cs @@ -5,27 +5,27 @@ namespace xFunc.Tests.ParserTests; public class MassUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseKilogram() => ParseTest("1 'kg'", MassValue.Kilogram(1).AsExpression()); - [Fact] + [Test] public void ParseGram() => ParseTest("1 'g'", MassValue.Gram(1).AsExpression()); - [Fact] + [Test] public void ParseMilligram() => ParseTest("1 'mg'", MassValue.Milligram(1).AsExpression()); - [Fact] + [Test] public void ParseTonne() => ParseTest("1 't'", MassValue.Tonne(1).AsExpression()); - [Fact] + [Test] public void ParseOunce() => ParseTest("1 'oz'", MassValue.Ounce(1).AsExpression()); - [Fact] + [Test] public void ParsePound() => ParseTest("1 'lb'", MassValue.Pound(1).AsExpression()); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/NotBalancedParenthesisTests.cs b/xFunc.Tests/ParserTests/NotBalancedParenthesisTests.cs index e62501adc..3f8c2565f 100644 --- a/xFunc.Tests/ParserTests/NotBalancedParenthesisTests.cs +++ b/xFunc.Tests/ParserTests/NotBalancedParenthesisTests.cs @@ -5,14 +5,14 @@ namespace xFunc.Tests.ParserTests; public class NotBalancedParenthesisTests : BaseParserTests { - [Theory] - [InlineData("sin(2(")] - [InlineData("sin)2)")] - [InlineData("sin)2(")] - [InlineData("{2,1")] - [InlineData("}2,1")] - [InlineData("(2")] - [InlineData("func(2")] + [Test] + [TestCase("sin(2(")] + [TestCase("sin)2)")] + [TestCase("sin)2(")] + [TestCase("{2,1")] + [TestCase("}2,1")] + [TestCase("(2")] + [TestCase("func(2")] public void NotBalancedTest(string function) => ParseErrorTest(function); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/NumberTests.cs b/xFunc.Tests/ParserTests/NumberTests.cs index 9b95dbbae..6bcc0c8f4 100644 --- a/xFunc.Tests/ParserTests/NumberTests.cs +++ b/xFunc.Tests/ParserTests/NumberTests.cs @@ -5,31 +5,31 @@ namespace xFunc.Tests.ParserTests; public class NumberTests : BaseParserTests { - [Fact] + [Test] public void NumberFormatTest() => ParseErrorTest("0."); - [Theory] - [InlineData("1.2345E-10", 0.00000000012345)] - [InlineData("1.2345E10", 12345000000)] - [InlineData("1.2345E+10", 12345000000)] - [InlineData("1.2e2", 120)] + [Test] + [TestCase("1.2345E-10", 0.00000000012345)] + [TestCase("1.2345E10", 12345000000)] + [TestCase("1.2345E+10", 12345000000)] + [TestCase("1.2e2", 120)] public void ExpNegativeNumber(string exp, double number) => ParseTest(exp, new Number(number)); - [Theory] - [InlineData("0b01100110")] - [InlineData("0B01100110")] + [Test] + [TestCase("0b01100110")] + [TestCase("0B01100110")] public void BinTest(string function) => ParseTest(function, new Number(0b01100110)); - [Theory] - [InlineData("0XFF00")] - [InlineData("0xff00")] + [Test] + [TestCase("0XFF00")] + [TestCase("0xff00")] public void HexTest(string function) => ParseTest(function, new Number(0xFF00)); - [Fact] + [Test] public void OctTest() => ParseTest("0436", new Number(286)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/ParserTest.cs b/xFunc.Tests/ParserTests/ParserTest.cs index 64ecf345c..ea6c022fe 100644 --- a/xFunc.Tests/ParserTests/ParserTest.cs +++ b/xFunc.Tests/ParserTests/ParserTest.cs @@ -8,50 +8,50 @@ namespace xFunc.Tests.ParserTests; public class ParserTest : BaseParserTests { - [Fact] + [Test] public void DifferentiatorNull() => Assert.Throws(() => new Parser(null, null, null)); - [Fact] + [Test] public void SimplifierNull() => Assert.Throws(() => new Parser(new Differentiator(), null, null)); - [Fact] + [Test] public void ConverterNull() => Assert.Throws(() => new Parser(new Differentiator(), new Simplifier(), null)); - [Theory] - [InlineData(null)] - [InlineData("")] + [Test] + [TestCase(null)] + [TestCase("")] public void ParseNull(string function) => ParseErrorTest(function); - [Fact] + [Test] public void NotSupportedSymbol() => ParseErrorTest("@"); - [Theory] - [InlineData("\t2 + 2")] - [InlineData("\n2 + 2")] - [InlineData("\r2 + 2")] + [Test] + [TestCase("\t2 + 2")] + [TestCase("\n2 + 2")] + [TestCase("\r2 + 2")] public void TabTest(string function) => ParseTest(function, new Add(Number.Two, Number.Two)); - [Fact] + [Test] public void UseGreekLettersTest() => ParseTest("4 * φ", new Mul(new Number(4), new Variable("φ"))); - [Fact] + [Test] public void ParseRoot() => ParseTest("root(x, 3)", new Root(Variable.X, new Number(3))); - [Fact] + [Test] public void ParseRootWithOneParam() => ParseErrorTest("root(x)"); - [Theory] - [InlineData("deriv(sin(x))")] - [InlineData("derivative(sin(x))")] + [Test] + [TestCase("deriv(sin(x))")] + [TestCase("derivative(sin(x))")] public void ParseDerivWithOneParam(string function) { var diff = new Differentiator(); @@ -61,7 +61,7 @@ public void ParseDerivWithOneParam(string function) ParseTest(function, expected); } - [Fact] + [Test] public void ParseDerivWithTwoParam() { var diff = new Differentiator(); @@ -71,11 +71,11 @@ public void ParseDerivWithTwoParam() ParseTest("deriv(sin(x), x)", expected); } - [Fact] + [Test] public void ErrorWhileParsingTree() => ParseErrorTest("sin(x)2"); - [Fact] + [Test] public void ParseCallExpression() { var expected = new Add( @@ -88,7 +88,7 @@ public void ParseCallExpression() ParseTest("1 + func(x)", expected); } - [Fact] + [Test] public void ParseCallExpressionZeroParameters() { var expected = new Add( @@ -101,7 +101,7 @@ public void ParseCallExpressionZeroParameters() ParseTest("1 + func()", expected); } - [Fact] + [Test] public void CosAddSinTest() { var expected = new Add(new Cos(Variable.X), new Sin(Variable.X)); @@ -109,7 +109,7 @@ public void CosAddSinTest() ParseTest("cos(x) + sin(x)", expected); } - [Fact] + [Test] public void SimplifyTest() { var simp = new Simplifier(); @@ -118,28 +118,28 @@ public void SimplifyTest() ParseTest("simplify(x)", expected); } - [Theory] - [InlineData("factorial(4)")] - [InlineData("fact(4)")] - [InlineData("4!")] + [Test] + [TestCase("factorial(4)")] + [TestCase("fact(4)")] + [TestCase("4!")] public void FactorialTest(string function) => ParseTest(function, new Fact(new Number(4))); - [Theory] - [InlineData("factorial(x)")] - [InlineData("fact(x)")] - [InlineData("x!")] + [Test] + [TestCase("factorial(x)")] + [TestCase("fact(x)")] + [TestCase("x!")] public void FactorialVariableTest(string function) => ParseTest(function, new Fact(Variable.X)); - [Theory] - [InlineData("factorial(n - m)")] - [InlineData("fact(n - m)")] - [InlineData("(n - m)!")] + [Test] + [TestCase("factorial(n - m)")] + [TestCase("fact(n - m)")] + [TestCase("(n - m)!")] public void FactorialComplexTest(string function) => ParseTest(function, new Fact(new Sub(new Variable("n"), new Variable("m")))); - [Fact] + [Test] public void FactorialLambdaTest() { var expected = new CallExpression( @@ -152,12 +152,12 @@ public void FactorialLambdaTest() ParseTest("((x) => (x - 1)!)(2)", expected); } - [Theory] - [InlineData("!")] + [Test] + [TestCase("!")] public void FactIncorrectTest(string function) => ParseErrorTest(function); - [Fact] + [Test] public void SumToTest() { var expected = new Sum(new IExpression[] { Variable.X, new Number(20) }); @@ -165,7 +165,7 @@ public void SumToTest() ParseTest("sum(x, 20)", expected); } - [Fact] + [Test] public void ProductToTest() { var expected = new Product(new IExpression[] { Variable.X, new Number(20) }); @@ -173,7 +173,7 @@ public void ProductToTest() ParseTest("product(x, 20)", expected); } - [Fact] + [Test] public void VectorTest() { var expected = new Vector(new IExpression[] { Number.Two, new Number(3), new Number(4) }); @@ -181,13 +181,13 @@ public void VectorTest() ParseTest("{2, 3, 4}", expected); } - [Theory] - [InlineData("{}")] - [InlineData("{1, }")] + [Test] + [TestCase("{}")] + [TestCase("{1, }")] public void VectorErrorTest(string exp) => ParseErrorTest(exp); - [Fact] + [Test] public void MatrixTest() { var expected = new Matrix(new[] @@ -199,19 +199,19 @@ public void MatrixTest() ParseTest("{{2, 3}, {4, 7}}", expected); } - [Fact] + [Test] public void MatrixErrorTest() => ParseErrorTest("{{1, 2}, }"); - [Fact] + [Test] public void MatrixWithDiffVectorSizeTest() => ParseErrorTest("{{2, 3}, {4, 7, 2}}"); - [Fact] + [Test] public void TooMuchParamsTest() => ParseErrorTest("sin(x, 3)"); - [Fact] + [Test] public void ModuloTest() { var expected = new Mod(new Number(7), Number.Two); @@ -219,9 +219,9 @@ public void ModuloTest() ParseTest("7 % 2", expected); } - [Theory] - [InlineData("2 + 7 % 2")] - [InlineData("2 + 7 mod 2")] + [Test] + [TestCase("2 + 7 % 2")] + [TestCase("2 + 7 mod 2")] public void ModuloAddTest(string function) { var expected = new Add(Number.Two, new Mod(new Number(7), Number.Two)); @@ -229,7 +229,7 @@ public void ModuloAddTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void MinTest() { var expected = new Min(new IExpression[] { Number.One, Number.Two }); @@ -237,7 +237,7 @@ public void MinTest() ParseTest("min(1, 2)", expected); } - [Fact] + [Test] public void MaxTest() { var expected = new Max(new IExpression[] { Number.One, Number.Two }); @@ -245,7 +245,7 @@ public void MaxTest() ParseTest("max(1, 2)", expected); } - [Fact] + [Test] public void AvgTest() { var expected = new Avg(new IExpression[] { Number.One, Number.Two }); @@ -253,7 +253,7 @@ public void AvgTest() ParseTest("avg(1, 2)", expected); } - [Fact] + [Test] public void CountTest() { var expected = new Count(new IExpression[] { Number.One, Number.Two }); @@ -261,7 +261,7 @@ public void CountTest() ParseTest("count(1, 2)", expected); } - [Fact] + [Test] public void VarTest() { var expected = new Var(new IExpression[] { new Number(4), new Number(9) }); @@ -269,7 +269,7 @@ public void VarTest() ParseTest("var(4, 9)", expected); } - [Fact] + [Test] public void VarpTest() { var expected = new Varp(new IExpression[] { new Number(4), new Number(9) }); @@ -277,7 +277,7 @@ public void VarpTest() ParseTest("varp(4, 9)", expected); } - [Fact] + [Test] public void StdevTest() { var expected = new Stdev(new IExpression[] { new Number(4), new Number(9) }); @@ -285,7 +285,7 @@ public void StdevTest() ParseTest("stdev(4, 9)", expected); } - [Fact] + [Test] public void StdevpTest() { var expected = new Stdevp(new IExpression[] { new Number(4), new Number(9) }); @@ -293,9 +293,9 @@ public void StdevpTest() ParseTest("stdevp(4, 9)", expected); } - [Theory] - [InlineData("del(2*x + 3*y + 4*z)")] - [InlineData("nabla(2*x + 3*y + 4*z)")] + [Test] + [TestCase("del(2*x + 3*y + 4*z)")] + [TestCase("nabla(2*x + 3*y + 4*z)")] public void DelTest(string function) { var diff = new Differentiator(); @@ -315,7 +315,7 @@ public void DelTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void AddTest() { var expected = new Add(Number.One, Number.Two); @@ -323,14 +323,14 @@ public void AddTest() ParseTest("add(1, 2)", expected); } - [Fact] + [Test] public void AddMoreParamsTest() => ParseErrorTest("add(1, 2, 3)"); - [Theory] - [InlineData("sub(1, 2)")] - [InlineData("1 - 2")] - [InlineData("1 − 2")] + [Test] + [TestCase("sub(1, 2)")] + [TestCase("1 - 2")] + [TestCase("1 − 2")] public void SubTest(string function) { var expected = new Sub(Number.One, Number.Two); @@ -338,10 +338,10 @@ public void SubTest(string function) ParseTest(function, expected); } - [Theory] - [InlineData("mul(1, 2)")] - [InlineData("1 * 2")] - [InlineData("1 × 2")] + [Test] + [TestCase("mul(1, 2)")] + [TestCase("1 * 2")] + [TestCase("1 × 2")] public void MulTest(string function) { var expected = new Mul(Number.One, Number.Two); @@ -349,36 +349,36 @@ public void MulTest(string function) ParseTest(function, expected); } - [Theory] - [InlineData("2 |")] - [InlineData("2 ->")] - [InlineData("2 <->")] - [InlineData("2 nand")] - [InlineData("2 nor")] - [InlineData("2 and")] - [InlineData("2 or")] - [InlineData("2 xor")] - [InlineData("2 eq")] - [InlineData("2 impl")] - [InlineData("2 ==")] - [InlineData("2 !=")] - [InlineData("2 <")] - [InlineData("2 >")] - [InlineData("2 <=")] - [InlineData("2 >=")] - [InlineData("2 <<")] - [InlineData("2 >>")] - [InlineData("2 +")] - [InlineData("2 -")] - [InlineData("2 *")] - [InlineData("2 /")] - [InlineData("2 %")] + [Test] + [TestCase("2 |")] + [TestCase("2 ->")] + [TestCase("2 <->")] + [TestCase("2 nand")] + [TestCase("2 nor")] + [TestCase("2 and")] + [TestCase("2 or")] + [TestCase("2 xor")] + [TestCase("2 eq")] + [TestCase("2 impl")] + [TestCase("2 ==")] + [TestCase("2 !=")] + [TestCase("2 <")] + [TestCase("2 >")] + [TestCase("2 <=")] + [TestCase("2 >=")] + [TestCase("2 <<")] + [TestCase("2 >>")] + [TestCase("2 +")] + [TestCase("2 -")] + [TestCase("2 *")] + [TestCase("2 /")] + [TestCase("2 %")] public void MissingSecondPartTest(string exp) => ParseErrorTest(exp); - [Theory] - [InlineData("div(1, 2)")] - [InlineData("1 / 2")] + [Test] + [TestCase("div(1, 2)")] + [TestCase("1 / 2")] public void DivFuncTest(string function) { var expected = new Div(Number.One, Number.Two); @@ -386,11 +386,11 @@ public void DivFuncTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void UnaryMinusTest() => ParseTest("-2", new UnaryMinus(Number.Two)); - [Fact] + [Test] public void SignTest() { var expected = new Sign(new UnaryMinus(new Number(10))); @@ -398,47 +398,47 @@ public void SignTest() ParseTest("sign(-10)", expected); } - [Theory] - [InlineData("2~")] - [InlineData("(2 + 1)~")] + [Test] + [TestCase("2~")] + [TestCase("(2 + 1)~")] public void NotAfterNumberTest(string function) => ParseErrorTest(function); - [Fact] + [Test] public void AbsTest() => ParseTest("abs(2)", new Abs(Number.Two)); - [Fact] + [Test] public void ExpTest() => ParseTest("exp(2)", new Exp(Number.Two)); - [Fact] + [Test] public void FloorTest() => ParseTest("floor(2)", new Floor(Number.Two)); - [Fact] + [Test] public void CeilTest() => ParseTest("ceil(2)", new Ceil(Number.Two)); - [Theory] - [InlineData("trunc(2)")] - [InlineData("truncate(2)")] + [Test] + [TestCase("trunc(2)")] + [TestCase("truncate(2)")] public void TruncTest(string function) => ParseTest(function, new Trunc(Number.Two)); - [Fact] + [Test] public void FracTest() => ParseTest("frac(2)", new Frac(Number.Two)); - [Fact] + [Test] public void RoundTest() => ParseTest("round(2, 3)", new Round(Number.Two, new Number(3))); - [Fact] + [Test] public void SqrtTest() => ParseTest("sqrt(2)", new Sqrt(Number.Two)); - [Fact] + [Test] public void DotProductTest() { var expected = new DotProduct( @@ -449,7 +449,7 @@ public void DotProductTest() ParseTest("dotproduct({1, 2}, {3, 4})", expected); } - [Fact] + [Test] public void CrossProductTest() { var expected = new CrossProduct( @@ -460,7 +460,7 @@ public void CrossProductTest() ParseTest("crossproduct({1, 2, 3}, {4, 5, 6})", expected); } - [Fact] + [Test] public void TransposeTest() { var expected = new Transpose( @@ -474,9 +474,9 @@ public void TransposeTest() ParseTest("transpose({{2, 3}, {4, 7}})", expected); } - [Theory] - [InlineData("determinant({{2, 3}, {4, 7}})")] - [InlineData("det({{2, 3}, {4, 7}})")] + [Test] + [TestCase("determinant({{2, 3}, {4, 7}})")] + [TestCase("det({{2, 3}, {4, 7}})")] public void DeterminantTest(string function) { var expected = new Determinant( @@ -490,7 +490,7 @@ public void DeterminantTest(string function) ParseTest(function, expected); } - [Fact] + [Test] public void InverseTest() { var expected = new Inverse( @@ -504,15 +504,15 @@ public void InverseTest() ParseTest("inverse({{2, 3}, {4, 7}})", expected); } - [Fact] + [Test] public void RoundNotEnoughParameters() => ParseErrorTest("round()"); - [Fact] + [Test] public void NotEnoughParamsTest() => ParseErrorTest("derivative(x,)"); - [Fact] + [Test] public void NumAndVar() { var expected = new Mul( @@ -523,7 +523,7 @@ public void NumAndVar() ParseTest("-2 * x", expected); } - [Fact] + [Test] public void NumAndFunc() { var expected = new Mul( @@ -534,7 +534,7 @@ public void NumAndFunc() ParseTest("5*cos(x)", expected); } - [Fact] + [Test] public void Pi() { var expected = new Mul( @@ -545,7 +545,7 @@ public void Pi() ParseTest("3pi", expected); } - [Fact] + [Test] public void NumberMulBracketTest() { var expected = new Mul( @@ -559,7 +559,7 @@ public void NumberMulBracketTest() ParseTest("2 * (x + y)", expected); } - [Fact] + [Test] public void NumberMulVectorTest() { var expected = new Mul( @@ -570,7 +570,7 @@ public void NumberMulVectorTest() ParseTest("2{1, 2}", expected); } - [Fact] + [Test] public void NumberMulMatrixTest() { var expected = new Mul( @@ -585,23 +585,23 @@ public void NumberMulMatrixTest() ParseTest("2{{1, 2}, {3, 4}}", expected); } - [Fact] + [Test] public void MatrixMissingCloseBraceTest() => ParseErrorTest("{{1}"); - [Fact] + [Test] public void UnaryPlusTest() => ParseTest("(+2)", Number.Two); - [Fact] + [Test] public void SinUnaryPlusTest() => ParseTest("sin(+2)", new Sin(Number.Two)); - [Fact] + [Test] public void UnaryPlusVariableTest() => ParseTest("sin(+x)", new Sin(Variable.X)); - [Fact] + [Test] public void Integer() { var expected = new Add( @@ -612,7 +612,7 @@ public void Integer() ParseTest("-2764786 + 46489879", expected); } - [Fact] + [Test] public void Double() { var expected = new Add( @@ -623,7 +623,7 @@ public void Double() ParseTest("-45.3 + 87.64", expected); } - [Fact] + [Test] public void SubAfterOpenBracket() { var expected = new UnaryMinus(Number.Two); @@ -631,23 +631,23 @@ public void SubAfterOpenBracket() ParseTest("(-2)", expected); } - [Fact] + [Test] public void ParseSinWithIncorrectParametersCount() => ParseErrorTest("sin(1, 2) + cos()"); - [Fact] + [Test] public void ParseSinWithoutParameters() => ParseErrorTest("sin(1)cos()"); - [Fact] + [Test] public void ParseCosWithIncorrectParametersCount() => ParseErrorTest("cos(sin(1), 2)+"); - [Fact] + [Test] public void ParseCosWithoutParam() => ParseErrorTest("cos()1"); - [Fact] + [Test] public void LeftShiftTest() { var expected = new LeftShift(Number.One, new Number(10)); @@ -655,7 +655,7 @@ public void LeftShiftTest() ParseTest("1 << 10", expected); } - [Fact] + [Test] public void RightShiftTest() { var expected = new RightShift(Number.One, new Number(10)); @@ -663,7 +663,7 @@ public void RightShiftTest() ParseTest("1 >> 10", expected); } - [Fact] + [Test] public void LeftShiftComplexTest() { var expected = new LeftShift( @@ -674,59 +674,59 @@ public void LeftShiftComplexTest() ParseTest("1 << 2 << 3", expected); } - [Fact] + [Test] public void TrueConstCaseInsensitive() => ParseTest("tRuE", Bool.True); - [Fact] + [Test] public void SinCaseInsensitive() => ParseTest("sIn(x)", new Sin(Variable.X)); - [Fact] + [Test] public void VariableCaseSensitive() => ParseTest("X", new Variable("X")); - [Fact] + [Test] public void VarWithNumber1() => ParseTest("x1", new Variable("x1")); - [Fact] + [Test] public void VarWithNumber2() => ParseTest("xdsa13213", new Variable("xdsa13213")); - [Fact] + [Test] public void VarWithNumber3() => ParseTest("x1b2v3", new Variable("x1b2v3")); - [Fact] + [Test] public void ToBinTest() => ParseTest("tobin(10)", new ToBin(new Number(10))); - [Fact] + [Test] public void ToOctTest() => ParseTest("tooct(10)", new ToOct(new Number(10))); - [Fact] + [Test] public void ToHexTest() => ParseTest("tohex(10)", new ToHex(new Number(10))); - [Fact] + [Test] public void LeadingSpaces() => ParseTest(" 1", Number.One); - [Fact] + [Test] public void TrailingSpaces() => ParseTest("1 ", Number.One); - [Fact] + [Test] public void BufferOverflow() => parser.Parse("a1 := (a2 := (a3 := (a4 := (a5 := (a6 := (a7 := (a8 := (a9 := (a10 := (a11 := (a12 := (a13 := (a14 := (a15 := (a16 := (a17 := (a18 := 1)))))))))))))))))"); - [Fact] + [Test] public void RationalParse() => ParseTest("1 // 2", new Rational(Number.One, Number.Two)); - [Fact] + [Test] public void ToRationalParse() => ParseTest("torational(1)", new ToRational(Number.One)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/PowerTests.cs b/xFunc.Tests/ParserTests/PowerTests.cs index 323f7173b..d33ed6635 100644 --- a/xFunc.Tests/ParserTests/PowerTests.cs +++ b/xFunc.Tests/ParserTests/PowerTests.cs @@ -5,13 +5,13 @@ namespace xFunc.Tests.ParserTests; public class PowerTests : BaseParserTests { - [Theory] - [InlineData("pow(1, 2)")] - [InlineData("1 ^ 2")] + [Test] + [TestCase("pow(1, 2)")] + [TestCase("1 ^ 2")] public void PowFuncTest(string function) => ParseTest(function, new Pow(Number.One, Number.Two)); - [Fact] + [Test] public void PowRightAssociativityTest() { var expected = new Pow(Number.One, new Pow(Number.Two, new Number(3))); @@ -19,7 +19,7 @@ public void PowRightAssociativityTest() ParseTest("1 ^ 2 ^ 3", expected); } - [Fact] + [Test] public void PowUnaryMinusTest() { var expected = new UnaryMinus(new Pow(Number.One, Number.Two)); @@ -27,7 +27,7 @@ public void PowUnaryMinusTest() ParseTest("-1 ^ 2", expected); } - [Fact] + [Test] public void PowerWithUnaryMinus() { var expected = new Pow(Number.Two, new UnaryMinus(Number.Two)); @@ -35,7 +35,7 @@ public void PowerWithUnaryMinus() ParseTest("2 ^ -2", expected); } - [Fact] + [Test] public void ImplicitMulAndPowerFunction() { var expected = new Mul( @@ -46,7 +46,7 @@ public void ImplicitMulAndPowerFunction() ParseTest("2sin(x) ^ 2", expected); } - [Fact] + [Test] public void ImplicitMulAndPowerVariable() { var expected = new Mul( @@ -57,7 +57,7 @@ public void ImplicitMulAndPowerVariable() ParseTest("2x^2", expected); } - [Fact] + [Test] public void ImplicitNegativeNumberMulAndPowerVariable() { var expected = new Mul( @@ -68,9 +68,9 @@ public void ImplicitNegativeNumberMulAndPowerVariable() ParseTest("-2x^2", expected); } - [Theory] - [InlineData("2 ^")] - [InlineData("2x ^")] + [Test] + [TestCase("2 ^")] + [TestCase("2x ^")] public void PowErrorTest(string exp) => ParseErrorTest(exp); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/PowerUnitTests.cs b/xFunc.Tests/ParserTests/PowerUnitTests.cs index 28f8dcd3d..f489a1eee 100644 --- a/xFunc.Tests/ParserTests/PowerUnitTests.cs +++ b/xFunc.Tests/ParserTests/PowerUnitTests.cs @@ -5,15 +5,15 @@ namespace xFunc.Tests.ParserTests; public class PowerUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseWatt() => ParseTest("1 'W'", PowerValue.Watt(1).AsExpression()); - [Fact] + [Test] public void ParseKilowatt() => ParseTest("1 'kW'", PowerValue.Kilowatt(1).AsExpression()); - [Fact] + [Test] public void ParseHorsepower() => ParseTest("1 'hp'", PowerValue.Horsepower(1).AsExpression()); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/RelationalOperatorTests.cs b/xFunc.Tests/ParserTests/RelationalOperatorTests.cs index 45bd3acf9..ebf0ad619 100644 --- a/xFunc.Tests/ParserTests/RelationalOperatorTests.cs +++ b/xFunc.Tests/ParserTests/RelationalOperatorTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.ParserTests; public class RelationalOperatorTests : BaseParserTests { - [Fact] + [Test] public void LessThenTest() { var expected = new LessThan(Variable.X, Number.Zero); @@ -13,7 +13,7 @@ public void LessThenTest() ParseTest("x < 0", expected); } - [Fact] + [Test] public void LessOrEqualTest() { var expected = new LessOrEqual(Variable.X, Number.Zero); @@ -21,7 +21,7 @@ public void LessOrEqualTest() ParseTest("x <= 0", expected); } - [Fact] + [Test] public void GreaterThenTest() { var expected = new GreaterThan(Variable.X, Number.Zero); @@ -29,7 +29,7 @@ public void GreaterThenTest() ParseTest("x > 0", expected); } - [Fact] + [Test] public void GreaterOrEqualTest() { var expected = new GreaterOrEqual(Variable.X, Number.Zero); @@ -37,7 +37,7 @@ public void GreaterOrEqualTest() ParseTest("x >= 0", expected); } - [Fact] + [Test] public void PrecedenceTest() { var expected = new NotEqual( diff --git a/xFunc.Tests/ParserTests/ReverseHyperbolicTests.cs b/xFunc.Tests/ParserTests/ReverseHyperbolicTests.cs index 9018d0d0c..8b66607b1 100644 --- a/xFunc.Tests/ParserTests/ReverseHyperbolicTests.cs +++ b/xFunc.Tests/ParserTests/ReverseHyperbolicTests.cs @@ -5,37 +5,37 @@ namespace xFunc.Tests.ParserTests; public class ReverseHyperbolicTests : BaseParserTests { - [Theory] - [InlineData("arsinh(2)")] - [InlineData("arsh(2)")] + [Test] + [TestCase("arsinh(2)")] + [TestCase("arsh(2)")] public void ArsinhTest(string function) => ParseTest(function, new Arsinh(Number.Two)); - [Theory] - [InlineData("arcosh(2)")] - [InlineData("arch(2)")] + [Test] + [TestCase("arcosh(2)")] + [TestCase("arch(2)")] public void ArcoshTest(string function) => ParseTest(function, new Arcosh(Number.Two)); - [Theory] - [InlineData("artanh(2)")] - [InlineData("arth(2)")] + [Test] + [TestCase("artanh(2)")] + [TestCase("arth(2)")] public void ArtanhTest(string function) => ParseTest(function, new Artanh(Number.Two)); - [Theory] - [InlineData("arcoth(2)")] - [InlineData("arcth(2)")] + [Test] + [TestCase("arcoth(2)")] + [TestCase("arcth(2)")] public void ArcothTest(string function) => ParseTest(function, new Arcoth(Number.Two)); - [Theory] - [InlineData("arsech(2)")] - [InlineData("arsch(2)")] + [Test] + [TestCase("arsech(2)")] + [TestCase("arsch(2)")] public void ArsechTest(string function) => ParseTest(function, new Arsech(Number.Two)); - [Fact] + [Test] public void ArcschTest() => ParseTest("arcsch(2)", new Arcsch(Number.Two)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/ReverseTrigonometricTests.cs b/xFunc.Tests/ParserTests/ReverseTrigonometricTests.cs index 133d14ac6..717b57c65 100644 --- a/xFunc.Tests/ParserTests/ReverseTrigonometricTests.cs +++ b/xFunc.Tests/ParserTests/ReverseTrigonometricTests.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.ParserTests; public class ReverseTrigonometricTests : BaseParserTests { - [Fact] + [Test] public void ArcsinTest() => ParseTest("arcsin(2)", new Arcsin(Number.Two)); - [Fact] + [Test] public void ArccosTest() => ParseTest("arccos(2)", new Arccos(Number.Two)); - [Theory] - [InlineData("arctan(2)")] - [InlineData("arctg(2)")] + [Test] + [TestCase("arctan(2)")] + [TestCase("arctg(2)")] public void ArctanTest(string function) => ParseTest(function, new Arctan(Number.Two)); - [Theory] - [InlineData("arccot(2)")] - [InlineData("arcctg(2)")] + [Test] + [TestCase("arccot(2)")] + [TestCase("arcctg(2)")] public void ArccotTest(string function) => ParseTest(function, new Arccot(Number.Two)); - [Fact] + [Test] public void ArcsecTest() => ParseTest("arcsec(2)", new Arcsec(Number.Two)); - [Theory] - [InlineData("arccsc(2)")] - [InlineData("arccosec(2)")] + [Test] + [TestCase("arccsc(2)")] + [TestCase("arccosec(2)")] public void ArccscTest(string function) => ParseTest(function, new Arccsc(Number.Two)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/StringTests.cs b/xFunc.Tests/ParserTests/StringTests.cs index c3cfbac93..a79cfba1c 100644 --- a/xFunc.Tests/ParserTests/StringTests.cs +++ b/xFunc.Tests/ParserTests/StringTests.cs @@ -5,23 +5,23 @@ namespace xFunc.Tests.ParserTests; public class StringTests : BaseParserTests { - [Theory] - [InlineData("\"\"", "")] - [InlineData("''", "")] - [InlineData("\"hello\"", "hello")] - [InlineData("'hello'", "hello")] - [InlineData("\"hello, 'inline'\"", "hello, 'inline'")] - [InlineData("'hello, \"inline\"'", "hello, \"inline\"")] - [InlineData("\"sin(x)\"", "sin(x)")] + [Test] + [TestCase("\"\"", "")] + [TestCase("''", "")] + [TestCase("\"hello\"", "hello")] + [TestCase("'hello'", "hello")] + [TestCase("\"hello, 'inline'\"", "hello, 'inline'")] + [TestCase("'hello, \"inline\"'", "hello, \"inline\"")] + [TestCase("\"sin(x)\"", "sin(x)")] public void Quotes(string exp, string result) => ParseTest(exp, new StringExpression(result)); - [Theory] - [InlineData("\"hello")] - [InlineData("'hello")] - [InlineData("hello\"")] - [InlineData("hello'")] - [InlineData("\"hello, 'inside'")] + [Test] + [TestCase("\"hello")] + [TestCase("'hello")] + [TestCase("hello\"")] + [TestCase("hello'")] + [TestCase("\"hello, 'inside'")] public void MissingQuote(string exp) => ParseErrorTest(exp); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/TemperatureUnitTests.cs b/xFunc.Tests/ParserTests/TemperatureUnitTests.cs index 1af793542..28803f6f4 100644 --- a/xFunc.Tests/ParserTests/TemperatureUnitTests.cs +++ b/xFunc.Tests/ParserTests/TemperatureUnitTests.cs @@ -5,15 +5,15 @@ namespace xFunc.Tests.ParserTests; public class TemperatureUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseCelsius() => ParseTest("1 '°C'", TemperatureValue.Celsius(1).AsExpression()); - [Fact] + [Test] public void ParseFahrenheit() => ParseTest("1 '°F'", TemperatureValue.Fahrenheit(1).AsExpression()); - [Fact] + [Test] public void ParseKelvin() => ParseTest("1 'K'", TemperatureValue.Kelvin(1).AsExpression()); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/TimeUnitTests.cs b/xFunc.Tests/ParserTests/TimeUnitTests.cs index de6cde140..3337b09a7 100644 --- a/xFunc.Tests/ParserTests/TimeUnitTests.cs +++ b/xFunc.Tests/ParserTests/TimeUnitTests.cs @@ -5,39 +5,39 @@ namespace xFunc.Tests.ParserTests; public class TimeUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseSecond() => ParseTest("1 's'", TimeValue.Second(1).AsExpression()); - [Fact] + [Test] public void ParseNanosecond() => ParseTest("1 'ns'", TimeValue.Nanosecond(1).AsExpression()); - [Fact] + [Test] public void ParseMicrosecond() => ParseTest("1 'μs'", TimeValue.Microsecond(1).AsExpression()); - [Fact] + [Test] public void ParseMillisecond() => ParseTest("1 'ms'", TimeValue.Millisecond(1).AsExpression()); - [Fact] + [Test] public void ParseMinute() => ParseTest("1 'min'", TimeValue.Minute(1).AsExpression()); - [Fact] + [Test] public void ParseHour() => ParseTest("1 'h'", TimeValue.Hour(1).AsExpression()); - [Fact] + [Test] public void ParseDay() => ParseTest("1 'day'", TimeValue.Day(1).AsExpression()); - [Fact] + [Test] public void ParseWeek() => ParseTest("1 'week'", TimeValue.Week(1).AsExpression()); - [Fact] + [Test] public void ParseYear() => ParseTest("1 'year'", TimeValue.Year(1).AsExpression()); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/TrigonometricTests.cs b/xFunc.Tests/ParserTests/TrigonometricTests.cs index 8e3191d4e..1758bace9 100644 --- a/xFunc.Tests/ParserTests/TrigonometricTests.cs +++ b/xFunc.Tests/ParserTests/TrigonometricTests.cs @@ -5,33 +5,33 @@ namespace xFunc.Tests.ParserTests; public class TrigonometricTests : BaseParserTests { - [Fact] + [Test] public void SinTest() => ParseTest("sin(2)", new Sin(Number.Two)); - [Fact] + [Test] public void CosTest() => ParseTest("cos(2)", new Cos(Number.Two)); - [Theory] - [InlineData("tan(2)")] - [InlineData("tg(2)")] + [Test] + [TestCase("tan(2)")] + [TestCase("tg(2)")] public void TanTest(string function) => ParseTest(function, new Tan(Number.Two)); - [Theory] - [InlineData("cot(2)")] - [InlineData("ctg(2)")] + [Test] + [TestCase("cot(2)")] + [TestCase("ctg(2)")] public void CotTest(string function) => ParseTest(function, new Cot(Number.Two)); - [Fact] + [Test] public void SecTest() => ParseTest("sec(2)", new Sec(Number.Two)); - [Theory] - [InlineData("csc(2)")] - [InlineData("cosec(2)")] + [Test] + [TestCase("csc(2)")] + [TestCase("cosec(2)")] public void CscTest(string function) => ParseTest(function, new Csc(Number.Two)); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/UnassignTests.cs b/xFunc.Tests/ParserTests/UnassignTests.cs index 131896f2f..450c08da5 100644 --- a/xFunc.Tests/ParserTests/UnassignTests.cs +++ b/xFunc.Tests/ParserTests/UnassignTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.ParserTests; public class UnassignTests : BaseParserTests { - [Fact] + [Test] public void UndefParseTest() { var expected = new Unassign(new Variable("f")); @@ -13,10 +13,10 @@ public void UndefParseTest() ParseTest("unassign(f)", expected); } - [Theory] - [InlineData("unassign x)")] - [InlineData("unassign()")] - [InlineData("unassign(x")] + [Test] + [TestCase("unassign x)")] + [TestCase("unassign()")] + [TestCase("unassign(x")] public void UndefMissingPartsTest(string function) => ParseErrorTest(function); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/UnitTests.cs b/xFunc.Tests/ParserTests/UnitTests.cs index a72fd96f1..e75e94938 100644 --- a/xFunc.Tests/ParserTests/UnitTests.cs +++ b/xFunc.Tests/ParserTests/UnitTests.cs @@ -5,9 +5,9 @@ namespace xFunc.Tests.ParserTests; public class UnitTests : BaseParserTests { - [Theory] - [InlineData("convert(1, 'rad')")] - [InlineData("convert(1, \"rad\")")] + [Test] + [TestCase("convert(1, 'rad')")] + [TestCase("convert(1, \"rad\")")] public void ConvertParseTest(string function) { var converter = new Converter(); diff --git a/xFunc.Tests/ParserTests/VolumeUnitTests.cs b/xFunc.Tests/ParserTests/VolumeUnitTests.cs index cfd238ee5..f04c31995 100644 --- a/xFunc.Tests/ParserTests/VolumeUnitTests.cs +++ b/xFunc.Tests/ParserTests/VolumeUnitTests.cs @@ -5,35 +5,35 @@ namespace xFunc.Tests.ParserTests; public class VolumeUnitTests : BaseParserTests { - [Fact] + [Test] public void ParseSquareMeter() => ParseTest("1 'm^3'", VolumeValue.Meter(1).AsExpression()); - [Fact] + [Test] public void ParseSquareCentimeter() => ParseTest("1 'cm^3'", VolumeValue.Centimeter(1).AsExpression()); - [Fact] + [Test] public void ParseSquareLiter() => ParseTest("1 'l'", VolumeValue.Liter(1).AsExpression()); - [Fact] + [Test] public void ParseSquareInch() => ParseTest("1 'in^3'", VolumeValue.Inch(1).AsExpression()); - [Fact] + [Test] public void ParseSquareFoot() => ParseTest("1 'ft^3'", VolumeValue.Foot(1).AsExpression()); - [Fact] + [Test] public void ParseSquareYard() => ParseTest("1 'yd^3'", VolumeValue.Yard(1).AsExpression()); - [Fact] + [Test] public void ParseGallon() => ParseTest("1 'gal'", VolumeValue.Gallon(1).AsExpression()); - [Fact] + [Test] public void ParseSquareUnitWithoutExponent() => ParseErrorTest("1 'cm^'"); } \ No newline at end of file diff --git a/xFunc.Tests/ParserTests/WhileTests.cs b/xFunc.Tests/ParserTests/WhileTests.cs index 38199cd2f..cd6fdf579 100644 --- a/xFunc.Tests/ParserTests/WhileTests.cs +++ b/xFunc.Tests/ParserTests/WhileTests.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.ParserTests; public class WhileTests : BaseParserTests { - [Fact] + [Test] public void WhileTest() { var expected = new While( @@ -16,12 +16,12 @@ public void WhileTest() ParseTest("while(x := x + 1, 1 == 1)", expected); } - [Theory] - [InlineData("while x := x + 1, 1 == 1)")] - [InlineData("while(, 1 == 1)")] - [InlineData("while(x := x + 1 1 == 1)")] - [InlineData("while(x := x + 1, )")] - [InlineData("while(x := x + 1, 1 == 1")] + [Test] + [TestCase("while x := x + 1, 1 == 1)")] + [TestCase("while(, 1 == 1)")] + [TestCase("while(x := x + 1 1 == 1)")] + [TestCase("while(x := x + 1, )")] + [TestCase("while(x := x + 1, 1 == 1")] public void WhileMissingPartsTest(string function) => ParseErrorTest(function); } \ No newline at end of file diff --git a/xFunc.Tests/ProcessorTest.cs b/xFunc.Tests/ProcessorTest.cs index b762c8b5b..55c49daf4 100644 --- a/xFunc.Tests/ProcessorTest.cs +++ b/xFunc.Tests/ProcessorTest.cs @@ -7,19 +7,15 @@ namespace xFunc.Tests; public class ProcessorTest { - [Fact] + [Test] public void SimplifierNull() => Assert.Throws(() => new Processor(null, null, null, null, null)); - [Fact] + [Test] public void DifferentiatorNull() - { - var simplifier = new Simplifier(); - - Assert.Throws(() => new Processor(simplifier, null)); - } + => Assert.Throws(() => new Processor(new Simplifier(), null)); - [Fact] + [Test] public void ConverterNull() { var simplifier = new Simplifier(); @@ -28,7 +24,7 @@ public void ConverterNull() Assert.Throws(() => new Processor(simplifier, differentiator, null, null, null)); } - [Fact] + [Test] public void TypeAnalyzerNull() { var simplifier = new Simplifier(); @@ -38,7 +34,7 @@ public void TypeAnalyzerNull() Assert.Throws(() => new Processor(simplifier, differentiator, converter, null, null)); } - [Fact] + [Test] public void CtorTest() { var simplifier = new Simplifier(); @@ -47,7 +43,7 @@ public void CtorTest() var processor = new Processor(simplifier, differentiator); } - [Fact] + [Test] public void CtorTest2() { var simplifier = new Simplifier(); @@ -59,16 +55,16 @@ public void CtorTest2() var processor = new Processor(simplifier, differentiator, converter, typeAnalyzer, parameters); } - [Fact] + [Test] public void SolveDoubleTest() { var processor = new Processor(); var result = processor.Solve("1 + 1.1"); - Assert.Equal(2.1, result.Result); + Assert.That(result.Result, Is.EqualTo(2.1)); } - [Fact] + [Test] public void SolveComplexTest() { var processor = new Processor(); @@ -76,39 +72,39 @@ public void SolveComplexTest() var result = processor.Solve("conjugate(2.3 + 1.4i)"); var expected = Complex.Conjugate(new Complex(2.3, 1.4)); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveBoolTest() { var processor = new Processor(); var result = processor.Solve("true & false"); - Assert.False(result.Result); + Assert.That(result.Result, Is.False); } - [Fact] + [Test] public void SolveStringTest() { var processor = new Processor(); var result = processor.Solve("'hello'"); var expected = "hello"; - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveExpTest() { var processor = new Processor(); var result = processor.Solve("deriv(() => x)"); var expected = Number.One.ToLambda(); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveAngleTest() { var processor = new Processor(); @@ -116,10 +112,10 @@ public void SolveAngleTest() var result = processor.Solve("90 'degree'"); var expected = AngleValue.Degree(90); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolvePowerTest() { var processor = new Processor(); @@ -127,10 +123,10 @@ public void SolvePowerTest() var result = processor.Solve("10 'W'"); var expected = PowerValue.Watt(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveTemperatureTest() { var processor = new Processor(); @@ -138,10 +134,10 @@ public void SolveTemperatureTest() var result = processor.Solve("10 '°C'"); var expected = TemperatureValue.Celsius(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveMassTest() { var processor = new Processor(); @@ -149,10 +145,10 @@ public void SolveMassTest() var result = processor.Solve("10 'g'"); var expected = MassValue.Gram(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveLengthTest() { var processor = new Processor(); @@ -160,10 +156,10 @@ public void SolveLengthTest() var result = processor.Solve("10 'm'"); var expected = LengthValue.Meter(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveTimeTest() { var processor = new Processor(); @@ -171,10 +167,10 @@ public void SolveTimeTest() var result = processor.Solve("10 's'"); var expected = TimeValue.Second(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveAreaTest() { var processor = new Processor(); @@ -182,10 +178,10 @@ public void SolveAreaTest() var result = processor.Solve("10 'm^2'"); var expected = AreaValue.Meter(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveVolumeTest() { var processor = new Processor(); @@ -193,10 +189,10 @@ public void SolveVolumeTest() var result = processor.Solve("10 'm^3'"); var expected = VolumeValue.Meter(10); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveLambdaTest() { var processor = new Processor(); @@ -204,10 +200,10 @@ public void SolveLambdaTest() var result = processor.Solve("(x) => x"); var expected = new Lambda(new[] { "x" }, Variable.X); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveVectorTest() { var processor = new Processor(); @@ -215,10 +211,10 @@ public void SolveVectorTest() var result = processor.Solve("{1, 2}"); var expected = VectorValue.Create(NumberValue.One, NumberValue.Two); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveMatrixTest() { var processor = new Processor(); @@ -230,10 +226,10 @@ public void SolveMatrixTest() new NumberValue[] { NumberValue.Two, NumberValue.One }, }); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SolveRationalTest() { var processor = new Processor(); @@ -241,10 +237,10 @@ public void SolveRationalTest() var result = processor.Solve("1 // 3"); var expected = new RationalValue(1, 3); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void ParseTest() { var processor = new Processor(); @@ -252,10 +248,10 @@ public void ParseTest() var result = processor.Parse("x + 1"); var expected = new Add(Variable.X, Number.One); - Assert.Equal(expected, result); + Assert.That(result, Is.EqualTo(expected)); } - [Fact] + [Test] public void SimplifyTest() { var processor = new Processor(); @@ -263,19 +259,19 @@ public void SimplifyTest() var exp = new Add(Number.One, Number.One); var result = processor.Simplify(exp); - Assert.Equal(Number.Two, result); + Assert.That(result, Is.EqualTo(Number.Two)); } - [Fact] + [Test] public void SimplifyFunctionTest() { var processor = new Processor(); var result = processor.Simplify("1 + 1"); - Assert.Equal(Number.Two, result); + Assert.That(result, Is.EqualTo(Number.Two)); } - [Fact] + [Test] public void SimplifyNullTest() { var processor = new Processor(); @@ -283,25 +279,25 @@ public void SimplifyNullTest() Assert.Throws(() => processor.Simplify(null as IExpression)); } - [Fact] + [Test] public void DifferentiateExpTest() { var processor = new Processor(); var result = processor.Differentiate(new Add(Variable.X, Number.One)); - Assert.Equal(Number.One, result); + Assert.That(result, Is.EqualTo(Number.One)); } - [Fact] + [Test] public void DifferentiateFunctionTest() { var processor = new Processor(); var result = processor.Differentiate("x + 1"); - Assert.Equal(Number.One, result); + Assert.That(result, Is.EqualTo(Number.One)); } - [Fact] + [Test] public void DifferentiateNullExpTest() { var processor = new Processor(); @@ -309,7 +305,7 @@ public void DifferentiateNullExpTest() Assert.Throws(() => processor.Differentiate(null as IExpression)); } - [Fact] + [Test] public void DifferentiateVarTest() { var processor = new Processor(); @@ -317,10 +313,10 @@ public void DifferentiateVarTest() var y = Variable.Y; var result = processor.Differentiate(new Add(y, Number.One), y); - Assert.Equal(Number.One, result); + Assert.That(result, Is.EqualTo(Number.One)); } - [Fact] + [Test] public void DifferentiateParamsTest() { var processor = new Processor(); @@ -328,10 +324,10 @@ public void DifferentiateParamsTest() var y = Variable.Y; var result = processor.Differentiate(new Add(y, Number.One), y, new ExpressionParameters()); - Assert.Equal(Number.One, result); + Assert.That(result, Is.EqualTo(Number.One)); } - [Fact] + [Test] public void AliasTest() { var processor = new Processor(); @@ -340,10 +336,10 @@ public void AliasTest() var result = processor.Solve("s(() => x * x)"); var expected = new Pow(Variable.X, Number.Two).ToLambda(); - Assert.Equal(expected, result.Result); + Assert.That(result.Result, Is.EqualTo(expected)); } - [Fact] + [Test] public void LambdaClosureTest1() { var processor = new Processor(); @@ -352,12 +348,12 @@ public void LambdaClosureTest1() var addResult = processor.Solve("add1 := f(1)"); var result = processor.Solve("add1(2)"); - Assert.Equal("(x) => (y) => x + y", lambdaResult.Result.ToString()); - Assert.Equal("(y) => x + y", addResult.Result.ToString()); - Assert.Equal(3.0, result.Result); + Assert.That(lambdaResult.Result.ToString(), Is.EqualTo("(x) => (y) => x + y")); + Assert.That(addResult.Result.ToString(), Is.EqualTo("(y) => x + y")); + Assert.That(result.Result, Is.EqualTo(3.0)); } - [Fact] + [Test] public void LambdaClosureTest2() { var processor = new Processor(); @@ -365,11 +361,11 @@ public void LambdaClosureTest2() var lambdaResult = processor.Solve("f := (x) => (y) => x + y"); var result = processor.Solve("f(1)(2)"); - Assert.Equal("(x) => (y) => x + y", lambdaResult.Result.ToString()); - Assert.Equal(3.0, result.Result); + Assert.That(lambdaResult.Result.ToString(), Is.EqualTo("(x) => (y) => x + y")); + Assert.That(result.Result, Is.EqualTo(3.0)); } - [Fact] + [Test] public void ClosureTest() { var processor = new Processor(); @@ -378,6 +374,6 @@ public void ClosureTest() processor.Solve("(() => x := 2)()"); var result = processor.Solve("x"); - Assert.Equal(2.0, result.Result); + Assert.That(result.Result, Is.EqualTo(2.0)); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/AngleNumberResultTest.cs b/xFunc.Tests/Results/AngleNumberResultTest.cs index ed4d3a7be..4cc01f6e1 100644 --- a/xFunc.Tests/Results/AngleNumberResultTest.cs +++ b/xFunc.Tests/Results/AngleNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class AngleNumberResultTest { - [Fact] + [Test] public void ResultTest() { var angle = AngleValue.Degree(10); var result = new AngleNumberResult(angle); - Assert.Equal(angle, result.Result); + Assert.That(result.Result, Is.EqualTo(angle)); } - [Fact] + [Test] public void IResultTest() { var angle = AngleValue.Degree(10); var result = new AngleNumberResult(angle) as IResult; - Assert.Equal(angle, result.Result); + Assert.That(result.Result, Is.EqualTo(angle)); } - [Fact] + [Test] public void ToStringTest() { var angle = AngleValue.Degree(10); var result = new AngleNumberResult(angle); - Assert.Equal("10 degree", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 degree")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/AreaNumberResultTest.cs b/xFunc.Tests/Results/AreaNumberResultTest.cs index d0c9505f0..5ccdee58a 100644 --- a/xFunc.Tests/Results/AreaNumberResultTest.cs +++ b/xFunc.Tests/Results/AreaNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class AreaNumberResultTest { - [Fact] + [Test] public void ResultTest() { var areaValue = AreaValue.Meter(10); var result = new AreaNumberResult(areaValue); - Assert.Equal(areaValue, result.Result); + Assert.That(result.Result, Is.EqualTo(areaValue)); } - [Fact] + [Test] public void IResultTest() { var areaValue = AreaValue.Meter(10); var result = new AreaNumberResult(areaValue) as IResult; - Assert.Equal(areaValue, result.Result); + Assert.That(result.Result, Is.EqualTo(areaValue)); } - [Fact] + [Test] public void ToStringTest() { var areaValue = AreaValue.Meter(10); var result = new AreaNumberResult(areaValue); - Assert.Equal("10 m^2", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 m^2")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/BooleanResultTest.cs b/xFunc.Tests/Results/BooleanResultTest.cs index 914df9881..b1c9fe38f 100644 --- a/xFunc.Tests/Results/BooleanResultTest.cs +++ b/xFunc.Tests/Results/BooleanResultTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Results; public class BooleanResultTest { - [Fact] + [Test] public void ResultTest() { var result = new BooleanResult(true); @@ -13,7 +13,7 @@ public void ResultTest() Assert.True(result.Result); } - [Fact] + [Test] public void IResultTest() { var result = new BooleanResult(true) as IResult; @@ -21,11 +21,11 @@ public void IResultTest() Assert.True((bool) result.Result); } - [Fact] + [Test] public void ToStringTest() { var result = new BooleanResult(true); - Assert.Equal("True", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("True")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/ComplexNumberResultTest.cs b/xFunc.Tests/Results/ComplexNumberResultTest.cs index d43a68cec..4004c8d7b 100644 --- a/xFunc.Tests/Results/ComplexNumberResultTest.cs +++ b/xFunc.Tests/Results/ComplexNumberResultTest.cs @@ -7,83 +7,83 @@ namespace xFunc.Tests.Results; public class ComplexNumberResultTest { - [Fact] + [Test] public void ResultTest() { var result = new ComplexNumberResult(new Complex(2.1, 4.7)); - Assert.Equal(new Complex(2.1, 4.7), result.Result); + Assert.That(result.Result, Is.EqualTo(new Complex(2.1, 4.7))); } - [Fact] + [Test] public void IResultTest() { var result = new ComplexNumberResult(new Complex(2.1, 4.7)) as IResult; - Assert.Equal(new Complex(2.1, 4.7), result.Result); + Assert.That(result.Result, Is.EqualTo(new Complex(2.1, 4.7))); } - [Fact] + [Test] public void ZeroImToStringTest() { var token = new ComplexNumberResult(new Complex(5.3, 0)); - Assert.Equal("5.3", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("5.3")); } - [Fact] + [Test] public void PositiveImToStringTest() { var token = new ComplexNumberResult(new Complex(5.3, 2.12)); - Assert.Equal("5.3+2.12i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("5.3+2.12i")); } - [Fact] + [Test] public void NegativeImToStringTest() { var token = new ComplexNumberResult(new Complex(5.3, -2.12)); - Assert.Equal("5.3-2.12i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("5.3-2.12i")); } - [Fact] + [Test] public void ZeroReToStringTest() { var token = new ComplexNumberResult(new Complex(0, 1.3)); - Assert.Equal("1.3i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("1.3i")); } - [Fact] + [Test] public void PositiveReToStringTest() { var token = new ComplexNumberResult(new Complex(5.3, 2.12)); - Assert.Equal("5.3+2.12i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("5.3+2.12i")); } - [Fact] + [Test] public void NegativeReToStringTest() { var token = new ComplexNumberResult(new Complex(-5.3, -2.12)); - Assert.Equal("-5.3-2.12i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("-5.3-2.12i")); } - [Fact] + [Test] public void ImOneToStringTest() { var token = new ComplexNumberResult(new Complex(0, 1)); - Assert.Equal("i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("i")); } - [Fact] + [Test] public void ImNegOneToStringTest() { var token = new ComplexNumberResult(new Complex(0, -1)); - Assert.Equal("-i", token.ToString()); + Assert.That(token.ToString(), Is.EqualTo("-i")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/LambdaResultTest.cs b/xFunc.Tests/Results/LambdaResultTest.cs index f3bb12847..239718013 100644 --- a/xFunc.Tests/Results/LambdaResultTest.cs +++ b/xFunc.Tests/Results/LambdaResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class LambdaResultTest { - [Fact] + [Test] public void ResultTest() { var lambda = new Lambda(new[] { "x" }, Variable.X); var result = new LambdaResult(lambda); - Assert.Equal(lambda, result.Result); + Assert.That(result.Result, Is.EqualTo(lambda)); } - [Fact] + [Test] public void IResultTest() { var lambda = new Lambda(new[] { "x" }, Variable.X); var result = new LambdaResult(lambda) as IResult; - Assert.Equal(lambda, result.Result); + Assert.That(result.Result, Is.EqualTo(lambda)); } - [Fact] + [Test] public void ToStringTest() { var lambda = new Lambda(new[] { "x" }, Variable.X); var result = new LambdaResult(lambda); - Assert.Equal("(x) => x", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("(x) => x")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/LengthNumberResultTest.cs b/xFunc.Tests/Results/LengthNumberResultTest.cs index b42ee56cd..19a1469c2 100644 --- a/xFunc.Tests/Results/LengthNumberResultTest.cs +++ b/xFunc.Tests/Results/LengthNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class LengthNumberResultTest { - [Fact] + [Test] public void ResultTest() { var lengthValue = LengthValue.Meter(10); var result = new LengthNumberResult(lengthValue); - Assert.Equal(lengthValue, result.Result); + Assert.That(result.Result, Is.EqualTo(lengthValue)); } - [Fact] + [Test] public void IResultTest() { var lengthValue = LengthValue.Meter(10); var result = new LengthNumberResult(lengthValue) as IResult; - Assert.Equal(lengthValue, result.Result); + Assert.That(result.Result, Is.EqualTo(lengthValue)); } - [Fact] + [Test] public void ToStringTest() { var lengthValue = LengthValue.Meter(10); var result = new LengthNumberResult(lengthValue); - Assert.Equal("10 m", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 m")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/MassNumberResultTest.cs b/xFunc.Tests/Results/MassNumberResultTest.cs index 41e80653e..39523cfa2 100644 --- a/xFunc.Tests/Results/MassNumberResultTest.cs +++ b/xFunc.Tests/Results/MassNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class MassNumberResultTest { - [Fact] + [Test] public void ResultTest() { var power = MassValue.Gram(10); var result = new MassNumberResult(power); - Assert.Equal(power, result.Result); + Assert.That(result.Result, Is.EqualTo(power)); } - [Fact] + [Test] public void IResultTest() { var power = MassValue.Gram(10); var result = new MassNumberResult(power) as IResult; - Assert.Equal(power, result.Result); + Assert.That(result.Result, Is.EqualTo(power)); } - [Fact] + [Test] public void ToStringTest() { var power = MassValue.Gram(10); var result = new MassNumberResult(power); - Assert.Equal("10 g", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 g")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/MatrixValueResultTest.cs b/xFunc.Tests/Results/MatrixValueResultTest.cs index 4a01cc61a..081aaec76 100644 --- a/xFunc.Tests/Results/MatrixValueResultTest.cs +++ b/xFunc.Tests/Results/MatrixValueResultTest.cs @@ -5,7 +5,7 @@ namespace xFunc.Tests.Results; public class MatrixValueResultTest { - [Fact] + [Test] public void ResultTest() { var matrixValue = MatrixValue.Create(new NumberValue[][] @@ -15,10 +15,10 @@ public void ResultTest() }); var result = new MatrixValueResult(matrixValue); - Assert.Equal(matrixValue, result.Result); + Assert.That(result.Result, Is.EqualTo(matrixValue)); } - [Fact] + [Test] public void IResultTest() { var matrixValue = MatrixValue.Create(new NumberValue[][] @@ -28,10 +28,10 @@ public void IResultTest() }); var result = new MatrixValueResult(matrixValue) as IResult; - Assert.Equal(matrixValue, result.Result); + Assert.That(result.Result, Is.EqualTo(matrixValue)); } - [Fact] + [Test] public void ToStringTest() { var matrixValue = MatrixValue.Create(new NumberValue[][] @@ -41,6 +41,6 @@ public void ToStringTest() }); var result = new MatrixValueResult(matrixValue); - Assert.Equal("{{1, 2}, {2, 1}}", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("{{1, 2}, {2, 1}}")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/NumberResultTest.cs b/xFunc.Tests/Results/NumberResultTest.cs index db592b3e8..93cbf3b98 100644 --- a/xFunc.Tests/Results/NumberResultTest.cs +++ b/xFunc.Tests/Results/NumberResultTest.cs @@ -5,27 +5,27 @@ namespace xFunc.Tests.Results; public class NumberResultTest { - [Fact] + [Test] public void ResultTest() { var result = new NumberResult(10.2); - Assert.Equal(10.2, result.Result); + Assert.That(result.Result, Is.EqualTo(10.2)); } - [Fact] + [Test] public void IResultTest() { var result = new NumberResult(10.2) as IResult; - Assert.Equal(10.2, result.Result); + Assert.That(result.Result, Is.EqualTo(10.2)); } - [Fact] + [Test] public void ToStringTest() { var result = new NumberResult(10.2); - Assert.Equal("10.2", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10.2")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/PowerNumberResultTest.cs b/xFunc.Tests/Results/PowerNumberResultTest.cs index 9f62728a9..a78c0a524 100644 --- a/xFunc.Tests/Results/PowerNumberResultTest.cs +++ b/xFunc.Tests/Results/PowerNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class PowerNumberResultTest { - [Fact] + [Test] public void ResultTest() { var power = PowerValue.Watt(10); var result = new PowerNumberResult(power); - Assert.Equal(power, result.Result); + Assert.That(result.Result, Is.EqualTo(power)); } - [Fact] + [Test] public void IResultTest() { var power = PowerValue.Watt(10); var result = new PowerNumberResult(power) as IResult; - Assert.Equal(power, result.Result); + Assert.That(result.Result, Is.EqualTo(power)); } - [Fact] + [Test] public void ToStringTest() { var power = PowerValue.Watt(10); var result = new PowerNumberResult(power); - Assert.Equal("10 W", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 W")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/RationalValueResultTest.cs b/xFunc.Tests/Results/RationalValueResultTest.cs index 5d16d88da..1a7995c91 100644 --- a/xFunc.Tests/Results/RationalValueResultTest.cs +++ b/xFunc.Tests/Results/RationalValueResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class RationalValueResultTest { - [Fact] + [Test] public void ResultTest() { var angle = new RationalValue(1, 2); var result = new RationalValueResult(angle); - Assert.Equal(angle, result.Result); + Assert.That(result.Result, Is.EqualTo(angle)); } - [Fact] + [Test] public void IResultTest() { var angle = new RationalValue(1, 2); var result = new RationalValueResult(angle) as IResult; - Assert.Equal(angle, result.Result); + Assert.That(result.Result, Is.EqualTo(angle)); } - [Fact] + [Test] public void ToStringTest() { var angle = new RationalValue(1, 2); var result = new RationalValueResult(angle); - Assert.Equal("1 // 2", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("1 // 2")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/StringResultTest.cs b/xFunc.Tests/Results/StringResultTest.cs index f54f51ef3..d975d328a 100644 --- a/xFunc.Tests/Results/StringResultTest.cs +++ b/xFunc.Tests/Results/StringResultTest.cs @@ -5,33 +5,31 @@ namespace xFunc.Tests.Results; public class StringResultTest { - [Fact] + [Test] public void ResultTest() { var result = new StringResult("hello"); - Assert.Equal("hello", result.Result); + Assert.That(result.Result, Is.EqualTo("hello")); } - [Fact] + [Test] public void IResultTest() { var result = new StringResult("hello") as IResult; - Assert.Equal("hello", result.Result); + Assert.That(result.Result, Is.EqualTo("hello")); } - [Fact] + [Test] public void NullTest() - { - Assert.Throws(() => new StringResult(null)); - } + => Assert.Throws(() => new StringResult(null)); - [Fact] + [Test] public void ToStringTest() { var result = new StringResult("hello"); - Assert.Equal("hello", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("hello")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/TemperatureNumberResultTest.cs b/xFunc.Tests/Results/TemperatureNumberResultTest.cs index f34e330fe..13e0e7b70 100644 --- a/xFunc.Tests/Results/TemperatureNumberResultTest.cs +++ b/xFunc.Tests/Results/TemperatureNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class TemperatureNumberResultTest { - [Fact] + [Test] public void ResultTest() { var power = TemperatureValue.Celsius(10); var result = new TemperatureNumberResult(power); - Assert.Equal(power, result.Result); + Assert.That(result.Result, Is.EqualTo(power)); } - [Fact] + [Test] public void IResultTest() { var power = TemperatureValue.Celsius(10); var result = new TemperatureNumberResult(power) as IResult; - Assert.Equal(power, result.Result); + Assert.That(result.Result, Is.EqualTo(power)); } - [Fact] + [Test] public void ToStringTest() { var power = TemperatureValue.Celsius(10); var result = new TemperatureNumberResult(power); - Assert.Equal("10 °C", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 °C")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/TimeNumberResultTest.cs b/xFunc.Tests/Results/TimeNumberResultTest.cs index 3b60fe57d..41839f460 100644 --- a/xFunc.Tests/Results/TimeNumberResultTest.cs +++ b/xFunc.Tests/Results/TimeNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class TimeNumberResultTest { - [Fact] + [Test] public void ResultTest() { var lengthValue = TimeValue.Second(10); var result = new TimeNumberResult(lengthValue); - Assert.Equal(lengthValue, result.Result); + Assert.That(result.Result, Is.EqualTo(lengthValue)); } - [Fact] + [Test] public void IResultTest() { var lengthValue = TimeValue.Second(10); var result = new TimeNumberResult(lengthValue) as IResult; - Assert.Equal(lengthValue, result.Result); + Assert.That(result.Result, Is.EqualTo(lengthValue)); } - [Fact] + [Test] public void ToStringTest() { var lengthValue = TimeValue.Second(10); var result = new TimeNumberResult(lengthValue); - Assert.Equal("10 s", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 s")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/VectorValueResultTest.cs b/xFunc.Tests/Results/VectorValueResultTest.cs index 3c004b865..70eb98f09 100644 --- a/xFunc.Tests/Results/VectorValueResultTest.cs +++ b/xFunc.Tests/Results/VectorValueResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class VectorValueResultTest { - [Fact] + [Test] public void ResultTest() { var vectorValue = VectorValue.Create(NumberValue.One, NumberValue.Two); var result = new VectorValueResult(vectorValue); - Assert.Equal(vectorValue, result.Result); + Assert.That(result.Result, Is.EqualTo(vectorValue)); } - [Fact] + [Test] public void IResultTest() { var vectorValue = VectorValue.Create(NumberValue.One, NumberValue.Two); var result = new VectorValueResult(vectorValue) as IResult; - Assert.Equal(vectorValue, result.Result); + Assert.That(result.Result, Is.EqualTo(vectorValue)); } - [Fact] + [Test] public void ToStringTest() { var vectorValue = VectorValue.Create(NumberValue.One, NumberValue.Two); var result = new VectorValueResult(vectorValue); - Assert.Equal("{1, 2}", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("{1, 2}")); } } \ No newline at end of file diff --git a/xFunc.Tests/Results/VolumeNumberResultTest.cs b/xFunc.Tests/Results/VolumeNumberResultTest.cs index adb369a16..cbe9615db 100644 --- a/xFunc.Tests/Results/VolumeNumberResultTest.cs +++ b/xFunc.Tests/Results/VolumeNumberResultTest.cs @@ -5,30 +5,30 @@ namespace xFunc.Tests.Results; public class VolumeNumberResultTest { - [Fact] + [Test] public void ResultTest() { var volume = VolumeValue.Meter(10); var result = new VolumeNumberResult(volume); - Assert.Equal(volume, result.Result); + Assert.That(result.Result, Is.EqualTo(volume)); } - [Fact] + [Test] public void IResultTest() { var volume = VolumeValue.Meter(10); var result = new VolumeNumberResult(volume) as IResult; - Assert.Equal(volume, result.Result); + Assert.That(result.Result, Is.EqualTo(volume)); } - [Fact] + [Test] public void ToStringTest() { var volume = VolumeValue.Meter(10); var result = new VolumeNumberResult(volume); - Assert.Equal("10 m^3", result.ToString()); + Assert.That(result.ToString(), Is.EqualTo("10 m^3")); } } \ No newline at end of file diff --git a/xFunc.Tests/xFunc.Tests.csproj b/xFunc.Tests/xFunc.Tests.csproj index 294515ce6..adb0c3e53 100644 --- a/xFunc.Tests/xFunc.Tests.csproj +++ b/xFunc.Tests/xFunc.Tests.csproj @@ -44,7 +44,7 @@ - + @@ -55,10 +55,13 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - -