Let's say you have a Save method, and you are unit testing it, and you want to get the "entity" that is getting passed in as a parameter to use in your test.
You can do this in your unit test:
public voidSave(T entity) { // Save my stuff }
You can do this in your unit test:
FloppyDisk floppyDiskBeingSaved = null; oldSkoolRepo.Setup(r => r.Save(It.IsAny())).Callback (en => {floppyDiskBeingSaved = en;}).Returns(() => Task.FromResult(floppyDiskBeingSaved)); Assert.AreEqual(stuff, floppyDiskBeingSaved);