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