public void ShouldReturnAllDelegations() { var delegations = new List <Delegation>() { SetDelegation(), SetDelegation(), SetDelegation() }; var config = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = config.CreateMapper(); var delRepo = new Mock <IDelegationRepository>(); delRepo.Setup(d => d.GetAllDelegations()).Returns(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.GetAllDelegationsForList(); resultList.Should().BeOfType(typeof(ListDelegationForListVm)); resultList.Should().NotBeNull(); resultList.Count.Should().Be(3); resultList.Delegations.Should().AllBeOfType(typeof(DelegationForListVm)); resultList.Delegations.Should().HaveCount(3); }