I would like to check if the following method is called with the correct list of errors.
void ShowErrorCollection(string description, List<string> errors);
My configuration of fake it easy looks like this, I am trying to save the given list to a lokal field:
A.CallTo(() => dataPresenter.ShowErrorCollection(A<string>.Ignored, A<List<string>>.Ignored))
.Invokes((string _, List<string> givenErrors) => this.errors = givenErrors);
That does not work. The errors collection is allways null and I don't get the collection. What am I doing wrong?
Edit:
Well it seems to be a bug in my code. I wrote following test and it's green:
[Test]
public void name()
{
var errorHandler = A.Fake<IErrorHandler>();
A.CallTo(() => errorHandler.ShowErrorCollection(A<string>.Ignored, A<List<string>>.Ignored))
.Invokes((string _, List<string> givenErrors) => this.errors = givenErrors);
errorHandler.ShowErrorCollection("bla", new List<string>() {"Hallo"});
this.errors.Should().NotBeEmpty();
this.errors.First().Should().Be("Hallo");
}