Esempio n. 1
0
        public async Task GetLocationByIdAsync_WithLocationIdExists_ReturnLocationResponse()
        {
            // Arrange
            var locationId = new Guid("CFB31112-C780-4535-815A-BB0C93EDD249");

            var location = new Location
            {
                Id         = locationId,
                VehicleId  = 1,
                Latitude   = 13.788571,
                Longitude  = 100.538034,
                UpdateDate = new DateTime(2020, 3, 1)
            };

            locationsRepository.GetLocationByIdAsync(Arg.Any <Guid>()).Returns(Task.FromResult(location));

            // Act
            var response = await locationsService.GetLocationByIdAsync(locationId);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <LocationResponse>(response);
            Assert.Equal(1, response.VehicleId);
            Assert.Equal(13.788571, response.Latitude);
            Assert.Equal(100.538034, response.Longitude);
        }