Skip to content

Commit

Permalink
Remove some mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
eNeRGy164 committed Mar 13, 2022
1 parent e52a7d2 commit c4855f5
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 3 deletions.
@@ -0,0 +1,69 @@
using FluentAssertions.Execution;
using Xunit;

namespace FluentAssertions.Specs.Execution
{
/// <content>
/// The chaining API specs.
/// </content>
public partial class AssertionScopeSpecs
{
[Fact]
public void Get_value_when_key_is_present()
{
// Arrange
var scope = new AssertionScope();
scope.AddNonReportable("SomeKey", "SomeValue");
scope.AddNonReportable("SomeOtherKey", "SomeOtherValue");

// Act
var value = scope.Get<string>("SomeKey");

// Assert
value.Should().Be("SomeValue");
}

[Fact]
public void Get_default_value_when_key_is_not_present()
{
// Arrange
var scope = new AssertionScope();

// Act
var value = scope.Get<int>("SomeKey");

// Assert
value.Should().Be(0);
}

[Fact]
public void Get_default_value_when_nullable_value_is_null()
{
// Arrange
var scope = new AssertionScope();
#pragma warning disable IDE0004 // Remove Unnecessary Cast
scope.AddNonReportable("SomeKey", (int?)null);
#pragma warning restore IDE0004 // Remove Unnecessary Cast

// Act
var value = scope.Get<int>("SomeKey");

// Assert
value.Should().Be(0);
}

[Fact]
public void Value_should_be_of_requested_type()
{
// Arrange
var scope = new AssertionScope();
scope.AddNonReportable("SomeKey", "SomeValue");

// Act
var value = scope.Get<string>("SomeKey");

// Assert
value.Should().BeOfType<string>();
}
}
}
Expand Up @@ -336,11 +336,14 @@ public void Message_should_have_named_placeholder_be_replaced_by_nonreportable_v
var scope = new AssertionScope();
scope.AddNonReportable("SomeKey", "SomeValue");

AssertionScope.Current.FailWith("{SomeKey}");

// Act
var value = scope.Get<string>("SomeKey");
Action act = scope.Dispose;

// Assert
value.Should().Be("SomeValue");
act.Should().ThrowExactly<XunitException>()
.WithMessage("SomeValue");
}

[Fact]
Expand Down Expand Up @@ -385,7 +388,7 @@ public void Message_should_have_named_placeholder_be_replaced_by_defered_reporta

// Assert
act.Should().ThrowExactly<XunitException>()
.WithMessage("MyValue*");
.WithMessage("MyValue*\n\nWith MyKey:\nMyValue\n");
deferredValueInvoked.Should().BeTrue();
}

Expand Down

0 comments on commit c4855f5

Please sign in to comment.