Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 10.0.x
- name: dotnet pack
run: dotnet pack --configuration Release --include-symbols --include-source /p:PackageVersion='${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}' -o nupkg FluentAssertions.BUnit
- name: Push to NuGet Feed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

Expand All @@ -10,6 +10,6 @@

var elementAssertions = element.Should();

elementAssertions.Should().BeOfType<ElementAssertions>();
elementAssertions.GetType().Should().Be(typeof(ElementAssertions));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

Expand All @@ -9,6 +9,7 @@

var renderedFragmentAssertion = renderedFragment.Should();

renderedFragmentAssertion.Should().BeOfType<RenderedFragmentAssertions>();
renderedFragmentAssertion.GetType().IsGenericType.Should().BeTrue();
renderedFragmentAssertion.GetType().GetGenericTypeDefinition().Should().Be(typeof(RenderedFragmentAssertions<>));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
@using Xunit.Sdk
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

[Fact]
public void Succeed()
{
Render(@<img src="/logo.png" alt="Logo">)
.AsElement()
.Should().HaveAltText("Logo");
}

[Fact]
public void ReturnAndConstraint()
{
var andConstraint = Render(@<img src="/logo.png" alt="Logo">)
.AsElement()
.Should().HaveAltText("Logo");

andConstraint.Should().BeOfType<AndConstraint<ElementAssertions>>();
var constraintType = andConstraint.GetType();
constraintType.IsGenericType.Should().BeTrue();
constraintType.GetGenericTypeDefinition().Should().Be(typeof(AndConstraint<>));
constraintType.GetGenericArguments()[0].Should().BeSameAs(typeof(ElementAssertions));
}

[Fact]
Expand All @@ -29,9 +32,9 @@
.Should().HaveAltText("Logo");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement to have attribute \"alt\", but found <null>.");
.And.Message.Should().Be("Expected IElement to have attribute \"alt\", but found <null>.");
}

[Fact]
public void ThrowException_WhenDoesNotHaveAttribute_AndShouldIncludeBecauseMessage()
{
Expand All @@ -40,9 +43,9 @@
.Should().HaveAltText("Logo", "this is very important to {0}", "Steve");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement to have attribute \"alt\" because this is very important to Steve, but found <null>.");
.And.Message.Should().Be("Expected IElement to have attribute \"alt\" because this is very important to Steve, but found <null>.");
}

[Fact]
public void ThrowException_WhenHasAttributeWithWrongValue()
{
Expand All @@ -51,9 +54,9 @@
.Should().HaveAltText("Logo");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\", but found \"Log\".");
.And.Message.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\", but found \"Log\".");
}

[Fact]
public void ThrowException_WhenHasAttributeWithWrongValue_AndShouldIncludeBecauseMessage()
{
Expand All @@ -62,6 +65,6 @@
.Should().HaveAltText("Logo", "this is very important to {0}", "Steve");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\" because this is very important to Steve, but found \"Log\".");
.And.Message.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\" because this is very important to Steve, but found \"Log\".");
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
@using Xunit.Sdk
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

[Fact]
public void Succeed()
{
Render(@<a href="#" aria-label="Home Page">Link</a>)
.AsElement()
.Should().HaveAriaLabel("Home Page");
}

[Fact]
public void ReturnAndConstraint()
{
var andConstraint = Render(@<a href="#" aria-label="Home Page">Link</a>)
.AsElement()
.Should().HaveAriaLabel("Home Page");

andConstraint.Should().BeOfType<AndConstraint<ElementAssertions>>();
var constraintType = andConstraint.GetType();
constraintType.IsGenericType.Should().BeTrue();
constraintType.GetGenericTypeDefinition().Should().Be(typeof(AndConstraint<>));
constraintType.GetGenericArguments()[0].Should().BeSameAs(typeof(ElementAssertions));
}

[Fact]
Expand All @@ -29,9 +32,9 @@
.Should().HaveAriaLabel("Home Page");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement to have attribute \"aria-label\", but found <null>.");
.And.Message.Should().Be("Expected IElement to have attribute \"aria-label\", but found <null>.");
}

[Fact]
public void ThrowException_WhenDoesNotHaveAttribute_AndShouldIncludeBecauseMessage()
{
Expand All @@ -40,9 +43,9 @@
.Should().HaveAriaLabel("Home Page", "this is very important to {0}", "Steve");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement to have attribute \"aria-label\" because this is very important to Steve, but found <null>.");
.And.Message.Should().Be("Expected IElement to have attribute \"aria-label\" because this is very important to Steve, but found <null>.");
}

[Fact]
public void ThrowException_WhenHasAttributeWithWrongValue()
{
Expand All @@ -51,9 +54,9 @@
.Should().HaveAriaLabel("Home Page");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement \"aria-label\" attribute to have value \"Home Page\", but found \"Home\".");
.And.Message.Should().Be("Expected IElement \"aria-label\" attribute to have value \"Home Page\", but found \"Home\".");
}

[Fact]
public void ThrowException_WhenHasAttributeWithWrongValue_AndShouldIncludeBecauseMessage()
{
Expand All @@ -62,6 +65,6 @@
.Should().HaveAriaLabel("Home Page", "this is very important to {0}", "Steve");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement \"aria-label\" attribute to have value \"Home Page\" because this is very important to Steve, but found \"Home\".");
.And.Message.Should().Be("Expected IElement \"aria-label\" attribute to have value \"Home Page\" because this is very important to Steve, but found \"Home\".");
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
@using Xunit.Sdk
@inherits Bunit.TestContext
@inherits Bunit.BunitContext

@code {

[Fact]
public void Succeed()
{
Render(@<img src="/logo.png" alt="Logo">)
.AsElement()
.Should().HaveAttribute("alt", "Logo");
}

[Fact]
public void ReturnAndConstraint()
{
var andConstraint = Render(@<img src="/logo.png" alt="Logo">)
.AsElement()
.Should().HaveAttribute("alt", "Logo");

andConstraint.Should().BeOfType<AndConstraint<ElementAssertions>>();
var constraintType = andConstraint.GetType();
constraintType.IsGenericType.Should().BeTrue();
constraintType.GetGenericTypeDefinition().Should().Be(typeof(AndConstraint<>));
constraintType.GetGenericArguments()[0].Should().BeSameAs(typeof(ElementAssertions));
}

[Fact]
Expand All @@ -29,9 +32,9 @@
.Should().HaveAttribute("alt", "Logo");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement to have attribute \"alt\", but found <null>.");
.And.Message.Should().Be("Expected IElement to have attribute \"alt\", but found <null>.");
}

[Fact]
public void ThrowException_WhenDoesNotHaveAttribute_AndShouldIncludeBecauseMessage()
{
Expand All @@ -40,9 +43,9 @@
.Should().HaveAttribute("alt", "Logo", "this is very important to {0}", "Steve");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement to have attribute \"alt\" because this is very important to Steve, but found <null>.");
.And.Message.Should().Be("Expected IElement to have attribute \"alt\" because this is very important to Steve, but found <null>.");
}

[Fact]
public void ThrowException_WhenHasAttributeWithWrongValue()
{
Expand All @@ -51,9 +54,9 @@
.Should().HaveAttribute("alt", "Logo");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\", but found \"Log\".");
.And.Message.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\", but found \"Log\".");
}

[Fact]
public void ThrowException_WhenHasAttributeWithWrongValue_AndShouldIncludeBecauseMessage()
{
Expand All @@ -62,6 +65,6 @@
.Should().HaveAttribute("alt", "Logo", "this is very important to {0}", "Steve");

aut.Should().Throw<XunitException>()
.And.UserMessage.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\" because this is very important to Steve, but found \"Log\".");
.And.Message.Should().Be("Expected IElement \"alt\" attribute to have value \"Logo\" because this is very important to Steve, but found \"Log\".");
}
}
Loading