public void CreateTextDocument() { var textDocumentModel = new TextDocumentModel { Id = "1", Text = "Test1", Name = "Test2" }; var textDocument = new TextDocument { Id = "1", Text = "Test1", Name = "Test2", Owner = new ApplicationUser { Id = "1" } }; var documentService = new Mock <IDocumentService>(); documentService .Setup(service => service.CreateDocument(textDocumentModel)) .Returns(textDocument); var controller = new DocumentsController(documentService.Object); var result = controller.CreateTextDocument(textDocumentModel); Assert.Equal("GetTextDocument", result.ActionName); Assert.Equal(RouteValueDictionary.FromArray(new[] { new KeyValuePair <string, object>("id", "1") }), result.RouteValues); Assert.Equal(textDocument, result.Value); }