public async Task Details_ReturnsViewResult_WhenGuidIsValid() { TodoItem todo = new TodoItem(); todo.File = new FileInfo(); todo.File.Path = "/fake/path/fake_file.txt"; this._todoItemServiceMock .Setup(service => service.GetItemAsync(It.IsAny <Guid>())) .ReturnsAsync(todo); var result = await _todosController.Details(Guid.NewGuid()); var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal("fake_file.txt", viewResult.ViewData["Filename"]); }
public void TestDetailsView() { var controller = new TodosController(); var result = controller.Details(1) as ViewResult; var thisTodo = (Todo)result.ViewData.Model; Assert.AreEqual(1, thisTodo.ID); // Trace.WriteLine(result); }