Пример #1
0
        public void Slash_Shows_Todo_List()
        {
            // Arrange
            TasksController controller = new TasksController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Tasks", result.ViewBag.Title);
        }
Пример #2
0
        public void Slash_Tasks_Displays_Task()
        {
            // Arrange
            FakeTasksRepository repository = new FakeTasksRepository();
            repository.Save(new Task() { Description = "Description1" });
            TasksController controller = new TasksController(repository);

            // Act
            ViewResult result = controller.Index() as ViewResult;
            Task task = ((List<Task>)result.Model).Single(x => x.Description == "Description1") as Task;

            // Assert
            Assert.AreEqual("Description1", task.Description);
        }