public void ShouldReturnEmployeesDelegations() { var delegations = new List <Delegation>() { SetDelegation(), SetDelegation(), SetDelegation() }; var emp = new Employee() { Id = 1, Delegations = delegations }; var config = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = config.CreateMapper(); var delRepo = new Mock <IDelegationRepository>(); delRepo.Setup(d => d.GetDelegationsByEmployee(1)).Returns(emp.Delegations.AsQueryable()); var vehRepo = new Mock <IVehicleRepository>(); var empRepo = new Mock <IEmployeeRepository>(); var delServ = new DelegationService(delRepo.Object, empRepo.Object, vehRepo.Object, mapper); var resultList = delServ.GetDelegationsByEmployee(1); resultList.Should().BeOfType(typeof(ListDelegationForListVm)); resultList.Should().NotBeNull(); resultList.Count.Should().Be(3); resultList.Delegations.Should().AllBeOfType(typeof(DelegationForListVm)); resultList.Delegations.Should().HaveCount(3); }