What is Dummy used for in FakeItEasy? How does it differ from A.Fake or A.Ignored ?
Thanks :-)
A dummy isn't really used for anything by FakeItEasy itself, it's merely a way to create dummy instances that you can use in your tests.
For example, say that you want to test the following class:
public class Foo
{
public void Bar(DateTime someDate);
}
Now, in one of your tests you want to invoke the bar method but the value that is passed to it is not important to the test, instead of writing:
foo.Bar(new DateTime(2000, 1, 1));
You can write:
foo.Bar(A.Dummy<DateTime>());
This signals that the value is really not important to the test so the whole reason for using it is to communicate intent better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With