public void ShouldReturnRouteTypes() { var types = new List <RouteType>() { new RouteType() { Id = 1, Name = "firstType" }, new RouteType() { Id = 2, Name = "secondType" } }; var config = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = config.CreateMapper(); var delRepo = new Mock <IDelegationRepository>(); delRepo.Setup(d => d.GetAllRouteTypes()).Returns(types.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.GetRouteTypes(); resultList.Should().AllBeOfType(typeof(RouteTypeVm)); resultList.Should().NotBeEmpty(); resultList.Should().HaveCount(2); }