Using Moq and looked at Callback but I have not been able to find a simple example to understand how to use it.
Do you have a small working snippet whic
Here's an example of using a callback to test an entity sent to a Data Service that handles an insert.
var mock = new Mock();
DataEntity insertedEntity = null;
mock.Setup(x => x.Insert(It.IsAny())).Returns(1)
.Callback((DataEntity de) => insertedEntity = de);
Alternative generic method syntax:
mock.Setup(x => x.Insert(It.IsAny())).Returns(1)
.Callback(de => insertedEntity = de);
Then you can test something like
Assert.AreEqual("test", insertedEntity.Description, "Wrong Description");