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 706f7a1 commit 4442765
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 3 deletions.
@@ -0,0 +1,66 @@
using System;
using FluentAssertions.Execution;
using Xunit;
using Xunit.Sdk;

namespace FluentAssertions.Specs.Execution
{
public class ContextDataSpecs
{
[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();
scope.AddNonReportable("SomeKey", (int?)null);

// 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 @@ -333,11 +333,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 @@ -382,7 +385,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 4442765

Please sign in to comment.