public void PostReturnsDocument() { //Arrange var moq = new Mock <IDocumentsRepository>(); moq.Setup(m => m.Post(It.IsAny <Document>())).Returns <Document>(d => Task.FromResult(d)); DocumentsController controller = new DocumentsController(moq.Object); //Act var result = (controller.Post(new Document()).Result as OkObjectResult).Value; //Assert Assert.IsInstanceOfType(result, typeof(Document)); }