public void ShouldReturnRoute() { var route = new Route { Id = 1, CreatedDateTime = DateTime.Now, DelegationId = 1, RouteTypeId = 1, TypeOfTransportId = 1, RouteDetail = new RouteDetail() { Id = 1, RouteRef = 1, VehicleId = 2, StartDate = DateTime.Now, EndDate = DateTime.Now, StartPoint = "start", EndPoint = "end", Kilometers = 35 } }; var config = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = config.CreateMapper(); var delRepo = new Mock <IDelegationRepository>(); delRepo.Setup(d => d.GetRouteById(1)).Returns(route); var vehRepo = new Mock <IVehicleRepository>(); var empRepo = new Mock <IEmployeeRepository>(); var delServ = new DelegationService(delRepo.Object, empRepo.Object, vehRepo.Object, mapper); var routeResult = delServ.GetRouteById(1); routeResult.Should().BeOfType(typeof(Route)); routeResult.Should().NotBeNull(); routeResult.Should().BeSameAs(route); }