diff --git a/JestDotnet/JestDotnet/JestDotnet.csproj b/JestDotnet/JestDotnet/JestDotnet.csproj
index a84ca79..2eb24ad 100644
--- a/JestDotnet/JestDotnet/JestDotnet.csproj
+++ b/JestDotnet/JestDotnet/JestDotnet.csproj
@@ -1,22 +1,39 @@
- netcoreapp3.1
- 1.2.0
+ net47;netcoreapp2.1;netcoreapp3.1;net50;netstandard2.0;netstandard2.1
+ 1.3.1
Tomas Bruckner
+ true
https://github.com/tomasbruckner/jest-dotnet
+ true
+ 1591;1573
+ False
Snapshot testing in C#. See Project Site for more details
https://github.com/tomasbruckner/jest-dotnet
MIT
- testing, test, snapshot, jest, json, xunit
- latest
+ jest.png
+ See https://github.com/tomasbruckner/jest-dotnet/releases
+ testing;test;snapshot;jest;json;xunit;netcore;netstandard
+
+ Simple snapshot testing with inspiration from amazing Jest library.
+
true
+ git@github.com:tomasbruckner/jest-dotnet.git
+ git
true
+ Copyright Tomas Bruckner 2020
+ 8.0
-
-
+
+
+
+
+
+
+
diff --git a/JestDotnet/XUnitTests/ComplexObjectTest.cs b/JestDotnet/XUnitTests/ComplexObjectTest.cs
new file mode 100644
index 0000000..d7dcdd8
--- /dev/null
+++ b/JestDotnet/XUnitTests/ComplexObjectTest.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using JestDotnet;
+using Xunit;
+using XUnitTests.Helpers;
+
+namespace XUnitTests
+{
+ public class ComplexObjectTests
+ {
+ [Fact]
+ public void ShouldMatchDynamicObject()
+ {
+ var testObject = new ComplexObject
+ {
+ BoolValue = false,
+ IntValue = 123,
+ StringValue = string.Empty,
+ ChildObject = new ChildObject
+ {
+ IntValue = 33,
+ StringValue = "child"
+ },
+ DateTimeValue = DateTime.MaxValue,
+ IntNullValue = null,
+ Children = new Dictionary
+ {
+ {
+ "first", new DictionaryChildObject
+ {
+ IntValue = 312,
+ StringValue1 = "nested1",
+ StringValue2 = null,
+ IntNullValue = null,
+ ReadOnlyDictionaryChildren = new Dictionary
+ {
+ {"key1", false},
+ {"key2", true},
+ {
+ "very.very.very.very.very.very.very.very.very.very.very.very.very.long.key1",
+ true
+ },
+ {"Рикроллинг", true},
+ {
+ "very.very.very.very.very.very.very.very.very.very.very.very.very.long.key3",
+ true
+ },
+ {
+ "very.very.very.very.very.very.very.very.very.very.very.very.very.long.key4",
+ true
+ },
+ {"4", true}
+ }
+ }
+ },
+ {
+ "second", new DictionaryChildObject
+ {
+ IntValue = 312,
+ StringValue1 = "nested2",
+ StringValue2 = "x",
+ IntNullValue = 4,
+ ReadOnlyDictionaryChildren = new Dictionary()
+ }
+ },
+ {
+ "third", new DictionaryChildObject
+ {
+ IntValue = 312,
+ StringValue1 = "nested2",
+ StringValue2 = "x",
+ IntNullValue = 4,
+ ReadOnlyDictionaryChildren = null
+ }
+ }
+ }
+ };
+
+ JestAssert.ShouldMatchSnapshot(testObject);
+ }
+ }
+}
diff --git a/JestDotnet/XUnitTests/Helpers/ComplexObject.cs b/JestDotnet/XUnitTests/Helpers/ComplexObject.cs
new file mode 100644
index 0000000..29bdfa9
--- /dev/null
+++ b/JestDotnet/XUnitTests/Helpers/ComplexObject.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace XUnitTests.Helpers
+{
+ public class ComplexObject
+ {
+ public IDictionary Children { get; set; }
+ public ChildObject ChildObject { get; set; }
+ public bool BoolValue { get; set; }
+ public int IntValue { get; set; }
+ public DateTime? DateTimeValue { get; set; }
+ public string StringValue { get; set; }
+ public int? IntNullValue { get; set; }
+ }
+
+ public class DictionaryChildObject
+ {
+ public IReadOnlyDictionary ReadOnlyDictionaryChildren { get; set; }
+ public int IntValue { get; set; }
+ public string StringValue1 { get; set; }
+ public string StringValue2 { get; set; }
+ public int? IntNullValue { get; set; }
+ }
+
+ public class ChildObject
+ {
+ public int IntValue { get; set; }
+ public string StringValue { get; set; }
+ }
+}
diff --git a/JestDotnet/XUnitTests/XUnitTests.csproj b/JestDotnet/XUnitTests/XUnitTests.csproj
index 30adb97..133f907 100644
--- a/JestDotnet/XUnitTests/XUnitTests.csproj
+++ b/JestDotnet/XUnitTests/XUnitTests.csproj
@@ -1,15 +1,17 @@
- netcoreapp3.1
+ net47;netcoreapp2.1;netcoreapp3.1;net50
false
-
-
-
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/JestDotnet/XUnitTests/__snapshots__/ComplexObjectTestShouldMatchDynamicObject.snap b/JestDotnet/XUnitTests/__snapshots__/ComplexObjectTestShouldMatchDynamicObject.snap
new file mode 100644
index 0000000..34ddc4d
--- /dev/null
+++ b/JestDotnet/XUnitTests/__snapshots__/ComplexObjectTestShouldMatchDynamicObject.snap
@@ -0,0 +1,42 @@
+{
+ "Children": {
+ "first": {
+ "ReadOnlyDictionaryChildren": {
+ "key1": false,
+ "key2": true,
+ "very.very.very.very.very.very.very.very.very.very.very.very.very.long.key1": true,
+ "Рикроллинг": true,
+ "very.very.very.very.very.very.very.very.very.very.very.very.very.long.key3": true,
+ "very.very.very.very.very.very.very.very.very.very.very.very.very.long.key4": true,
+ "4": true
+ },
+ "IntValue": 312,
+ "StringValue1": "nested1",
+ "StringValue2": null,
+ "IntNullValue": null
+ },
+ "second": {
+ "ReadOnlyDictionaryChildren": {},
+ "IntValue": 312,
+ "StringValue1": "nested2",
+ "StringValue2": "x",
+ "IntNullValue": 4
+ },
+ "third": {
+ "ReadOnlyDictionaryChildren": null,
+ "IntValue": 312,
+ "StringValue1": "nested2",
+ "StringValue2": "x",
+ "IntNullValue": 4
+ }
+ },
+ "ChildObject": {
+ "IntValue": 33,
+ "StringValue": "child"
+ },
+ "BoolValue": false,
+ "IntValue": 123,
+ "DateTimeValue": "9999-12-31T23:59:59.9999999",
+ "StringValue": "",
+ "IntNullValue": null
+}
\ No newline at end of file
diff --git a/JestDotnet/jest.png b/JestDotnet/jest.png
new file mode 100644
index 0000000..2b18a73
Binary files /dev/null and b/JestDotnet/jest.png differ
diff --git a/README.md b/README.md
index cfe3284..3422b97 100644
--- a/README.md
+++ b/README.md
@@ -225,3 +225,8 @@ JestAssert.ShouldMatchSnapshot(testObject);
## Caveats
### Dynamic objects
You cannot call neither extension nor `JestAssert` with `dynamic` object. You need to cast it to `object` (or real type).
+
+
+## Credits
+
+[Package icon](https://www.flaticon.com/free-icon/joker-hat_68335)