Skip to content

Commit

Permalink
Added new test to complete code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lg2de committed Aug 9, 2022
1 parent 965ce1d commit 6d4019b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using FluentAssertions.Execution;
using FluentAssertions.Extensions;
#if NETFRAMEWORK
using FluentAssertions.Specs.Common;
Expand Down Expand Up @@ -31,6 +32,26 @@ await testAction.Should().ThrowAsync<XunitException>()
.WithMessage("*because we want to test the failure message*found <null>*");
}

[Fact]
public async Task When_subject_is_null_with_AssertionScope_it_should_fail()
{
// Arrange
var timeSpan = 0.Milliseconds();
Func<Task<int>> action = null;

// Act
Func<Task> testAction = () =>
{
using var _ = new AssertionScope();
return action.Should().CompleteWithinAsync(
timeSpan, "because we want to test the failure {0}", "message");
};

// Assert
await testAction.Should().ThrowAsync<XunitException>()
.WithMessage("*because we want to test the failure message*found <null>*");
}

[Fact]
public async Task When_task_completes_fast_it_should_succeed()
{
Expand Down

0 comments on commit 6d4019b

Please sign in to comment.