-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from tomasbruckner/version-1-3-1
Version 1.3.1
- Loading branch information
Showing
7 changed files
with
190 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<Version>1.2.0</Version> | ||
<TargetFrameworks>net47;netcoreapp2.1;netcoreapp3.1;net50;netstandard2.0;netstandard2.1</TargetFrameworks> | ||
<Version>1.3.1</Version> | ||
<Authors>Tomas Bruckner</Authors> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<RepositoryUrl>https://github.com/tomasbruckner/jest-dotnet</RepositoryUrl> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<NoWarn>1591;1573</NoWarn> | ||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild> | ||
<Description>Snapshot testing in C#. See Project Site for more details</Description> | ||
<PackageProjectUrl>https://github.com/tomasbruckner/jest-dotnet</PackageProjectUrl> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageTags>testing, test, snapshot, jest, json, xunit</PackageTags> | ||
<LangVersion>latest</LangVersion> | ||
<PackageIcon>jest.png</PackageIcon> | ||
<PackageReleaseNotes>See https://github.com/tomasbruckner/jest-dotnet/releases</PackageReleaseNotes> | ||
<PackageTags>testing;test;snapshot;jest;json;xunit;netcore;netstandard</PackageTags> | ||
<PackageDescription> | ||
Simple snapshot testing with inspiration from amazing Jest library. | ||
</PackageDescription> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<RepositoryUrl>[email protected]:tomasbruckner/jest-dotnet.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<Copyright>Copyright Tomas Bruckner 2020</Copyright> | ||
<LangVersion>8.0</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="JsonDiffPatch.Net" Version="2.1.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> | ||
<None Include="..\jest.png" Pack="true" Visible="false" PackagePath=""/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="JsonDiffPatch.Net" Version="2.3.0"/> | ||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0"/> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string, DictionaryChildObject> | ||
{ | ||
{ | ||
"first", new DictionaryChildObject | ||
{ | ||
IntValue = 312, | ||
StringValue1 = "nested1", | ||
StringValue2 = null, | ||
IntNullValue = null, | ||
ReadOnlyDictionaryChildren = new Dictionary<string, bool> | ||
{ | ||
{"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<string, bool>() | ||
} | ||
}, | ||
{ | ||
"third", new DictionaryChildObject | ||
{ | ||
IntValue = 312, | ||
StringValue1 = "nested2", | ||
StringValue2 = "x", | ||
IntNullValue = 4, | ||
ReadOnlyDictionaryChildren = null | ||
} | ||
} | ||
} | ||
}; | ||
|
||
JestAssert.ShouldMatchSnapshot(testObject); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace XUnitTests.Helpers | ||
{ | ||
public class ComplexObject | ||
{ | ||
public IDictionary<string, DictionaryChildObject> 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<string, bool> 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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
JestDotnet/XUnitTests/__snapshots__/ComplexObjectTestShouldMatchDynamicObject.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters