-
-
Notifications
You must be signed in to change notification settings - Fork 379
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 #351 from JosephWoodward/ShouldBeNullNotNullDocs
Added ShouldBeNullNotNull docs
- Loading branch information
Showing
8 changed files
with
71 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ShouldBeNull/NotBeNull | ||
=========== | ||
|
||
``ShouldBeNull`` and ``ShouldNotBeNull`` allow you to check whether or not a type's reference is null. | ||
|
||
ShouldBeNull | ||
------- | ||
|
||
.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeNullNotNullExamples/ShouldBeNull.codeSample.approved.txt | ||
:language: c# | ||
|
||
**Exception** | ||
|
||
.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeNullNotNullExamples/ShouldBeNull.exceptionText.approved.txt | ||
|
||
ShouldNotBeNull | ||
------- | ||
|
||
.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeNullNotNullExamples/ShouldNotBeNull.codeSample.approved.txt | ||
:language: c# | ||
|
||
**Exception** | ||
|
||
.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeNullNotNullExamples/ShouldNotBeNull.exceptionText.approved.txt |
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
2 changes: 2 additions & 0 deletions
2
...ionExamples/CodeExamples/ShouldBeNullNotNullExamples/ShouldBeNull.codeSample.approved.txt
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,2 @@ | ||
string myRef = "Hello World"; | ||
myRef.ShouldBeNull(); |
3 changes: 3 additions & 0 deletions
3
...Examples/CodeExamples/ShouldBeNullNotNullExamples/ShouldBeNull.exceptionText.approved.txt
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,3 @@ | ||
myRef | ||
should be null but was | ||
"Hello World" |
2 changes: 2 additions & 0 deletions
2
...Examples/CodeExamples/ShouldBeNullNotNullExamples/ShouldNotBeNull.codeSample.approved.txt
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,2 @@ | ||
string myRef = null; | ||
myRef.ShouldNotBeNull(); |
2 changes: 2 additions & 0 deletions
2
...mples/CodeExamples/ShouldBeNullNotNullExamples/ShouldNotBeNull.exceptionText.approved.txt
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,2 @@ | ||
myRef | ||
should not be null but was |
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,36 @@ | ||
using Shouldly; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace DocumentationExamples | ||
{ | ||
public class ShouldBeNullNotNullExamples | ||
{ | ||
readonly ITestOutputHelper _testOutputHelper; | ||
|
||
public ShouldBeNullNotNullExamples(ITestOutputHelper testOutputHelper) | ||
{ | ||
_testOutputHelper = testOutputHelper; | ||
} | ||
|
||
[Fact] | ||
public void ShouldBeNull() | ||
{ | ||
DocExampleWriter.Document(() => | ||
{ | ||
string myRef = "Hello World"; | ||
myRef.ShouldBeNull(); | ||
}, _testOutputHelper); | ||
} | ||
|
||
[Fact] | ||
public void ShouldNotBeNull() | ||
{ | ||
DocExampleWriter.Document(() => | ||
{ | ||
string myRef = null; | ||
myRef.ShouldNotBeNull(); | ||
}, _testOutputHelper); | ||
} | ||
} | ||
} |