Questions tagged [fluent-assertions]

Fluent Assertions is a set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test and which tries to keep you out of the debugger hell. Targets .NET Framework 4.5 and 4.7, as well as .NET Core 2.0, .NET Core 3.0, .NET Standard 1.3, 1.6 and 2.0. Supports the unit test frameworks MSTest, MSTest2, Gallio, NUnit, XUnit, MBUnit, MSpec, and NSpec.

Fluent Assertions is a library with extension methods to be used for assertions in your unit tests. The main goals of Fluent Assertions are to keep your unit tests readable, and to give descriptive error messages in case of failing tests.

Resources

394 questions
-2
votes
3 answers

Is it possible to test a function that only writes a line to the console?

Would it be possible to test a function with returns void and only writes a line to the console like the following using FluentAssertion? static void WriteLine() { Console.WriteLine("It works!"); }
Rogerio Schmitt
  • 1,055
  • 1
  • 15
  • 35
-3
votes
1 answer

How to throw exceptions using fluentassertions in foreach loop in C#

I am running a foreach loop for a dictionary and using ShouldThrow to throw exceptions on test failure. But the loop is exiting on the first failure. Is there a way to postpone the actual violations and throw them as a single exception?
sirisha
  • 11
  • 2
-4
votes
1 answer

fluentassertions C# I Don't understand Should().NotBeNull()

I have read through fluentassertions.com and still confused as to what happens if a var is null or not null. so for instance if you have object someitem = null; then have someitem.Should().NotBeNull(); what happens if it is null? this example…
scripter78
  • 1,117
  • 3
  • 22
  • 50
1 2 3
26
27