Exemple #1
0
        public async Task GetLocationByVehicleIdAndPeriodTimeAsync_WithFilterRequest_ReturnLocationResponse()
        {
            // Arrange
            var locationFilter = new LocationFilterRequest
            {
                VehicleId = 1,
                StartDate = new DateTime(2020, 3, 1),
                EndDate   = new DateTime(2020, 3, 2)
            };

            var locations = new List <Location>
            {
                new Location
                {
                    Id         = Guid.NewGuid(),
                    VehicleId  = 1,
                    Latitude   = 13.788571,
                    Longitude  = 100.538034,
                    UpdateDate = new DateTime(2020, 3, 1)
                }
            };

            locationsRepository
            .GetLocationByVehicleIdAndPeriodTimeAsync(Arg.Any <int>(), Arg.Any <DateTime>(), Arg.Any <DateTime>())
            .Returns(Task.FromResult(locations));

            // Act
            var response = await locationsService.GetLocationByVehicleIdAndPeriodTimeAsync(locationFilter);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <List <LocationResponse> >(response);
        }