public void WhenGettingJsonList_ThenJsonRemindersViewModelReturned() { var vehicles = new[] { new VehicleModel(new Vehicle { VehicleId = defaultVehicleId }, new VehicleStatisticsModel()) }; var reminders = new[] { new Reminder { ReminderId = 1, Title = "test reminder" }, new Reminder { ReminderId = 2 } }; MockHandlerFor( () => new Mock <GetUnfulfilledRemindersForVehicle>(null), x => x .Setup(h => h.Execute(_defaultUser.UserId, defaultVehicleId, 0)) .Returns(reminders)); MockHandlerFor( () => new Mock <GetVehicleListForUser>(null), x => x .Setup(h => h.Execute(_defaultUser.UserId)) .Returns(vehicles)); ReminderController controller = GetTestableReminderController(); JsonResult result = controller.JsonList(defaultVehicleId); JsonResult jsonResult = result; Assert.NotNull(jsonResult); var data = jsonResult.Data as JsonRemindersViewModel; Assert.NotNull(data); Assert.NotNull(data.Reminders); Assert.Equal(reminders.Count(), data.Reminders.Count); Assert.Equal("test reminder", data.Reminders[0].Title); }