diff --git a/ExpressionEngine/ExpressionEngine.csproj b/ExpressionEngine/ExpressionEngine.csproj index 4a0344d..c623911 100644 --- a/ExpressionEngine/ExpressionEngine.csproj +++ b/ExpressionEngine/ExpressionEngine.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0;net48;net462 + net8.0;net9.0;net48;net462 Delegate.ExpressionEngine Delegate A/S,thygesteffensen @@ -26,19 +26,20 @@ - - + + - + - + + diff --git a/ExpressionEngine/Functions/Implementations/StringFunctions/FormatNumberFunction.cs b/ExpressionEngine/Functions/Implementations/StringFunctions/FormatNumberFunction.cs index 341ae7c..cf8d772 100644 --- a/ExpressionEngine/Functions/Implementations/StringFunctions/FormatNumberFunction.cs +++ b/ExpressionEngine/Functions/Implementations/StringFunctions/FormatNumberFunction.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Threading.Tasks; using ExpressionEngine.Functions.Base; using ExpressionEngine.Functions.CustomException; diff --git a/Test/Expression/GenericExpressionTest.cs b/Test/Expression/GenericExpressionTest.cs index 552d766..d46922c 100644 --- a/Test/Expression/GenericExpressionTest.cs +++ b/Test/Expression/GenericExpressionTest.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using ExpressionEngine; using ExpressionEngine.Functions.Base; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; namespace Test.Expression { @@ -18,7 +18,7 @@ public async Task TestFunction(IFunction func, string name, { var result = await func.ExecuteFunction(parameters); - Assert.AreEqual(expected, result); + ClassicAssert.AreEqual(expected, result); } } } \ No newline at end of file diff --git a/Test/Expression/StringFunctionTests.cs b/Test/Expression/StringFunctionTests.cs index 99046f1..cbba3b6 100644 --- a/Test/Expression/StringFunctionTests.cs +++ b/Test/Expression/StringFunctionTests.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using ExpressionEngine; using ExpressionEngine.Functions.Implementations.StringFunctions; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; +using NUnit.Framework.Legacy; namespace Test.Expression { @@ -188,15 +189,15 @@ public async Task GuidFunctionTest() var result1 = await func.ExecuteFunction(); - Assert.AreEqual(36, result1.GetValue().Length); + ClassicAssert.AreEqual(36, result1.GetValue().Length); var result2 = await func.ExecuteFunction(new ValueContainer("N")); - Assert.AreEqual(32, result2.GetValue().Length); + ClassicAssert.AreEqual(32, result2.GetValue().Length); var result3 = await func.ExecuteFunction(new ValueContainer("B")); - Assert.AreEqual(38, result3.GetValue().Length); + ClassicAssert.AreEqual(38, result3.GetValue().Length); } [Test] @@ -209,13 +210,13 @@ public async Task SplitFunctionTest() var array = result1.GetValue>(); - Assert.AreEqual(5, array.Count); + ClassicAssert.AreEqual(5, array.Count); - Assert.AreEqual("This is ", array[0].GetValue()); - Assert.AreEqual(" a ", array[1].GetValue()); - Assert.AreEqual(" ", array[2].GetValue()); - Assert.AreEqual("litted ", array[3].GetValue()); - Assert.AreEqual(" string", array[4].GetValue()); + ClassicAssert.AreEqual("This is ", array[0].GetValue()); + ClassicAssert.AreEqual(" a ", array[1].GetValue()); + ClassicAssert.AreEqual(" ", array[2].GetValue()); + ClassicAssert.AreEqual("litted ", array[3].GetValue()); + ClassicAssert.AreEqual(" string", array[4].GetValue()); } } } \ No newline at end of file diff --git a/Test/ExpressionGrammarTest.cs b/Test/ExpressionGrammarTest.cs index 1a86531..87d7fff 100644 --- a/Test/ExpressionGrammarTest.cs +++ b/Test/ExpressionGrammarTest.cs @@ -1,10 +1,11 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using ExpressionEngine; using ExpressionEngine.Functions.Base; using ExpressionEngine.Functions.CustomException; using Microsoft.Extensions.DependencyInjection; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; +using NUnit.Framework.Legacy; namespace Test { @@ -48,7 +49,7 @@ public async Task IndicesTest() var result = await _expressionGrammar.EvaluateToString(expressionString); - Assert.AreEqual("value", result); + ClassicAssert.AreEqual("value", result); } [Test] @@ -58,16 +59,16 @@ public async Task BooleanTest() await _expressionGrammar.EvaluateToValueContainer(expressionString); - Assert.NotNull(_dummyFunction.Parameters); - Assert.AreEqual(2, _dummyFunction.Parameters.Length); + ClassicAssert.NotNull(_dummyFunction.Parameters); + ClassicAssert.AreEqual(2, _dummyFunction.Parameters.Length); var param1 = _dummyFunction.Parameters[0]; var param2 = _dummyFunction.Parameters[1]; - Assert.NotNull(param1); - Assert.NotNull(param2); - Assert.AreEqual(ValueType.Boolean, param1.Type()); - Assert.AreEqual(ValueType.Boolean, param2.Type()); - Assert.AreEqual(true, param1.GetValue()); - Assert.AreEqual(false, param2.GetValue()); + ClassicAssert.NotNull(param1); + ClassicAssert.NotNull(param2); + ClassicAssert.AreEqual(ValueType.Boolean, param1.Type()); + ClassicAssert.AreEqual(ValueType.Boolean, param2.Type()); + ClassicAssert.AreEqual(true, param1.GetValue()); + ClassicAssert.AreEqual(false, param2.GetValue()); } [Test] @@ -79,8 +80,8 @@ public async Task NullConditional() var result = await _expressionGrammar.EvaluateToValueContainer(expressionString); - Assert.NotNull(result); - Assert.AreEqual(ValueType.Null, result.Type()); + ClassicAssert.NotNull(result); + ClassicAssert.AreEqual(ValueType.Null, result.Type()); } [Test] @@ -90,10 +91,10 @@ public async Task IndexOnNonObject() const string expressionString = "@dummyFunction()?.name1"; - var exception = Assert.ThrowsAsync(async () => + var exception = ClassicAssert.ThrowsAsync(async () => await _expressionGrammar.EvaluateToValueContainer(expressionString)); - Assert.AreEqual("Unable to process template language expressions in action 'Compose' inputs " + + ClassicAssert.AreEqual("Unable to process template language expressions in action 'Compose' inputs " + "at line 'x' and column 'y': 'The template language expression 'dummyFunction()?.name1' cannot be " + "evaluated because property 'name1' cannot be selected. Property selection is not supported on values " + "of type 'String'.", exception.Message); @@ -112,21 +113,21 @@ public async Task NegativeNumbers() if (functionOutput != null && functionOutput.Type() == ValueType.String) { - Assert.AreNotEqual(expressionString, functionOutput.GetValue()); + ClassicAssert.AreNotEqual(expressionString, functionOutput.GetValue()); } var functionParameters = _dummyFunction.Parameters; - Assert.AreEqual(4, functionParameters.Length); - Assert.AreEqual(ValueType.Integer, functionParameters[0].Type()); - Assert.AreEqual(ValueType.Float, functionParameters[1].Type()); - Assert.AreEqual(ValueType.Integer, functionParameters[2].Type()); - Assert.AreEqual(ValueType.Float, functionParameters[3].Type()); + ClassicAssert.AreEqual(4, functionParameters.Length); + ClassicAssert.AreEqual(ValueType.Integer, functionParameters[0].Type()); + ClassicAssert.AreEqual(ValueType.Float, functionParameters[1].Type()); + ClassicAssert.AreEqual(ValueType.Integer, functionParameters[2].Type()); + ClassicAssert.AreEqual(ValueType.Float, functionParameters[3].Type()); - Assert.AreEqual(expectedOutput1, functionParameters[0]); - Assert.AreEqual(expectedOutput2, functionParameters[1]); - Assert.AreEqual(expectedOutput3, functionParameters[2]); - Assert.AreEqual(expectedOutput4, functionParameters[3]); + ClassicAssert.AreEqual(expectedOutput1, functionParameters[0]); + ClassicAssert.AreEqual(expectedOutput2, functionParameters[1]); + ClassicAssert.AreEqual(expectedOutput3, functionParameters[2]); + ClassicAssert.AreEqual(expectedOutput4, functionParameters[3]); } } diff --git a/Test/FunctionDefinitionTests.cs b/Test/FunctionDefinitionTests.cs index 07b4989..09d9f03 100644 --- a/Test/FunctionDefinitionTests.cs +++ b/Test/FunctionDefinitionTests.cs @@ -1,9 +1,10 @@ -using System; +using System; using System.Threading.Tasks; using ExpressionEngine; using ExpressionEngine.Functions.CustomException; using Microsoft.Extensions.DependencyInjection; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; +using NUnit.Framework.Legacy; namespace Test { @@ -27,7 +28,7 @@ public async Task TestFunctionDef() var actualResult = await ee.Parse("@concat(addAndConcat(), '!')"); - Assert.AreEqual(expectedResult, actualResult); + ClassicAssert.AreEqual(expectedResult, actualResult); } [TestCase] @@ -35,13 +36,13 @@ public void TestFunctionException() { const string expectedMessage = "fromFunctionName cannot end in ()"; - var exception = Assert.Throws(() => + var exception = ClassicAssert.Throws(() => { _serviceCollection.AddFunctionDefinition("addAndConcat()", "concat('result of 1+1 is: ', add(1,1))"); }); - Assert.NotNull(exception); - Assert.AreEqual(expectedMessage,exception.Message); + ClassicAssert.NotNull(exception); + ClassicAssert.AreEqual(expectedMessage,exception.Message); } } } \ No newline at end of file diff --git a/Test/IndexTest.cs b/Test/IndexTest.cs index 54a20e0..305b8f8 100644 --- a/Test/IndexTest.cs +++ b/Test/IndexTest.cs @@ -3,7 +3,7 @@ using ExpressionEngine; using ExpressionEngine.Functions.Base; using Microsoft.Extensions.DependencyInjection; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; namespace Test { @@ -40,8 +40,8 @@ public async Task Test() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Boolean, output.Type()); - Assert.AreEqual(true, output.GetValue()); + ClassicAssert.AreEqual(ValueType.Boolean, output.Type()); + ClassicAssert.AreEqual(true, output.GetValue()); } [Test] @@ -52,8 +52,8 @@ public async Task Test1() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Boolean, output.Type()); - Assert.AreEqual(true, output.GetValue()); + ClassicAssert.AreEqual(ValueType.Boolean, output.Type()); + ClassicAssert.AreEqual(true, output.GetValue()); } [Test] @@ -64,8 +64,8 @@ public async Task Test2() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Boolean, output.Type()); - Assert.AreEqual(true, output.GetValue()); + ClassicAssert.AreEqual(ValueType.Boolean, output.Type()); + ClassicAssert.AreEqual(true, output.GetValue()); } [Test] @@ -76,8 +76,8 @@ public async Task Test3() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Boolean, output.Type()); - Assert.AreEqual(true, output.GetValue()); + ClassicAssert.AreEqual(ValueType.Boolean, output.Type()); + ClassicAssert.AreEqual(true, output.GetValue()); } [Test] @@ -88,8 +88,8 @@ public async Task Test4() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Boolean, output.Type()); - Assert.AreEqual(true, output.GetValue()); + ClassicAssert.AreEqual(ValueType.Boolean, output.Type()); + ClassicAssert.AreEqual(true, output.GetValue()); } @@ -101,8 +101,8 @@ public async Task Test5() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Object, output.Type()); - Assert.AreEqual("John Doe", output.AsDict()["name"].GetValue()); + ClassicAssert.AreEqual(ValueType.Object, output.Type()); + ClassicAssert.AreEqual("John Doe", output.AsDict()["name"].GetValue()); } [Test] @@ -113,8 +113,8 @@ public async Task Test6() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.String, output.Type()); - Assert.AreEqual("John Doe", output.GetValue()); + ClassicAssert.AreEqual(ValueType.String, output.Type()); + ClassicAssert.AreEqual("John Doe", output.GetValue()); } [Test] @@ -125,8 +125,8 @@ public async Task Test7() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.Object, output.Type()); - Assert.AreEqual("John Doe", output.AsDict()["name"].GetValue()); + ClassicAssert.AreEqual(ValueType.Object, output.Type()); + ClassicAssert.AreEqual("John Doe", output.AsDict()["name"].GetValue()); var t = new ValueContainer(); } @@ -140,8 +140,8 @@ public async Task Test8() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.String, output.Type()); - Assert.AreEqual("John Doe", output.GetValue()); + ClassicAssert.AreEqual(ValueType.String, output.Type()); + ClassicAssert.AreEqual("John Doe", output.GetValue()); } [Test] @@ -152,8 +152,8 @@ public async Task Test9() var output = await ee.ParseToValueContainer(str); - Assert.AreEqual(ValueType.String, output.Type()); - Assert.AreEqual("John Doe", output.GetValue()); + ClassicAssert.AreEqual(ValueType.String, output.Type()); + ClassicAssert.AreEqual("John Doe", output.GetValue()); } } } \ No newline at end of file diff --git a/Test/NullCoalescingTest.cs b/Test/NullCoalescingTest.cs index 33ec23e..bd4721d 100644 --- a/Test/NullCoalescingTest.cs +++ b/Test/NullCoalescingTest.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using ExpressionEngine; using Microsoft.Extensions.DependencyInjection; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; using ValueType = ExpressionEngine.ValueType; namespace Test @@ -39,7 +39,7 @@ public async Task TestTriggerOutputs(TestInput testInput) var result = await engine.ParseToValueContainer(testInput.Input); - Assert.AreEqual(testInput.ExpectedOutput, result); + ClassicAssert.AreEqual(testInput.ExpectedOutput, result); } private static object[] _triggerOutputTest = @@ -123,10 +123,10 @@ public void TestSimpleInputExpectFail(TestInput testInput) var variablesFunction = sp.GetRequiredService(); variablesFunction.DefaultValueContainer = testInput.ValueContainers.First(); - var exception = Assert.ThrowsAsync(Is.InstanceOf(testInput.ExceptionType), + var exception = ClassicAssert.ThrowsAsync(Is.InstanceOf(testInput.ExceptionType), async () => { await engine.Parse(testInput.Input); }); - Assert.AreEqual(testInput.ExpectedOutput.GetValue(), exception.Message); + ClassicAssert.AreEqual(testInput.ExpectedOutput.GetValue(), exception.Message); } private static TestInput[] _simpleCasesExceptions = @@ -168,7 +168,7 @@ public async Task TestInternalsFlowStorage(TestInput input) var result = await engine.ParseToValueContainer(input.Input); - Assert.AreEqual(input.ExpectedOutput, result); + ClassicAssert.AreEqual(input.ExpectedOutput, result); } @@ -234,7 +234,7 @@ public async Task TestInternalsFlowStorageValueContainer(TestInput input) var result = await engine.ParseToValueContainer(input.Input); - Assert.AreEqual(input.ExpectedOutputType, result.Type()); + ClassicAssert.AreEqual(input.ExpectedOutputType, result.Type()); } private static TestInput[] _testStorageValueContainer = diff --git a/Test/NullCoalescingTest2.cs b/Test/NullCoalescingTest2.cs index b6abe90..94f1e3e 100644 --- a/Test/NullCoalescingTest2.cs +++ b/Test/NullCoalescingTest2.cs @@ -3,7 +3,7 @@ using ExpressionEngine; using ExpressionEngine.Functions.Base; using Microsoft.Extensions.DependencyInjection; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; namespace Test { @@ -36,7 +36,7 @@ public async Task SimpleTest() var result = await _expressionGrammar.EvaluateToValueContainer(input); - Assert.AreEqual(new ValueContainer(), result); + ClassicAssert.AreEqual(new ValueContainer(), result); } } diff --git a/Test/ParserTest.cs b/Test/ParserTest.cs index 05e3f92..fc0c29d 100644 --- a/Test/ParserTest.cs +++ b/Test/ParserTest.cs @@ -4,7 +4,7 @@ using ExpressionEngine.Functions.Base; using ExpressionEngine.Functions.CustomException; using Microsoft.Extensions.DependencyInjection; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; using ValueType = ExpressionEngine.ValueType; @@ -48,10 +48,10 @@ public void TestSimpleInputExpectFail(TestInput testInput) var sp = BuildServiceProvider(); var engine = sp.GetRequiredService(); - var exception = Assert.ThrowsAsync(Is.InstanceOf(testInput.ExceptionType), + var exception = ClassicAssert.ThrowsAsync(Is.InstanceOf(testInput.ExceptionType), async () => { await engine.Parse(testInput.Input); }); - Assert.AreEqual(testInput.ExpectedOutput.GetValue(), exception.Message); + ClassicAssert.AreEqual(testInput.ExpectedOutput.GetValue(), exception.Message); } private static TestInput[] _simpleCasesExceptions = @@ -86,7 +86,7 @@ public async Task TestSimpleInput(TestInput testInput) var result = await engine.ParseToValueContainer(testInput.Input); - Assert.AreEqual(testInput.ExpectedOutput, result); + ClassicAssert.AreEqual(testInput.ExpectedOutput, result); } private static TestInput[] _simpleCases = @@ -128,7 +128,7 @@ public async Task TestAsync(TestInput testInput) var result = await engine.ParseToValueContainer(testInput.Input); - Assert.AreEqual(testInput.ExpectedOutput, result); + ClassicAssert.AreEqual(testInput.ExpectedOutput, result); } private static TestInput[] _async = diff --git a/Test/Test.csproj b/Test/Test.csproj index 43d50be..4f0c7c5 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -1,67 +1,23 @@ - netcoreapp3.1;net6.0;net7.0;net48;net462 + net8.0;net9.0;net48;net462 8 false - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Test/ValueContainer/TestGetObject.cs b/Test/ValueContainer/TestGetObject.cs index 34e5df1..b0a2c06 100644 --- a/Test/ValueContainer/TestGetObject.cs +++ b/Test/ValueContainer/TestGetObject.cs @@ -1,5 +1,5 @@ using ExpressionEngine; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; namespace Test { @@ -13,7 +13,7 @@ public void TestImplicitConversionThingy() var value = valueContainer.GetValue(); - Assert.AreEqual(typeof(string), value.GetType()); + ClassicAssert.AreEqual(typeof(string), value.GetType()); } } } \ No newline at end of file diff --git a/Test/ValueContainer/ValueContainerCompareTest.cs b/Test/ValueContainer/ValueContainerCompareTest.cs index 3382a3f..c794ad6 100644 --- a/Test/ValueContainer/ValueContainerCompareTest.cs +++ b/Test/ValueContainer/ValueContainerCompareTest.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using ExpressionEngine; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; namespace Test { @@ -10,21 +10,21 @@ public class ValueContainerCompareTest [Test] public void TestPositive() { - Assert.AreEqual(true, new ValueContainer().Equals(new ValueContainer())); - Assert.AreEqual(true, new ValueContainer(1).Equals(new ValueContainer(1))); - Assert.AreEqual(true, new ValueContainer("2").Equals(new ValueContainer("2"))); - Assert.AreEqual(true, new ValueContainer(true).Equals(new ValueContainer(true))); - Assert.AreEqual(true, new ValueContainer(2.1).Equals(new ValueContainer(2.1))); - Assert.AreEqual(true, new ValueContainer(2.1f).Equals(new ValueContainer(2.1f))); - Assert.AreEqual(true, + ClassicAssert.AreEqual(true, new ValueContainer().Equals(new ValueContainer())); + ClassicAssert.AreEqual(true, new ValueContainer(1).Equals(new ValueContainer(1))); + ClassicAssert.AreEqual(true, new ValueContainer("2").Equals(new ValueContainer("2"))); + ClassicAssert.AreEqual(true, new ValueContainer(true).Equals(new ValueContainer(true))); + ClassicAssert.AreEqual(true, new ValueContainer(2.1).Equals(new ValueContainer(2.1))); + ClassicAssert.AreEqual(true, new ValueContainer(2.1f).Equals(new ValueContainer(2.1f))); + ClassicAssert.AreEqual(true, new ValueContainer(new ValueContainer[] { }).Equals(new ValueContainer(new ValueContainer[] { }))); - Assert.AreEqual(true, + ClassicAssert.AreEqual(true, new ValueContainer(new[] {new ValueContainer("1"), new ValueContainer("2")}).Equals( new ValueContainer(new[] {new ValueContainer("1"), new ValueContainer("2")}))); - Assert.AreEqual(true, + ClassicAssert.AreEqual(true, new ValueContainer(new Dictionary()).Equals( new ValueContainer(new Dictionary()))); - Assert.AreEqual(true, + ClassicAssert.AreEqual(true, new ValueContainer(new Dictionary() {{"key1", new ValueContainer("value1")}, {"key2", new ValueContainer(true)}}).Equals( new ValueContainer(new Dictionary() @@ -34,16 +34,16 @@ public void TestPositive() [Test] public void TestNegative() { - Assert.AreEqual(false, new ValueContainer().Equals(new ValueContainer(""))); - Assert.AreEqual(false, new ValueContainer("321").Equals(new ValueContainer("123"))); - Assert.AreEqual(false, new ValueContainer(1).Equals(new ValueContainer(2))); - Assert.AreEqual(false, new ValueContainer(1.2).Equals(new ValueContainer(2.1))); - Assert.AreEqual(false, new ValueContainer(1.2f).Equals(new ValueContainer(2.1f))); - Assert.AreEqual(false, new ValueContainer(false).Equals(new ValueContainer(true))); - Assert.AreEqual(false, + ClassicAssert.AreEqual(false, new ValueContainer().Equals(new ValueContainer(""))); + ClassicAssert.AreEqual(false, new ValueContainer("321").Equals(new ValueContainer("123"))); + ClassicAssert.AreEqual(false, new ValueContainer(1).Equals(new ValueContainer(2))); + ClassicAssert.AreEqual(false, new ValueContainer(1.2).Equals(new ValueContainer(2.1))); + ClassicAssert.AreEqual(false, new ValueContainer(1.2f).Equals(new ValueContainer(2.1f))); + ClassicAssert.AreEqual(false, new ValueContainer(false).Equals(new ValueContainer(true))); + ClassicAssert.AreEqual(false, new ValueContainer(new[] {new ValueContainer("")}).Equals(new ValueContainer(new ValueContainer[] { }))); - Assert.AreEqual(false, + ClassicAssert.AreEqual(false, new ValueContainer(new Dictionary() {{"key1", new ValueContainer("true")}}) .Equals(new ValueContainer(new Dictionary() {{"key1", new ValueContainer(true)}}))); @@ -52,21 +52,21 @@ public void TestNegative() [Test] public void TestDifferentTypes() { - Assert.AreEqual(false, new ValueContainer().Equals(new ValueContainer(""))); - Assert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(2))); - Assert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(true))); - Assert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(new ValueContainer[] {}))); - Assert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(new Dictionary()))); - Assert.AreEqual(false, new ValueContainer(2).Equals(new ValueContainer(new ValueContainer[] {}))); + ClassicAssert.AreEqual(false, new ValueContainer().Equals(new ValueContainer(""))); + ClassicAssert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(2))); + ClassicAssert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(true))); + ClassicAssert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(new ValueContainer[] {}))); + ClassicAssert.AreEqual(false, new ValueContainer("").Equals(new ValueContainer(new Dictionary()))); + ClassicAssert.AreEqual(false, new ValueContainer(2).Equals(new ValueContainer(new ValueContainer[] {}))); - Assert.IsTrue(new ValueContainer(2).Equals(new ValueContainer(2f))); - Assert.IsTrue(new ValueContainer(2).Equals(new ValueContainer(2d))); - Assert.IsTrue(new ValueContainer(2).Equals(new ValueContainer(2))); - Assert.IsTrue(new ValueContainer(2f).Equals(new ValueContainer(2))); - Assert.IsTrue(new ValueContainer(2d).Equals(new ValueContainer(2))); - Assert.IsTrue(new ValueContainer(2d).Equals(new ValueContainer(2f))); - Assert.IsTrue(new ValueContainer(2f).Equals(new ValueContainer(2d))); - Assert.IsFalse(new ValueContainer(2d).Equals(new ValueContainer(3))); + ClassicAssert.IsTrue(new ValueContainer(2).Equals(new ValueContainer(2f))); + ClassicAssert.IsTrue(new ValueContainer(2).Equals(new ValueContainer(2d))); + ClassicAssert.IsTrue(new ValueContainer(2).Equals(new ValueContainer(2))); + ClassicAssert.IsTrue(new ValueContainer(2f).Equals(new ValueContainer(2))); + ClassicAssert.IsTrue(new ValueContainer(2d).Equals(new ValueContainer(2))); + ClassicAssert.IsTrue(new ValueContainer(2d).Equals(new ValueContainer(2f))); + ClassicAssert.IsTrue(new ValueContainer(2f).Equals(new ValueContainer(2d))); + ClassicAssert.IsFalse(new ValueContainer(2d).Equals(new ValueContainer(3))); } } } \ No newline at end of file diff --git a/Test/ValueContainer/ValueContainerContainsKeyTest.cs b/Test/ValueContainer/ValueContainerContainsKeyTest.cs index 6c345b4..efc6c27 100644 --- a/Test/ValueContainer/ValueContainerContainsKeyTest.cs +++ b/Test/ValueContainer/ValueContainerContainsKeyTest.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using ExpressionEngine; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; namespace Test { @@ -16,9 +16,9 @@ public void TestContainsKey() {"layer0/layer1/layer2", new ValueContainer("String value")} }); - Assert.IsTrue(vc.ContainsKey("layer0/layer1/layer2")); - Assert.IsTrue(vc.ContainsKey("layer0/layer1")); - Assert.IsFalse(vc.ContainsKey("layer1/layer2")); + ClassicAssert.IsTrue(vc.ContainsKey("layer0/layer1/layer2")); + ClassicAssert.IsTrue(vc.ContainsKey("layer0/layer1")); + ClassicAssert.IsFalse(vc.ContainsKey("layer1/layer2")); } } } \ No newline at end of file diff --git a/Test/ValueContainer/ValueContainerJTokenConstructorTest.cs b/Test/ValueContainer/ValueContainerJTokenConstructorTest.cs index f1ef672..b5f1031 100644 --- a/Test/ValueContainer/ValueContainerJTokenConstructorTest.cs +++ b/Test/ValueContainer/ValueContainerJTokenConstructorTest.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using ExpressionEngine; using Newtonsoft.Json.Linq; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; using ValueType = ExpressionEngine.ValueType; namespace Test @@ -17,8 +17,8 @@ public async Task ConstructorTest(JToken jToken, ValueType expectedValueType, { var valueContainer = await ValueContainerExtension.CreateValueContainerFromJToken(jToken); - Assert.AreEqual(expectedValueType, valueContainer.Type()); - Assert.AreEqual(expectedValue, valueContainer); + ClassicAssert.AreEqual(expectedValueType, valueContainer.Type()); + ClassicAssert.AreEqual(expectedValue, valueContainer); } private static object[] _valueContainerConstructorInput = diff --git a/Test/ValueContainer/ValueContainerTest.cs b/Test/ValueContainer/ValueContainerTest.cs index 0b3f1a7..823712c 100644 --- a/Test/ValueContainer/ValueContainerTest.cs +++ b/Test/ValueContainer/ValueContainerTest.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using ExpressionEngine; using Newtonsoft.Json.Linq; -using NUnit.Framework; +using NUnit.Framework;using NUnit.Framework.Legacy; using ValueType = ExpressionEngine.ValueType; namespace Test @@ -30,22 +30,22 @@ public void TestNormalizeValueContainer() var inner = valueContainer; - Assert.AreEqual(1, inner.GetValue>().Keys.Count); + ClassicAssert.AreEqual(1, inner.GetValue>().Keys.Count); var body = inner["body"].GetValue>(); - Assert.AreEqual(3, body.Keys.Count); + ClassicAssert.AreEqual(3, body.Keys.Count); - Assert.AreEqual("guid", body["contactid"].GetValue()); - Assert.AreEqual("John Doe", body["fullname"].GetValue()); + ClassicAssert.AreEqual("guid", body["contactid"].GetValue()); + ClassicAssert.AreEqual("John Doe", body["fullname"].GetValue()); var children = body["child"]; - Assert.AreEqual(3, children.GetValue>().Keys.Count); + ClassicAssert.AreEqual(3, children.GetValue>().Keys.Count); - Assert.AreEqual("Child 1", children["one"].GetValue()); - Assert.AreEqual("Child 2", children["two"].GetValue()); - Assert.AreEqual("Child 3", children["three"].GetValue()); + ClassicAssert.AreEqual("Child 1", children["one"].GetValue()); + ClassicAssert.AreEqual("Child 2", children["two"].GetValue()); + ClassicAssert.AreEqual("Child 3", children["three"].GetValue()); } [Test] @@ -65,12 +65,12 @@ public void TestArrayIndexer() new ValueContainer("Item 9") }); - Assert.AreEqual("Item 5", valueContainer[5].GetValue()); + ClassicAssert.AreEqual("Item 5", valueContainer[5].GetValue()); var newValue8 = "New item 8"; valueContainer[8] = new ValueContainer(newValue8); - Assert.AreEqual(newValue8, valueContainer[8].GetValue()); + ClassicAssert.AreEqual(newValue8, valueContainer[8].GetValue()); } [Test] @@ -78,17 +78,17 @@ public void TestArrayIndexerFailure() { var valueContainer = new ValueContainer(150f); - var exception1 = Assert.Throws(() => + var exception1 = ClassicAssert.Throws(() => { var temp = valueContainer[0]; }); - Assert.AreEqual(exception1.Message, "Index operations can only be performed on arrays."); + ClassicAssert.AreEqual(exception1.Message, "Index operations can only be performed on arrays."); - var exception2 = Assert.Throws(() => + var exception2 = ClassicAssert.Throws(() => { valueContainer[0] = new ValueContainer(100f); }); - Assert.AreEqual(exception2.Message, "Index operations can only be performed on arrays."); + ClassicAssert.AreEqual(exception2.Message, "Index operations can only be performed on arrays."); } [Test] @@ -104,14 +104,14 @@ public void TestObjectIndexer() } }); - Assert.AreEqual(ValueType.Object, valueContainer["body"].Type()); + ClassicAssert.AreEqual(ValueType.Object, valueContainer["body"].Type()); - Assert.AreEqual("James P. \"Sulley\" Sullivan", valueContainer["body"]["name"].GetValue()); + ClassicAssert.AreEqual("James P. \"Sulley\" Sullivan", valueContainer["body"]["name"].GetValue()); var guidStr = Guid.NewGuid().ToString(); valueContainer["body"]["id"] = new ValueContainer(guidStr); - Assert.AreEqual(guidStr, valueContainer["body"]["id"].GetValue()); + ClassicAssert.AreEqual(guidStr, valueContainer["body"]["id"].GetValue()); } [Test] @@ -119,19 +119,19 @@ public void TestObjectIndexerFailure() { var valueContainer = new ValueContainer(); - var exception1 = Assert.Throws(() => + var exception1 = ClassicAssert.Throws(() => { var temp = valueContainer["name"]; }); - Assert.AreEqual("Index operations can only be performed on objects.", exception1.Message); + ClassicAssert.AreEqual("Index operations can only be performed on objects.", exception1.Message); - var exception2 = Assert.Throws(() => + var exception2 = ClassicAssert.Throws(() => { valueContainer["name"] = new ValueContainer("Mendel Stromm"); }); - Assert.AreEqual("Index operations can only be performed on objects.", exception2.Message); + ClassicAssert.AreEqual("Index operations can only be performed on objects.", exception2.Message); } [Test] @@ -141,7 +141,7 @@ public void TestObjectIndexerKeyPath() valueContainer["body/name"] = new ValueContainer("John Doe"); - Assert.AreEqual("John Doe", valueContainer["body/name"].GetValue()); + ClassicAssert.AreEqual("John Doe", valueContainer["body/name"].GetValue()); } [Test] @@ -152,9 +152,9 @@ public async Task TestJValueToValueContainer() var valueContainer = await ValueContainerExtension.CreateValueContainerFromJToken(jValue); - Assert.IsNotNull(valueContainer); - Assert.AreEqual(ValueType.String, valueContainer.Type()); - Assert.AreEqual(expectedValue, valueContainer.GetValue()); + ClassicAssert.IsNotNull(valueContainer); + ClassicAssert.AreEqual(ValueType.String, valueContainer.Type()); + ClassicAssert.AreEqual(expectedValue, valueContainer.GetValue()); } public T GetValue(ValueContainer valueContainer) @@ -169,10 +169,10 @@ public async Task TestJsonToValueContainerSimple() var valueContainer = await ValueContainerExtension.CreateValueContainerFromJToken(json); - Assert.IsTrue(valueContainer.GetValue>().ContainsKey("Terminate")); - Assert.AreEqual(1,valueContainer.GetValue>().Count); + ClassicAssert.IsTrue(valueContainer.GetValue>().ContainsKey("Terminate")); + ClassicAssert.AreEqual(1,valueContainer.GetValue>().Count); - Assert.AreEqual(2, valueContainer["Terminate"].GetValue>().Count); + ClassicAssert.AreEqual(2, valueContainer["Terminate"].GetValue>().Count); } [Test] @@ -186,23 +186,23 @@ public async Task TestJsonToValueContainerTypicalInputSection() var valueContainer = await ValueContainerExtension.CreateValueContainerFromJToken(json); - Assert.IsTrue(valueContainer.GetValue>().ContainsKey("inputs")); - Assert.AreEqual(1,valueContainer.GetValue>().Count); + ClassicAssert.IsTrue(valueContainer.GetValue>().ContainsKey("inputs")); + ClassicAssert.AreEqual(1,valueContainer.GetValue>().Count); var inputs = valueContainer["inputs"]; var inputsDict= valueContainer["inputs"].GetValue>(); - Assert.IsTrue(inputsDict.ContainsKey("host")); - Assert.IsTrue(inputsDict.ContainsKey("parameters")); - Assert.IsTrue(inputsDict.ContainsKey("authentication")); + ClassicAssert.IsTrue(inputsDict.ContainsKey("host")); + ClassicAssert.IsTrue(inputsDict.ContainsKey("parameters")); + ClassicAssert.IsTrue(inputsDict.ContainsKey("authentication")); - Assert.AreEqual(3,inputs.GetValue>().Count); + ClassicAssert.AreEqual(3,inputs.GetValue>().Count); var host = inputs["host"]; - Assert.AreEqual(3,host.GetValue>().Count); + ClassicAssert.AreEqual(3,host.GetValue>().Count); var parameters = inputs["parameters"]; - Assert.AreEqual(2,parameters.GetValue>().Count); + ClassicAssert.AreEqual(2,parameters.GetValue>().Count); } } } \ No newline at end of file