public void GetAllPersonsByEmployerAndDayAndHour_ReturnsAllPersonsByEmployerAndDayAndHourFromService() { // Arrange var person = new PersonBuilder().WithId(1).Build(); var employer = new EmployerBuilder().WithId(1).Build(); var contracts = new List <Contract> { new ContractBuilder().WithId(1).WithPerson(person).WithEmployer(employer).Build(), }; var personWorkshiftRegistrationsViewModels = new List <PersonWorkshiftRegistrationsViewModel> { new PersonWorkshiftRegistrationsViewModelBuilder().WithId(1).WithName(person.FirstName + " " + person.LastName) .Build(), }; _contractServiceMock.Setup(c => c.GetAllContractsByDayAndHour(It.IsAny <long>(), It.IsAny <DateTime>())) .ReturnsAsync(contracts); _mapperMock.Setup(m => m.Map <List <PersonWorkshiftRegistrationsViewModel> >(contracts)) .Returns(personWorkshiftRegistrationsViewModels); // Act var okResult = _controller.GetAllWorkshiftsByEmployerAndDayAndHour(1, DateTime.MinValue).Result as OkObjectResult; // Assert Assert.That(okResult, Is.Not.Null); Assert.That(okResult.Value, Is.EqualTo(personWorkshiftRegistrationsViewModels)); _mapperMock.Verify(m => m.Map <List <PersonWorkshiftRegistrationsViewModel> >(contracts), Times.Once); }