generated from kasthack-labs/dotnet-repo-template
-
-
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.
Fix broken paths, add tests for paths, remove obsolete Assert() api, …
…bump version to 1.1.0
- Loading branch information
Showing
11 changed files
with
76 additions
and
66 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
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
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
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
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
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
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
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
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
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,35 @@ | ||
namespace kasthack.NotEmpty.Tests | ||
{ | ||
using System.Collections.Generic; | ||
using global::Xunit; | ||
|
||
public class RawNotEmptyTest : NotEmptyTestBase | ||
{ | ||
public RawNotEmptyTest() | ||
: base((x, o) => kasthack.NotEmpty.Raw.NotEmptyExtensions.NotEmpty(x, o)) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public void RawAssertThrowsAnExceptionOfACorrectType() => Assert.Throws<Raw.EmptyException>(() => this.Action(new { Value = 0, })); | ||
|
||
[Fact] | ||
public void PathIsConstructedProperlyForTheRootObject() => this.AssertExceptionPath("(value)", 0); | ||
|
||
[Fact] | ||
public void PathIsConstructedProperlyForProperties() => this.AssertExceptionPath("(value).Value", new { Value = 0, }); | ||
|
||
[Fact] | ||
public void PathIsConstructedProperlyForNestedProperties() => this.AssertExceptionPath("(value).Value.A", new { Value = new { A = 0 } }); | ||
|
||
[Fact] | ||
public void PathIsConstructedProperlyForArrays() => this.AssertExceptionPath("(value).Value[0].A", new { Value = new[] { new { A = 0 } } }); | ||
|
||
[Fact] | ||
public void PathIsConstructedProperlyForDictionaries() => this.AssertExceptionPath("(value).Value[str]", new { Value = new Dictionary<string, int> { { "str", 0 } } }); | ||
|
||
private void AssertExceptionPath(string expectedPath, object value) => Assert.Equal( | ||
expectedPath, | ||
Assert.Throws<Raw.EmptyException>(() => this.Action(value)).Path); | ||
} | ||
} |
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