Skip to content

Instantly share code, notes, and snippets.

@osmyn
Created November 8, 2018 16:46
Show Gist options
  • Save osmyn/a7abc97ff49a347caf8e649297793552 to your computer and use it in GitHub Desktop.
Save osmyn/a7abc97ff49a347caf8e649297793552 to your computer and use it in GitHub Desktop.
public Mock<IService> DefaultService()
{
var mock = new Mock<IService>();
mock.Setup(x => x.MyMethod(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Returns<string, string, string>((typeName, comments, updatedBy) => Task.Run(() =>
new MyType
{
TypeName = typeName,
Comments = comments,
UpdatedBy = updatedBy
}));
return mock;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment