Skip to content

Commit

Permalink
Merge pull request #350 from JosephWoodward/ShouldBeTrueFalseDocs
Browse files Browse the repository at this point in the history
Added ShouldBeTrue and ShouldBeFalse docs
  • Loading branch information
JakeGinnivan committed Jan 6, 2016
2 parents 3618c61 + f155864 commit 799a84f
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/assertions/shouldBeTrueFalse.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ShouldBeTrue/False
========

``ShouldBeTrue`` and ``ShouldBeFalse`` work on boolean values.

ShouldBeTrue
------------
.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeTrueFalseExamples/ShouldBeTrue.codeSample.approved.txt
:language: c#

**Exception**

.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeTrueFalseExamples/ShouldBeTrue.exceptionText.approved.txt

ShouldBeFalse
------------

.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeTrueFalseExamples/ShouldBeFalse.codeSample.approved.txt
:language: c#

**Exception**

.. literalinclude:: /../src/DocumentationExamples/CodeExamples/ShouldBeTrueFalseExamples/ShouldBeFalse.exceptionText.approved.txt
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Shouldly has plenty of different assertions, have a look under the assertions fo
assertions/shouldBe
assertions/shouldNotBe
assertions/shouldMatchApproved
assertions/shouldBeTrueFalse
exampleClasses
contributing
configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bool myValue = true;
myValue.ShouldBeFalse();
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
myValue
should be
False
but was
True
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bool myValue = false;
myValue.ShouldBeTrue();
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
myValue
should be
True
but was
False
1 change: 1 addition & 0 deletions src/DocumentationExamples/DocumentationExamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="DocExampleWriter.cs" />
<Compile Include="ShouldBeTrueFalseExamples.cs" />
<Compile Include="ShouldMatchApprovedExamples.cs" />
<Compile Include="ShouldNotBeExamples.cs" />
<Compile Include="ShouldBeExamples.cs" />
Expand Down
37 changes: 37 additions & 0 deletions src/DocumentationExamples/ShouldBeTrueFalseExamples.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Shouldly;
using Xunit;
using Xunit.Abstractions;

namespace DocumentationExamples
{
public class ShouldBeTrueFalseExamples
{
readonly ITestOutputHelper _testOutputHelper;

public ShouldBeTrueFalseExamples(ITestOutputHelper testOutputHelper)
{
_testOutputHelper = testOutputHelper;
}

[Fact]
public void ShouldBeTrue()
{
DocExampleWriter.Document(() =>
{
bool myValue = false;
myValue.ShouldBeTrue();
}, _testOutputHelper);
}

[Fact]
public void ShouldBeFalse()
{
DocExampleWriter.Document(() =>
{
bool myValue = true;
myValue.ShouldBeFalse();
}, _testOutputHelper);
}

}
}

0 comments on commit 799a84f

Please sign in to comment.