diff --git a/build/Build.cs b/build/Build.cs index 4d7097c..a607613 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -41,10 +41,10 @@ class Build : NukeBuild AbsolutePath DeployPath => (AbsolutePath)"C:" / "Projects" / "NuGet Store"; [Parameter("Version to be injected in the Build")] - public string Version { get; set; } = $"1.2.5"; + public string Version { get; set; } = $"1.3.1"; [Parameter("The Buildnumber provided by the CI")] - public int BuildNo = 10; + public int BuildNo = 1; [Parameter("Is RC Version")] public bool IsRc = false; @@ -53,9 +53,9 @@ class Build : NukeBuild .Before(Restore) .Executes(() => { - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - EnsureCleanDirectory(ArtifactsDirectory); + SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(f => f.DeleteDirectory()); + TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(f => f.DeleteDirectory()); + ArtifactsDirectory.CreateOrCleanDirectory(); }); Target Restore => _ => _ diff --git a/build/_build.csproj b/build/_build.csproj index 84f431d..dc2204e 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Tests/YamlMap.Tests/ArrayParserTests.cs b/src/Tests/YamlMap.Tests/ArrayParserTests.cs index dd5a15e..d3173ac 100644 --- a/src/Tests/YamlMap.Tests/ArrayParserTests.cs +++ b/src/Tests/YamlMap.Tests/ArrayParserTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests { @@ -20,10 +21,10 @@ public void Parser_BracketArray() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Ids"][0]).Value); - Assert.AreEqual("2", ((ValueToken)result["Ids"][1]).Value); - Assert.AreEqual("3", ((ValueToken)result["Ids"][2]).Value); - Assert.AreEqual("4", ((ValueToken)result["Ids"][3]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Ids"][0]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Ids"][1]).Value); + ClassicAssert.AreEqual("3", ((ValueToken)result["Ids"][2]).Value); + ClassicAssert.AreEqual("4", ((ValueToken)result["Ids"][3]).Value); } [Test] @@ -39,10 +40,10 @@ public void Parser_BracketArray_Multiline() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Ids"][0]).Value); - Assert.AreEqual("2", ((ValueToken)result["Ids"][1]).Value); - Assert.AreEqual("3", ((ValueToken)result["Ids"][2]).Value); - Assert.AreEqual("4", ((ValueToken)result["Ids"][3]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Ids"][0]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Ids"][1]).Value); + ClassicAssert.AreEqual("3", ((ValueToken)result["Ids"][2]).Value); + ClassicAssert.AreEqual("4", ((ValueToken)result["Ids"][3]).Value); } } } diff --git a/src/Tests/YamlMap.Tests/Integration.cs b/src/Tests/YamlMap.Tests/Integration.cs index 1d4d38e..74db172 100644 --- a/src/Tests/YamlMap.Tests/Integration.cs +++ b/src/Tests/YamlMap.Tests/Integration.cs @@ -19,7 +19,7 @@ public void LoadDataFromFile() var reader = new YamlFileReader(); var users = reader.Read>(path); - Assert.IsTrue(users.Count == 3); + Assert.That(users.Count == 3); } diff --git a/src/Tests/YamlMap.Tests/ParserTests.cs b/src/Tests/YamlMap.Tests/ParserTests.cs index 273aa96..a6c322e 100644 --- a/src/Tests/YamlMap.Tests/ParserTests.cs +++ b/src/Tests/YamlMap.Tests/ParserTests.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests { @@ -35,16 +36,16 @@ public void WickeFlame_Yaml_Parser() var result = parser.Parse(); - Assert.AreEqual("second", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); - Assert.AreEqual("third", ((ValueToken)result["Root"][0]["L1"]["L2"]["Name"]).Value); - Assert.AreEqual("first", ((ValueToken)result["Root"][0]["Name"]).Value); - Assert.AreEqual("one", ((ValueToken)result["Alternating"]).Value); - Assert.AreEqual("Succeeded", ((ValueToken)result["Test"]["Outcome"]).Value); - Assert.AreEqual("Succeeded message", ((ValueToken)result["Test"]["Message"]).Value); - Assert.AreEqual("one", ((ValueToken)result["List"][0]).Value); - Assert.AreEqual("two", ((ValueToken)result["List"][1]).Value); - Assert.AreEqual("three", ((ValueToken)result["List"][2]).Value); - Assert.AreEqual("three", ((ValueToken)result["List"][3]).Value); + ClassicAssert.AreEqual("second", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); + ClassicAssert.AreEqual("third", ((ValueToken)result["Root"][0]["L1"]["L2"]["Name"]).Value); + ClassicAssert.AreEqual("first", ((ValueToken)result["Root"][0]["Name"]).Value); + ClassicAssert.AreEqual("one", ((ValueToken)result["Alternating"]).Value); + ClassicAssert.AreEqual("Succeeded", ((ValueToken)result["Test"]["Outcome"]).Value); + ClassicAssert.AreEqual("Succeeded message", ((ValueToken)result["Test"]["Message"]).Value); + ClassicAssert.AreEqual("one", ((ValueToken)result["List"][0]).Value); + ClassicAssert.AreEqual("two", ((ValueToken)result["List"][1]).Value); + ClassicAssert.AreEqual("three", ((ValueToken)result["List"][2]).Value); + ClassicAssert.AreEqual("three", ((ValueToken)result["List"][3]).Value); } [Test] @@ -59,7 +60,7 @@ public void WickeFlame_Yaml_Parser_Simple() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Id"]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Id"]).Value); } [Test] @@ -75,7 +76,7 @@ public void WickeFlame_Yaml_Parser_Nesting() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Child"]["Id"]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Child"]["Id"]).Value); } [Test] @@ -93,8 +94,8 @@ public void WickeFlame_Yaml_Parser_ExtendedNesting() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Child"]["Id"]).Value); - Assert.AreEqual("2", ((ValueToken)result["Child"]["SubChild"]["Id"]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Child"]["Id"]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Child"]["SubChild"]["Id"]).Value); } [Test] @@ -115,9 +116,9 @@ public void WickeFlame_Yaml_Parser_MultipleExtendedNesting() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Child"]["Id"]).Value); - Assert.AreEqual("test", ((ValueToken)result["Child"]["Name"]).Value); - Assert.AreEqual("2", ((ValueToken)result["Child2"]["Id"]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Child"]["Id"]).Value); + ClassicAssert.AreEqual("test", ((ValueToken)result["Child"]["Name"]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Child2"]["Id"]).Value); } [Test] @@ -135,8 +136,8 @@ public void WickeFlame_Yaml_Parser_IntIndexer() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result[0][0]).Value); - Assert.AreEqual("2", ((ValueToken)result[0][1][0]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result[0][0]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result[0][1][0]).Value); } [Test] @@ -153,8 +154,8 @@ public void WickeFlame_Yaml_Parser_SimpleList() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Children"][0]).Value); - Assert.AreEqual("2", ((ValueToken)result["Children"][1]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Children"][0]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Children"][1]).Value); } [Test] @@ -173,10 +174,10 @@ public void WickeFlame_Yaml_Parser_ObjectList() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Children"][0]["Id"]).Value); - Assert.AreEqual("One", ((ValueToken)result["Children"][0]["Name"]).Value); - Assert.AreEqual("2", ((ValueToken)result["Children"][1]["Id"]).Value); - Assert.AreEqual("Two", ((ValueToken)result["Children"][1]["Name"]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Children"][0]["Id"]).Value); + ClassicAssert.AreEqual("One", ((ValueToken)result["Children"][0]["Name"]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Children"][1]["Id"]).Value); + ClassicAssert.AreEqual("Two", ((ValueToken)result["Children"][1]["Name"]).Value); } [Test] @@ -193,8 +194,8 @@ public void WickeFlame_Yaml_Parser_PropertyList() var result = parser.Parse(); - Assert.AreEqual("1", ((ValueToken)result["Children"][0]["one"]).Value); - Assert.AreEqual("2", ((ValueToken)result["Children"][1]["two"]).Value); + ClassicAssert.AreEqual("1", ((ValueToken)result["Children"][0]["one"]).Value); + ClassicAssert.AreEqual("2", ((ValueToken)result["Children"][1]["two"]).Value); } [Test] @@ -212,7 +213,7 @@ public void WickeFlame_Yaml_Parser_SubObjectList() var result = parser.Parse(); - Assert.AreEqual("first", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); + ClassicAssert.AreEqual("first", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); } [Test] @@ -231,8 +232,8 @@ public void WickeFlame_Yaml_Parser_ExtendedObjectList() var result = parser.Parse(); - Assert.AreEqual("second", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); - Assert.AreEqual("third", ((ValueToken)result["Root"][0]["L1"]["L2"]["Name"]).Value); + ClassicAssert.AreEqual("second", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); + ClassicAssert.AreEqual("third", ((ValueToken)result["Root"][0]["L1"]["L2"]["Name"]).Value); } [Test] @@ -252,9 +253,9 @@ public void WickeFlame_Yaml_Parser_ExtendedObjectTree() var result = parser.Parse(); - Assert.AreEqual("second", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); - Assert.AreEqual("third", ((ValueToken)result["Root"][0]["L1"]["L2"]["Name"]).Value); - Assert.AreEqual("first", ((ValueToken)result["Root"][0]["Name"]).Value); + ClassicAssert.AreEqual("second", ((ValueToken)result["Root"][0]["L1"]["Name"]).Value); + ClassicAssert.AreEqual("third", ((ValueToken)result["Root"][0]["L1"]["L2"]["Name"]).Value); + ClassicAssert.AreEqual("first", ((ValueToken)result["Root"][0]["Name"]).Value); } [Test] @@ -272,8 +273,8 @@ public void WickeFlame_Yaml_Parser_CommentLine() var result = parser.Parse(); - Assert.AreEqual("one", ((ValueToken)result[0]).Value); - Assert.AreEqual("two", ((ValueToken)result[1]).Value); + ClassicAssert.AreEqual("one", ((ValueToken)result[0]).Value); + ClassicAssert.AreEqual("two", ((ValueToken)result[1]).Value); } [Test] @@ -289,8 +290,8 @@ public void WickeFlame_Yaml_Parser_CommentInLineLine() var result = parser.Parse(); - Assert.AreEqual("one", ((ValueToken)result[0]).Value); - Assert.AreEqual("true", ((ValueToken)result[1]).Value); + ClassicAssert.AreEqual("one", ((ValueToken)result[0]).Value); + ClassicAssert.AreEqual("true", ((ValueToken)result[1]).Value); } [Test] @@ -307,7 +308,7 @@ public void WickeFlame_Yaml_Parser_InvalidProperty() var result = parser.Parse(); Assert.That(result.Count == 1); - Assert.AreEqual("true", ((ValueToken)result[0]).Value); + ClassicAssert.AreEqual("true", ((ValueToken)result[0]).Value); } [Test] @@ -325,7 +326,7 @@ public void YamlMap_Parser_EmptyItem() var result = parser.Parse(); Assert.That(result.Count == 2); - Assert.AreEqual("true", ((ValueToken)result[1]).Value); + ClassicAssert.AreEqual("true", ((ValueToken)result[1]).Value); } [Test] @@ -343,7 +344,7 @@ public void YamlMap_Parser_Comment() var result = parser.Parse(); Assert.That(result.Count == 2); - Assert.AreEqual("true", ((ValueToken)result[1]).Value); + ClassicAssert.AreEqual("true", ((ValueToken)result[1]).Value); } } } diff --git a/src/Tests/YamlMap.Tests/Reader/ParseQuotatedStringTests.cs b/src/Tests/YamlMap.Tests/Reader/ParseQuotatedStringTests.cs index c93361e..7aa2388 100644 --- a/src/Tests/YamlMap.Tests/Reader/ParseQuotatedStringTests.cs +++ b/src/Tests/YamlMap.Tests/Reader/ParseQuotatedStringTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests.Reader { @@ -19,7 +20,7 @@ public void ParseQuotatedString_DoubleQuotations() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("[value] test", parsed.Value); + ClassicAssert.AreEqual("[value] test", parsed.Value); } [Test] @@ -33,7 +34,7 @@ public void ParseQuotatedString_SingleQuotations() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("[value] test", parsed.Value); + ClassicAssert.AreEqual("[value] test", parsed.Value); } [Test] @@ -47,7 +48,7 @@ public void ParseQuotatedString_DoubleQuotations_InnerSingle() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("[value] 'test", parsed.Value); + ClassicAssert.AreEqual("[value] 'test", parsed.Value); } [Test] @@ -61,7 +62,7 @@ public void ParseQuotatedString_SingleQuotations_InnerDouble() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("[value] \"test", parsed.Value); + ClassicAssert.AreEqual("[value] \"test", parsed.Value); } [Test] @@ -124,7 +125,7 @@ public void ParseQuotatedString_DoubleQuotations_Special() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("c: is a drive", parsed.Value); + ClassicAssert.AreEqual("c: is a drive", parsed.Value); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/Reader/ParseQuotatedTypeStringTests.cs b/src/Tests/YamlMap.Tests/Reader/ParseQuotatedTypeStringTests.cs index c90d906..5e33521 100644 --- a/src/Tests/YamlMap.Tests/Reader/ParseQuotatedTypeStringTests.cs +++ b/src/Tests/YamlMap.Tests/Reader/ParseQuotatedTypeStringTests.cs @@ -19,7 +19,7 @@ public void ParseQuotatedTypeString_DoubleQuotations() var reader = new YamlReader(); var parsed = reader.Read(typeof(PrimitiveValues), lines) as PrimitiveValues; - Assert.AreEqual("[value] test", parsed.Value); + Assert.That("[value] test", Is.EqualTo(parsed.Value)); } [Test] @@ -33,7 +33,7 @@ public void ParseQuotatedTypeString_SingleQuotations() var reader = new YamlReader(); var parsed = reader.Read(typeof(PrimitiveValues), lines) as PrimitiveValues; - Assert.AreEqual("[value] test", parsed.Value); + Assert.That("[value] test", Is.EqualTo(parsed.Value)); } [Test] @@ -47,7 +47,7 @@ public void ParseQuotatedTypeString_DoubleQuotations_InnerSingle() var reader = new YamlReader(); var parsed = reader.Read(typeof(PrimitiveValues), lines) as PrimitiveValues; - Assert.AreEqual("[value] 'test", parsed.Value); + Assert.That("[value] 'test", Is.EqualTo(parsed.Value)); } [Test] @@ -61,7 +61,7 @@ public void ParseQuotatedTypeString_SingleQuotations_InnerDouble() var reader = new YamlReader(); var parsed = reader.Read(typeof(PrimitiveValues), lines) as PrimitiveValues; - Assert.AreEqual("[value] \"test", parsed.Value); + Assert.That("[value] \"test", Is.EqualTo(parsed.Value)); } [Test] @@ -124,7 +124,7 @@ public void ParseQuotatedTypeString_DoubleQuotations_Special() var reader = new YamlReader(); var parsed = reader.Read(typeof(PrimitiveValues), lines) as PrimitiveValues; - Assert.AreEqual("c: is a drive", parsed.Value); + Assert.That("c: is a drive", Is.EqualTo(parsed.Value)); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/Reader/YamlReaderDictionaryTypeTests.cs b/src/Tests/YamlMap.Tests/Reader/YamlReaderDictionaryTypeTests.cs index 400baf8..0b85fc8 100644 --- a/src/Tests/YamlMap.Tests/Reader/YamlReaderDictionaryTypeTests.cs +++ b/src/Tests/YamlMap.Tests/Reader/YamlReaderDictionaryTypeTests.cs @@ -85,6 +85,29 @@ public void YamlReaderDictionaryType_Dictionary_Objects() Assert.That(data.ObjectDictionary["two"].Name == "test two"); } + [Test] + public void YamlReaderDictionaryType_Dictionary_Objects_Direct() + { + var lines = new[] + { + "one:", + " Id: 1", + " Name: test one", + "two:", + " Id: 2", + " Name: test two" + }; + + var reader = new YamlReader(); + var data = reader.Read>(lines); + + Assert.That(data.Count() == 2); + Assert.That(data["one"].Id == 1); + Assert.That(data["one"].Name == "test one"); + Assert.That(data["two"].Id == 2); + Assert.That(data["two"].Name == "test two"); + } + public class StringNode { public Dictionary Dictionary { get; set; } diff --git a/src/Tests/YamlMap.Tests/Serialization/DeserializerTests.cs b/src/Tests/YamlMap.Tests/Serialization/DeserializerTests.cs index 62ea8ad..eed31d0 100644 --- a/src/Tests/YamlMap.Tests/Serialization/DeserializerTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/DeserializerTests.cs @@ -46,14 +46,14 @@ public void Serializer_Deserialize_ByType() public void Deserialize_Type() { var item = Serializer.Deserialize("Type: YamlMap.Tests.Serialization.DeserializerType, YamlMap.Tests"); - Assert.AreEqual(typeof(DeserializerType), item.Type); + Assert.That(typeof(DeserializerType), Is.EqualTo(item.Type)); } [Test] public void Deserialize_GenericType() { var item = Serializer.Deserialize("Type: \"YamlMap.Tests.Serialization.GenericType`1[[YamlMap.Tests.Serialization.DeserializerType, YamlMap.Tests]], YamlMap.Tests\""); - Assert.AreEqual(typeof(GenericType), item.Type); + Assert.That(typeof(GenericType), Is.EqualTo(item.Type)); } diff --git a/src/Tests/YamlMap.Tests/Serialization/Mappers/ArrayMapperTests.cs b/src/Tests/YamlMap.Tests/Serialization/Mappers/ArrayMapperTests.cs index 075fee5..a17f825 100644 --- a/src/Tests/YamlMap.Tests/Serialization/Mappers/ArrayMapperTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/Mappers/ArrayMapperTests.cs @@ -16,8 +16,8 @@ public void YamlMap_Serialization_ArrayMapper_Simple() var mapper = new ArrayMapper(); var ok = mapper.Map(token, list); - Assert.IsTrue(ok); - Assert.AreEqual("Value", list[0]); + Assert.That(ok); + Assert.That("Value", Is.EqualTo(list[0])); } [Test] @@ -32,8 +32,8 @@ public void YamlMap_Serialization_ArrayMapper() var mapper = new ArrayMapper(); var ok = mapper.Map(token, item); - Assert.IsTrue(ok); - Assert.AreEqual("Value", item[0].Key); + Assert.That(ok); + Assert.That("Value", Is.EqualTo(item[0].Key)); } [Test] diff --git a/src/Tests/YamlMap.Tests/Serialization/Mappers/DefaultMapperTests.cs b/src/Tests/YamlMap.Tests/Serialization/Mappers/DefaultMapperTests.cs index e55ed2c..3b10f2b 100644 --- a/src/Tests/YamlMap.Tests/Serialization/Mappers/DefaultMapperTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/Mappers/DefaultMapperTests.cs @@ -13,7 +13,7 @@ public T Map(IToken token) { var item = new MapperValue(); var mapper = new DefaultMapper(typeof(MapperValue)); - Assert.IsTrue(mapper.Map(token, item)); + Assert.That(mapper.Map(token, item)); return item.Value; } @@ -21,68 +21,68 @@ public T Map(IToken token) [Test] public void DefaultMapper_String() { - Assert.AreEqual(Map(new ValueToken("Value", "String", 0)), "String"); + Assert.That(Map(new ValueToken("Value", "String", 0)), Is.EqualTo("String")); } [Test] public void DefaultMapper_Bool() { - Assert.AreEqual(Map(new ValueToken("Value", "0", 0)), false); - Assert.AreEqual(Map(new ValueToken("Value", "1", 0)), true); - Assert.AreEqual(Map(new ValueToken("Value", "false", 0)), false); - Assert.AreEqual(Map(new ValueToken("Value", "true", 0)), true); + Assert.That(Map(new ValueToken("Value", "0", 0)), Is.EqualTo(false)); + Assert.That(Map(new ValueToken("Value", "1", 0)), Is.EqualTo(true)); + Assert.That(Map(new ValueToken("Value", "false", 0)), Is.EqualTo(false)); + Assert.That(Map(new ValueToken("Value", "true", 0)), Is.EqualTo(true)); } [Test] public void DefaultMapper_Long() { - Assert.AreEqual(Map(new ValueToken("Value", "123456789", 0)), 123456789); + Assert.That(Map(new ValueToken("Value", "123456789", 0)), Is.EqualTo(123456789)); } [Test] public void DefaultMapper_Int() { - Assert.AreEqual(Map(new ValueToken("Value", "2", 0)), 2); + Assert.That(Map(new ValueToken("Value", "2", 0)), Is.EqualTo(2)); } [Test] public void DefaultMapper_Decimal() { - Assert.AreEqual(Map(new ValueToken("Value", "2.2", 0)), 2.2M); + Assert.That(Map(new ValueToken("Value", "2.2", 0)), Is.EqualTo(2.2M)); } [Test] public void DefaultMapper_Double() { - Assert.AreEqual(Map(new ValueToken("Value", "2.2", 0)), 2.2); + Assert.That(Map(new ValueToken("Value", "2.2", 0)), Is.EqualTo(2.2)); } [Test] public void DefaultMapper_DateTime() { - Assert.AreEqual(Map(new ValueToken("Value", "2020.01.01 12:12:12", 0)), DateTime.Parse("2020.01.01 12:12:12")); + Assert.That(Map(new ValueToken("Value", "2020.01.01 12:12:12", 0)), Is.EqualTo(DateTime.Parse("2020.01.01 12:12:12"))); } [Test] public void DefaultMapper_Guid() { - Assert.AreEqual(Map(new ValueToken("Value", "1FB53019-AD8C-4FBD-B528-BCD07F6EB6BA", 0)), Guid.Parse("1FB53019-AD8C-4FBD-B528-BCD07F6EB6BA")); + Assert.That(Map(new ValueToken("Value", "1FB53019-AD8C-4FBD-B528-BCD07F6EB6BA", 0)), Is.EqualTo(Guid.Parse("1FB53019-AD8C-4FBD-B528-BCD07F6EB6BA"))); } [Test] public void DefaultMapper_Type() { - Assert.AreEqual( + Assert.That( Map(new ValueToken("Value", "YamlMap.Tests.Serialization.Mappers.DefaultMapperTests, YamlMap.Tests", 0)), - this.GetType()); + Is.EqualTo(this.GetType())); } [Test] public void DefaultMapper_GenericType() { - Assert.AreEqual( - Map(new ValueToken("Value", "YamlMap.Tests.Serialization.Mappers.MapperValue`1[[YamlMap.Tests.Serialization.Mappers.DefaultMapperTests, YamlMap.Tests]], YamlMap.Tests", 0)), - typeof(MapperValue)); + Assert.That( + Map(new ValueToken("Value", "YamlMap.Tests.Serialization.Mappers.MapperValue`1[[YamlMap.Tests.Serialization.Mappers.DefaultMapperTests, YamlMap.Tests]], YamlMap.Tests", 0)), + Is.EqualTo(typeof(MapperValue))); } } diff --git a/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericDictionaryMapperTests.cs b/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericDictionaryMapperTests.cs index 7c007db..a2f2fd5 100644 --- a/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericDictionaryMapperTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericDictionaryMapperTests.cs @@ -19,8 +19,8 @@ public void YamlMap_Serialization_GenericDictionaryMapper_Simple() var mapper = new GenericDictionaryMapper(); var ok = mapper.Map(token, list); - Assert.IsTrue(ok); - Assert.AreEqual("Value", list["Key"]); + Assert.That(ok, Is.True); + Assert.That("Value", Is.EqualTo(list["Key"])); } [Test] @@ -35,8 +35,8 @@ public void YamlMap_Serialization_GenericDictionaryMapper() var mapper = new GenericDictionaryMapper(); var ok = mapper.Map(token, item); - Assert.IsTrue(ok); - Assert.AreEqual("Value", item["Key"].Key); + Assert.That(ok); + Assert.That("Value", Is.EqualTo(item["Key"].Key)); } [Test] @@ -51,7 +51,7 @@ public void YamlMap_Serialization_GenericDictionaryMapper_NoDictionary() var mapper = new GenericDictionaryMapper(); var ok = mapper.Map(token, item); - Assert.IsFalse(ok); + Assert.That(ok, Is.False); } public class ArrayMapperItem diff --git a/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericListMapperTests.cs b/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericListMapperTests.cs index a7d441f..a8ac316 100644 --- a/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericListMapperTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/Mappers/GenericListMapperTests.cs @@ -19,8 +19,8 @@ public void YamlMap_Serialization_GenericListMapper_Simple() var mapper = new GenericListMapper(); var ok = mapper.Map(token, list); - Assert.IsTrue(ok); - Assert.AreEqual("Value", list[0]); + Assert.That(ok); + Assert.That("Value", Is.EqualTo(list[0])); } [Test] @@ -35,8 +35,8 @@ public void YamlMap_Serialization_GenericListMapper() var mapper = new GenericListMapper(); var ok = mapper.Map(token, item); - Assert.IsTrue(ok); - Assert.AreEqual("Value", item[0].Key); + Assert.That(ok); + Assert.That("Value", Is.EqualTo(item[0].Key)); } [Test] @@ -51,7 +51,7 @@ public void YamlMap_Serialization_GenericListMapper_NoList() var mapper = new GenericListMapper(); var ok = mapper.Map(token, item); - Assert.IsFalse(ok); + Assert.That(ok, Is.False); } public class ArrayMapperItem diff --git a/src/Tests/YamlMap.Tests/Serialization/Mappers/MapperFactoryTests.cs b/src/Tests/YamlMap.Tests/Serialization/Mappers/MapperFactoryTests.cs index 18a7405..d936953 100644 --- a/src/Tests/YamlMap.Tests/Serialization/Mappers/MapperFactoryTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/Mappers/MapperFactoryTests.cs @@ -15,35 +15,35 @@ public class MapperFactoryTests public void YamlMap_Serialization_MapperFactory_List() { var mapper = MapperFactory.GetObjectMapper(new List(), typeof(MapperItem)); - Assert.IsInstanceOf(mapper); + Assert.That(mapper, Is.InstanceOf()); } [Test] public void YamlMap_Serialization_MapperFactory_Dictionary() { var mapper = MapperFactory.GetObjectMapper(new Dictionary(), typeof(MapperItem)); - Assert.IsInstanceOf(mapper); + Assert.That(mapper, Is.InstanceOf()); } [Test] public void YamlMap_Serialization_MapperFactory_Array() { var mapper = MapperFactory.GetObjectMapper(new string[] {}, typeof(MapperItem)); - Assert.IsInstanceOf(mapper); + Assert.That(mapper, Is.InstanceOf()); } [Test] public void YamlMap_Serialization_MapperFactory_Array2() { var mapper = MapperFactory.GetObjectMapper(new ArrayList(), typeof(IList)); - Assert.IsInstanceOf(mapper); + Assert.That(mapper, Is.InstanceOf()); } [Test] public void YamlMap_Serialization_MapperFactory_Default() { var mapper = MapperFactory.GetObjectMapper(new MapperItem(), typeof(MapperItem)); - Assert.IsInstanceOf(mapper); + Assert.That(mapper, Is.InstanceOf()); } public class MapperItem { } diff --git a/src/Tests/YamlMap.Tests/Serialization/ObjectBuilderTests.cs b/src/Tests/YamlMap.Tests/Serialization/ObjectBuilderTests.cs index 274d80b..114f16e 100644 --- a/src/Tests/YamlMap.Tests/Serialization/ObjectBuilderTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/ObjectBuilderTests.cs @@ -25,7 +25,7 @@ public void ObjectBuilder_GenericLists(Type input, Type expected) var token = new Token("test", 0); var obj = input.CreateInstance(token); - Assert.IsInstanceOf(expected, obj); + Assert.That(obj, Is.InstanceOf(expected)); } [TestCase(typeof(IEnumerable), typeof(List))] @@ -37,7 +37,7 @@ public void ObjectBuilder_NonGenericLists(Type input, Type expected) var token = new Token("test", 0); var obj = input.CreateInstance(token); - Assert.IsInstanceOf(expected, obj); + Assert.That(obj, Is.InstanceOf(expected)); } [TestCase(typeof(TestObject), typeof(TestObject))] @@ -46,7 +46,7 @@ public void ObjectBuilder_BasicObject(Type input, Type expected) var token = new Token("test", 0); var obj = input.CreateInstance(token); - Assert.IsInstanceOf(expected, obj); + Assert.That(obj, Is.InstanceOf(expected)); } [Test] @@ -60,8 +60,8 @@ public void ObjectBuilder_Array() var obj = type.CreateInstance(token); - Assert.IsInstanceOf(obj); - Assert.AreEqual(3, ((IList) obj).Count); + Assert.That(obj, Is.InstanceOf()); + Assert.That(3, Is.EqualTo(((IList) obj).Count)); } [Test] diff --git a/src/Tests/YamlMap.Tests/Serialization/TokenSerializerTests.cs b/src/Tests/YamlMap.Tests/Serialization/TokenSerializerTests.cs index 0b5a012..0238356 100644 --- a/src/Tests/YamlMap.Tests/Serialization/TokenSerializerTests.cs +++ b/src/Tests/YamlMap.Tests/Serialization/TokenSerializerTests.cs @@ -26,7 +26,7 @@ public void TokenSerializer_SerializeList() sb.AppendLine(" - value 2"); sb.Append(" - value 3"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } [Test] @@ -51,7 +51,7 @@ public void TokenSerializer_SerializeDictionary() sb.AppendLine(" key2: value 2"); sb.Append(" key3: value 3"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } [Test] @@ -79,7 +79,7 @@ public void TokenSerializer_SerializeObjectList() sb.AppendLine(" - Value: value 3"); sb.Append(" Name: test 3"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } [Test] @@ -99,7 +99,7 @@ public void TokenSerializer_SerializeArray() sb.AppendLine(" - value 2"); sb.Append(" - value 3"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } [Test] @@ -127,7 +127,7 @@ public void TokenSerializer_SerializeObjectArray() sb.AppendLine(" - Value: value 3"); sb.Append(" Name: test 3"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } [Test] @@ -158,7 +158,7 @@ public void TokenSerializer_SerializeObjectDictionary() sb.AppendLine(" Value: value 3"); sb.Append(" Name: test 3"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } [Test] @@ -191,7 +191,7 @@ public void TokenSerializer_SerializeNestedObjects() sb.AppendLine(" Two:"); sb.Append(" Name: two"); - Assert.AreEqual(sb.ToString(), result); + Assert.That(sb.ToString(), Is.EqualTo(result)); } } } diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseBoolTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseBoolTests.cs index 3436588..707b0c1 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseBoolTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseBoolTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_Bool_0() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(false, parsed.Value); + Assert.That(false, Is.EqualTo(parsed.Value)); } [Test] @@ -33,7 +33,7 @@ public void ParsePrivitive_Bool_1() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(true, parsed.Value); + Assert.That(true, Is.EqualTo(parsed.Value)); } [Test] @@ -47,7 +47,7 @@ public void ParsePrivitive_Bool_false() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(false, parsed.Value); + Assert.That(false, Is.EqualTo(parsed.Value)); } [Test] @@ -61,7 +61,7 @@ public void ParsePrivitive_Bool_true() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(true, parsed.Value); + Assert.That(true, Is.EqualTo(parsed.Value)); } [Test] @@ -75,7 +75,7 @@ public void ParsePrivitive_Bool_false_Case() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(false, parsed.Value); + Assert.That(false, Is.EqualTo(parsed.Value)); } [Test] @@ -89,7 +89,7 @@ public void ParsePrivitive_Bool_true_Case() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(true, parsed.Value); + Assert.That(true, Is.EqualTo(parsed.Value)); } [Test] @@ -103,7 +103,7 @@ public void ParsePrivitive_Bool_no() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(false, parsed.Value); + Assert.That(false, Is.EqualTo(parsed.Value)); } [Test] @@ -117,7 +117,7 @@ public void ParsePrivitive_Bool_yes() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(true, parsed.Value); + Assert.That(true, Is.EqualTo(parsed.Value)); } [Test] @@ -131,7 +131,7 @@ public void ParsePrivitive_Bool_Invalid() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(false, parsed.Value); + Assert.That(false, Is.EqualTo(parsed.Value)); lines = new[] { @@ -140,7 +140,7 @@ public void ParsePrivitive_Bool_Invalid() parsed = reader.Read(lines); - Assert.AreEqual(false, parsed.Value); + Assert.That(false, Is.EqualTo(parsed.Value)); } [Test] @@ -156,8 +156,8 @@ public void ParsePrivitive_BoolList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(true, parsed.ValueList[0]); - Assert.AreEqual(false, parsed.ValueList[1]); + Assert.That(true, Is.EqualTo(parsed.ValueList[0])); + Assert.That(false, Is.EqualTo(parsed.ValueList[1])); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseDateTimeTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseDateTimeTests.cs index b8bdb29..01b83b2 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseDateTimeTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseDateTimeTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_DateTime() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + Assert.That(new DateTime(1919, 12, 31), Is.EqualTo(parsed.Value)); } [Test] @@ -33,7 +33,7 @@ public void ParsePrivitive_DateTime_Slash() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + Assert.That(new DateTime(1919, 12, 31), Is.EqualTo(parsed.Value)); } [Test] @@ -47,7 +47,7 @@ public void ParsePrivitive_DateTime_yyyyMMdd() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + Assert.That(new DateTime(1919, 12, 31), Is.EqualTo(parsed.Value)); } [Test] @@ -63,8 +63,8 @@ public void ParsePrivitive_DateTimelList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 1), parsed.ValueList[0]); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.ValueList[1]); + Assert.That(new DateTime(1919, 12, 1), Is.EqualTo(parsed.ValueList[0])); + Assert.That(new DateTime(1919, 12, 31), Is.EqualTo(parsed.ValueList[1])); } [Test] @@ -78,7 +78,7 @@ public void ParsePrivitive_DateTime_ISO8601() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + Assert.That(new DateTime(1919, 12, 31), Is.EqualTo(parsed.Value)); } [Test] @@ -92,7 +92,7 @@ public void ParsePrivitive_DateTime_Slash_ISO8601() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + Assert.That(new DateTime(1919, 12, 31), Is.EqualTo(parsed.Value)); } [Test] @@ -108,8 +108,8 @@ public void ParsePrivitive_DateTimelList_ISO8601() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 21), parsed.ValueList[0]); - Assert.AreEqual(new DateTime(1919, 12, 21), parsed.ValueList[1]); + Assert.That(new DateTime(1919, 12, 21), Is.EqualTo(parsed.ValueList[0])); + Assert.That(new DateTime(1919, 12, 21), Is.EqualTo(parsed.ValueList[1])); } @@ -129,8 +129,8 @@ public void ParsePrivitive_DateTimelList_ISO8601_Time() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 21, 13, 45, 21), parsed.ValueList[0]); - Assert.AreEqual(new DateTime(1919, 12, 21, 1, 20, 45), parsed.ValueList[1]); + Assert.That(new DateTime(1919, 12, 21, 13, 45, 21), Is.EqualTo(parsed.ValueList[0])); + Assert.That(new DateTime(1919, 12, 21, 1, 20, 45), Is.EqualTo(parsed.ValueList[1])); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseDecimalTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseDecimalTests.cs index 28b906b..47bf275 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseDecimalTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseDecimalTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_Decimal() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1.2, parsed.Value); + Assert.That(1.2, Is.EqualTo(parsed.Value)); } [Test] @@ -35,8 +35,8 @@ public void ParsePrivitive_DecimalList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1.1, parsed.ValueList[0]); - Assert.AreEqual(2.2, parsed.ValueList[1]); + Assert.That(1.1, Is.EqualTo(parsed.ValueList[0])); + Assert.That(2.2, Is.EqualTo(parsed.ValueList[1])); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseDoubleTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseDoubleTests.cs index bb7b41f..d9116d7 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseDoubleTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseDoubleTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_Double() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1.2, parsed.Value); + Assert.That(1.2, Is.EqualTo(parsed.Value)); } [Test] @@ -33,7 +33,7 @@ public void ParsePrivitive_Double_Invalid() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); + Assert.That(0, Is.EqualTo(parsed.Value)); } [Test] @@ -47,7 +47,7 @@ public void ParsePrivitive_Double_InvalidFormat() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); + Assert.That(0, Is.EqualTo(parsed.Value)); } [Test] @@ -63,8 +63,8 @@ public void ParsePrivitive_DoublelList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1.1, parsed.ValueList[0]); - Assert.AreEqual(2.2, parsed.ValueList[1]); + Assert.That(1.1, Is.EqualTo(parsed.ValueList[0])); + Assert.That(2.2, Is.EqualTo(parsed.ValueList[1])); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseEnumTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseEnumTests.cs index 8904d91..7afee93 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseEnumTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseEnumTests.cs @@ -20,7 +20,7 @@ public void ParsePrivitive_Enum() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(EnumValue.First, parsed.Value); + Assert.That(EnumValue.First, Is.EqualTo(parsed.Value) ); } [Test] @@ -34,7 +34,7 @@ public void ParsePrivitive_Enum_CaseInsensitive() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(EnumValue.First, parsed.Value); + Assert.That(EnumValue.First, Is.EqualTo(parsed.Value)); } [Test] @@ -48,7 +48,7 @@ public void ParsePrivitive_Enum_Invalid() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(EnumValue.None, parsed.Value); + Assert.That(EnumValue.None, Is.EqualTo(parsed.Value)); } [Test] @@ -64,8 +64,8 @@ public void ParsePrivitive_EnumList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(EnumValue.First, parsed.ValueList[0]); - Assert.AreEqual(EnumValue.Second, parsed.ValueList[1]); + Assert.That(EnumValue.First, Is.EqualTo(parsed.ValueList[0])); + Assert.That(EnumValue.Second, Is.EqualTo(parsed.ValueList[1])); } [Test] @@ -82,9 +82,9 @@ public void ParsePrivitive_EmptyEnum() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(EnumValue.None, parsed.Value); - Assert.AreEqual(EnumValue.First, parsed.ValueList[0]); - Assert.AreEqual(EnumValue.Second, parsed.ValueList[1]); + Assert.That(EnumValue.None, Is.EqualTo(parsed.Value)); + Assert.That(EnumValue.First, Is.EqualTo(parsed.ValueList[0])); + Assert.That(EnumValue.Second, Is.EqualTo(parsed.ValueList[1])); } [Test] @@ -102,11 +102,11 @@ public void ParsePrivitive_Enum_FromInt() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(EnumValue.First, parsed.Value); + Assert.That(EnumValue.First, Is.EqualTo(parsed.Value)); - Assert.AreEqual(EnumValue.None, parsed.ValueList[0]); - Assert.AreEqual(EnumValue.First, parsed.ValueList[1]); - Assert.AreEqual(EnumValue.Second, parsed.ValueList[2]); + Assert.That(EnumValue.None, Is.EqualTo(parsed.ValueList[0])); + Assert.That(EnumValue.First, Is.EqualTo(parsed.ValueList[1])); + Assert.That(EnumValue.Second, Is.EqualTo(parsed.ValueList[2])); } public enum EnumValue diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseIntTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseIntTests.cs index 986225e..24a12e6 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseIntTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseIntTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_Int() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(2, parsed.Value); + Assert.That(2, Is.EqualTo(parsed.Value)); } [Test] @@ -33,7 +33,7 @@ public void ParsePrivitive_Int_FromDecimal() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); + Assert.That(0, Is.EqualTo(parsed.Value)); } [Test] @@ -47,7 +47,7 @@ public void ParsePrivitive_Int_Invalid() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); + Assert.That(0, Is.EqualTo(parsed.Value)); } [Test] @@ -63,8 +63,8 @@ public void ParsePrivitive_IntList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1, parsed.ValueList[0]); - Assert.AreEqual(2, parsed.ValueList[1]); + Assert.That(1, Is.EqualTo(parsed.ValueList[0])); + Assert.That(2, Is.EqualTo(parsed.ValueList[1])); } [Test] @@ -81,9 +81,9 @@ public void ParsePrivitive_EmptyInt() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); - Assert.AreEqual(1, parsed.ValueList[0]); - Assert.AreEqual(2, parsed.ValueList[1]); + Assert.That(0, Is.EqualTo(parsed.Value)); + Assert.That(1, Is.EqualTo(parsed.ValueList[0])); + Assert.That(2, Is.EqualTo(parsed.ValueList[1])); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseLongTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseLongTests.cs index d0c111c..08a9e61 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseLongTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseLongTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_Long() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(2, parsed.Value); + Assert.That(2, Is.EqualTo(parsed.Value)); } [Test] @@ -33,7 +33,7 @@ public void ParsePrivitive_Long_FromDecimal() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); + Assert.That(0, Is.EqualTo(parsed.Value)); } [Test] @@ -47,7 +47,7 @@ public void ParsePrivitive_Long_Invalid() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(0, parsed.Value); + Assert.That(0, Is.EqualTo(parsed.Value)); } [Test] @@ -63,8 +63,8 @@ public void ParsePrivitive_LongList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1, parsed.ValueList[0]); - Assert.AreEqual(2, parsed.ValueList[1]); + Assert.That(1, Is.EqualTo(parsed.ValueList[0])); + Assert.That(2, Is.EqualTo(parsed.ValueList[1])); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDateTimeTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDateTimeTests.cs index ba62433..b576280 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDateTimeTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDateTimeTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests.TypeConvert { @@ -19,7 +20,7 @@ public void ParsePrivitive_NullableDateTime() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + ClassicAssert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); } [Test] @@ -33,7 +34,7 @@ public void ParsePrivitive_NullableDateTime_Slash() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + ClassicAssert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); } [Test] @@ -47,7 +48,7 @@ public void ParsePrivitive_NullableDateTime_yyyyMMdd() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + ClassicAssert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); } [Test] @@ -61,7 +62,7 @@ public void ParsePrivitive_NullableDateTime_Null() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); + ClassicAssert.AreEqual(new DateTime(1919, 12, 31), parsed.Value); } [Test] @@ -80,8 +81,8 @@ public void ParsePrivitive_NullableDateTimelList() //var parsed = reader.Read(lines); //Assert.That(parsed.ValueList.Count == 2); - //Assert.AreEqual(new DateTime(1919, 12, 1), parsed.ValueList[0]); - //Assert.AreEqual(new DateTime(1919, 12, 31), parsed.ValueList[1]); + //ClassicAssert.AreEqual(new DateTime(1919, 12, 1), parsed.ValueList[0]); + //ClassicAssert.AreEqual(new DateTime(1919, 12, 31), parsed.ValueList[1]); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDoubleTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDoubleTests.cs index 1b85ccb..5d41962 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDoubleTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseNullableDoubleTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests.TypeConvert { @@ -19,7 +20,7 @@ public void ParsePrivitive_NullableDouble() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(1.2, parsed.Value); + ClassicAssert.AreEqual(1.2, parsed.Value); } [Test] @@ -33,7 +34,7 @@ public void ParsePrivitive_NullableDouble_Null() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(null, parsed.Value); + ClassicAssert.AreEqual(null, parsed.Value); } [Test] @@ -49,8 +50,8 @@ public void ParsePrivitive_NullableDoublelList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(null, parsed.ValueList[0]); - Assert.AreEqual(2.2, parsed.ValueList[1]); + ClassicAssert.AreEqual(null, parsed.ValueList[0]); + ClassicAssert.AreEqual(2.2, parsed.ValueList[1]); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseStringTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseStringTests.cs index 9e19580..2694cf3 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseStringTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseStringTests.cs @@ -19,7 +19,7 @@ public void ParsePrivitive_String() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("value", parsed.Value); + Assert.That("value", Is.EqualTo(parsed.Value)); } [Test] @@ -35,8 +35,8 @@ public void ParsePrivitive_StringList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual("one", parsed.ValueList[0]); - Assert.AreEqual("two", parsed.ValueList[1]); + Assert.That("one", Is.EqualTo(parsed.ValueList[0])); + Assert.That("two", Is.EqualTo(parsed.ValueList[1])); } [Test] @@ -53,7 +53,7 @@ public void ParsePrivitive_EmptyString() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(string.Empty, parsed.Value); + Assert.That(string.Empty, Is.EqualTo(parsed.Value)); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/TypeConvert/ParseTypeTests.cs b/src/Tests/YamlMap.Tests/TypeConvert/ParseTypeTests.cs index 148c314..35ad452 100644 --- a/src/Tests/YamlMap.Tests/TypeConvert/ParseTypeTests.cs +++ b/src/Tests/YamlMap.Tests/TypeConvert/ParseTypeTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; +using NUnit.Framework.Legacy; using YamlMap.Serialization; namespace YamlMap.Tests.TypeConvert @@ -20,7 +21,7 @@ public void ParsePrivitive_Type() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(typeof(ParseTypeTests), parsed.Value); + ClassicAssert.AreEqual(typeof(ParseTypeTests), parsed.Value); } [Test] @@ -60,8 +61,8 @@ public void ParsePrivitive_TypeList() var reader = new YamlReader(); var parsed = reader.Read(lines); - Assert.AreEqual(typeof(PrimitiveValues), parsed.ValueList[0]); - Assert.AreEqual(typeof(ParseTypeTests), parsed.ValueList[1]); + ClassicAssert.AreEqual(typeof(PrimitiveValues), parsed.ValueList[0]); + ClassicAssert.AreEqual(typeof(ParseTypeTests), parsed.ValueList[1]); } public class PrimitiveValues diff --git a/src/Tests/YamlMap.Tests/YamlFileReaderFileElementsTests.cs b/src/Tests/YamlMap.Tests/YamlFileReaderFileElementsTests.cs index d5f469a..8aeb816 100644 --- a/src/Tests/YamlMap.Tests/YamlFileReaderFileElementsTests.cs +++ b/src/Tests/YamlMap.Tests/YamlFileReaderFileElementsTests.cs @@ -5,6 +5,7 @@ using YamlMap; using NUnit.Framework; using Polaroider; +using NUnit.Framework.Legacy; namespace YamlMap.Tests { @@ -17,7 +18,7 @@ public void YamlFileReader_File_SimpleProperty_Root() var reader = new YamlFileReader(); var data = reader.Read("SimpleProperty.yml"); - Assert.AreEqual("id", data.Id); + ClassicAssert.AreEqual("id", data.Id); } [Test] @@ -26,8 +27,8 @@ public void YamlFileReader_File_ObjectProperty_Root() var reader = new YamlFileReader(); var data = reader.Read("ObjectProperty.yml"); - Assert.IsNotNull(data.SimpleObject); - Assert.AreEqual("Object name", data.SimpleObject.Name); + ClassicAssert.IsNotNull(data.SimpleObject); + ClassicAssert.AreEqual("Object name", data.SimpleObject.Name); } [Test] @@ -36,9 +37,9 @@ public void YamlFileReader_File_ObjectProperty_Nested() var reader = new YamlFileReader(); var data = reader.Read("Nested.yml"); - Assert.IsNotNull(data.Nested); - Assert.IsNotNull(data.Nested.Nested); - Assert.AreEqual("nested object", data.Nested.Nested.Name); + ClassicAssert.IsNotNull(data.Nested); + ClassicAssert.IsNotNull(data.Nested.Nested); + ClassicAssert.AreEqual("nested object", data.Nested.Nested.Name); } [Test] @@ -47,7 +48,7 @@ public void YamlFileReader_File_ObjectProperty_AfterNested() var reader = new YamlFileReader(); var data = reader.Read("Nested.yml"); - Assert.AreEqual("first object", data.Nested.Name); + ClassicAssert.AreEqual("first object", data.Nested.Name); } [Test] diff --git a/src/Tests/YamlMap.Tests/YamlFileReaderTests.cs b/src/Tests/YamlMap.Tests/YamlFileReaderTests.cs index 0f818ce..7b7bf33 100644 --- a/src/Tests/YamlMap.Tests/YamlFileReaderTests.cs +++ b/src/Tests/YamlMap.Tests/YamlFileReaderTests.cs @@ -12,7 +12,7 @@ public void YamlMap_YamlReader_SimpleProperty_Root() var reader = new YamlFileReader(); var data = reader.Read("YamlTest.yml"); - Assert.AreEqual("id", data.Id); + Assert.That("id", Is.EqualTo(data.Id)); } [Test] diff --git a/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj b/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj index a608239..b5d4b99 100644 --- a/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj +++ b/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj @@ -19,16 +19,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - - + + + + diff --git a/src/Tests/YamlMap.Tests/YamlReaderArrayElementsTests.cs b/src/Tests/YamlMap.Tests/YamlReaderArrayElementsTests.cs index 4bf2f3f..75b160b 100644 --- a/src/Tests/YamlMap.Tests/YamlReaderArrayElementsTests.cs +++ b/src/Tests/YamlMap.Tests/YamlReaderArrayElementsTests.cs @@ -4,6 +4,7 @@ using System.Text; using YamlMap; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests { @@ -21,7 +22,7 @@ public void YamlMap_YamlReader_Array_SimpleProperty_Root() var reader = new YamlReader(); var data = reader.Read(lines); - Assert.AreEqual("1", data.Id); + ClassicAssert.AreEqual("1", data.Id); } [Test] @@ -37,8 +38,8 @@ public void YamlMap_YamlReader_Array_ObjectProperty_Root() var reader = new YamlReader(); var data = reader.Read(lines); - Assert.IsNotNull(data.SimpleObject); - Assert.AreEqual("Object name", data.SimpleObject.Name); + ClassicAssert.IsNotNull(data.SimpleObject); + ClassicAssert.AreEqual("Object name", data.SimpleObject.Name); } [Test] @@ -56,9 +57,9 @@ public void YamlMap_YamlReader_Array_ObjectProperty_Nested() var reader = new YamlReader(); var data = reader.Read(lines); - Assert.IsNotNull(data.Nested); - Assert.IsNotNull(data.Nested.Nested); - Assert.AreEqual("nested object", data.Nested.Nested.Name); + ClassicAssert.IsNotNull(data.Nested); + ClassicAssert.IsNotNull(data.Nested.Nested); + ClassicAssert.AreEqual("nested object", data.Nested.Nested.Name); } [Test] @@ -76,7 +77,7 @@ public void YamlMap_YamlReader_Array_ObjectProperty_AfterNested() var reader = new YamlReader(); var data = reader.Read(lines); - Assert.AreEqual("first object", data.Nested.Name); + ClassicAssert.AreEqual("first object", data.Nested.Name); } [Test] diff --git a/src/Tests/YamlMap.Tests/YamlWriterTests.cs b/src/Tests/YamlMap.Tests/YamlWriterTests.cs index c3665cc..133c237 100644 --- a/src/Tests/YamlMap.Tests/YamlWriterTests.cs +++ b/src/Tests/YamlMap.Tests/YamlWriterTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace YamlMap.Tests { @@ -19,7 +20,7 @@ public void YamlMap_YamlWriter() var reader = new YamlWriter(); var data = reader.Write(item); - Assert.AreEqual("Simple: Simple value", data); + ClassicAssert.AreEqual("Simple: Simple value", data); } //TODO: null property @@ -34,7 +35,7 @@ public void YamlMap_YamlWriter_null() var reader = new YamlWriter(); var data = reader.Write(item); - Assert.AreEqual("", data); + ClassicAssert.AreEqual("", data); } //TODO: protected/private property @@ -58,7 +59,7 @@ public void YamlMap_YamlWriter_Child() sb.AppendLine("Child:"); sb.Append(" Simple: not root"); - Assert.AreEqual(sb.ToString(), data); + ClassicAssert.AreEqual(sb.ToString(), data); } [Test] @@ -79,7 +80,7 @@ public void YamlMap_YamlWriter_StringArry() sb.AppendLine(" - one"); sb.Append(" - 2"); - Assert.AreEqual(sb.ToString(), data); + ClassicAssert.AreEqual(sb.ToString(), data); } [Test] @@ -105,7 +106,7 @@ public void YamlMap_YamlWriter_ObjectList() sb.AppendLine(" - Child:"); sb.Append(" Simple: child"); - Assert.AreEqual(sb.ToString(), data); + ClassicAssert.AreEqual(sb.ToString(), data); } [Test] @@ -113,13 +114,13 @@ public void YamlMap_YamlWriter_String_SpecialChars() { var reader = new YamlWriter(); var data = reader.Write(new { Value = "tes:one" }); - Assert.AreEqual("Value: 'tes:one'", data); + ClassicAssert.AreEqual("Value: 'tes:one'", data); data = reader.Write(new { Value = "tes[one" }); - Assert.AreEqual("Value: 'tes[one'", data); + ClassicAssert.AreEqual("Value: 'tes[one'", data); data = reader.Write(new { Value = "tes]one" }); - Assert.AreEqual("Value: 'tes]one'", data); + ClassicAssert.AreEqual("Value: 'tes]one'", data); } [Test] @@ -139,7 +140,7 @@ public void YamlMap_YamlWriter_StringList_SpecialChars() .AppendLine(" - 'tes[one'") .Append(" - 'tes]one'"); - Assert.AreEqual(sb.ToString(), data); + ClassicAssert.AreEqual(sb.ToString(), data); } [Test] @@ -147,7 +148,7 @@ public void YamlMap_YamlWriter_Type() { var reader = new YamlWriter(); var data = reader.Write(new { Type = typeof(YamlWriter) }); - Assert.AreEqual("Type: YamlMap.YamlWriter, YamlMap", data); + ClassicAssert.AreEqual("Type: YamlMap.YamlWriter, YamlMap", data); } public class YamlItem