Skip to content

Commit

Permalink
Changed unit test location and name.
Browse files Browse the repository at this point in the history
  • Loading branch information
MullerWasHere committed Jan 10, 2022
1 parent ede88d0 commit cde578c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 16 additions & 0 deletions Tests/FluentAssertions.Specs/Execution/CallerIdentifierSpecs.cs
Expand Up @@ -452,6 +452,22 @@ public void When_the_method_has_Should_prefix_it_should_read_whole_method()
act.Should().Throw<XunitException>()
.WithMessage("Expected foo.ShouldReturnSomeBool() to be false*");
}

[UIFact]
public async Task Caller_identification_should_also_work_for_statements_following_async_code()
{
// Arrange
const string someText = "Hello";
Func<Task> task = async () => await Task.Yield();

// Act
await task.Should().NotThrowAsync();
Action act = () => someText.Should().Be("Hi");

// Assert
act.Should().Throw<XunitException>()
.WithMessage("*someText*", "it should capture the variable name");
}
}

[SuppressMessage("The name of a C# element does not begin with an upper-case letter", "SA1300")]
Expand Down
16 changes: 0 additions & 16 deletions Tests/FluentAssertions.Specs/Specialized/TaskAssertionSpecs.cs
Expand Up @@ -143,21 +143,5 @@ async Task CheckContextAsync()
SynchronizationContext.Current.Should().NotBeNull();
}
}

[UIFact]
public async Task When_resolving_async_to_main_thread_variable_name_used_for_assertion_should_be_detected()
{
// Arrange
const string someText = "Hello";
Func<Task> task = async () => await Task.Yield();

// Act
await task.Should().NotThrowAsync();
Action act = () => someText.Should().Be("Hi");

// Assert
act.Should().Throw<XunitException>()
.WithMessage("*someText*", "it should capture the variable name");
}
}
}

0 comments on commit cde578c

Please sign in to comment.