As the title suggests really. WriteData will be called for each split CSV item in DataIn. I want to determine that WriteData has been called successfully. By adding a callback and doing an assert against the list is this still a mock verify.
[Test]
public void DataIn_GoodRead_LoggedToFile()
{
Moq.Mock<IFileLogger> mock;
MyLogic logic = SetupLogic(out mock);
List<string> dataLogged = new List<string>();
mock.Setup(x => x.WriteData(It.IsAny<string>()))
.Callback(delegate(string s) { dataLogged.Add(s); });
logic.DataIn(1, "1,2,3");
Assert.AreEqual(3, dataLogged.Count);
}
Not sure why you’re using the callback. It seems that
would do the same.
And I think you could also avoid the setup and just use the verify line so you would only have