public void ScheduleActionReturnsValidViewModel() { // Arrange mockServiceTicketRepo.FindIncluding(Arg.Any <int>(), Arg.Any <Expression <Func <ServiceTicket, object> >[]>()).Returns(new ServiceTicket { ID = 1 }); mockEmployeeRepo.Find(Arg.Any <int>()).Returns(new Employee { ID = 1 }); var scheduleItems = new List <ScheduleItem>(); scheduleItems.Add(new ScheduleItem { ID = 1, }); mockScheduleItemRepo.AllIncluding().Returns(scheduleItems.AsQueryable <ScheduleItem>()); // Act var result = (ViewResult)controller.Schedule(1, 1, 0); // Assert var model = result.ViewData.Model as ScheduleViewModel; Assert.NotNull(model.Employee); Assert.NotNull(model.ScheduleItems); Assert.NotNull(model.ServiceTicket); controller.ViewBag.StartTime = 0; }