public void Init() { _placeRepository = Substitute.For <IPlaceRepository>(); _placeRepository.GetAll().Returns(RoutePlaceMockHelper.CreateMockPlaces()); _queryHandler = new PlaceQueryHandler(_placeRepository); }
public void Init() { _routeRepository = Substitute.For <IRouteRepository>(); _routeRepository.GetAll().Returns(RoutePlaceMockHelper.CreateMockRoutes()); _routeRepository.GetById(Arg.Any <string>()) .Returns(new Route() { Id = "MockId", DestinationId = "abc", Destination = new Place { Id = "abc", Name = "Traralgon" }, OriginId = "efg", Origin = new Place { Id = "efg", Name = "Southern Cross" }, DepartUtc = new DateTime(2018, 12, 1, 14, 15, 00).ToUniversalTime() }); _queryHandler = new RouteQueryHandler(_routeRepository); }
public async Task DispatchRoutesQuery_ReturnAllRoutes() { // Act var result = await _queryHandler.Handle(new PlacesQuery(), new CancellationToken()); var mocksPlaces = RoutePlaceMockHelper.CreateMockPlaces(); // Assert Assert.AreEqual(result.Count, mocksPlaces.Count); }