Exemple #1
0
        public void ShouldReturnLocationViewModelsFromLocation()
        {
            var locations = new List <Location>
            {
                new Location {
                    Name = "Location1", GeoPoint = new GeoPoint {
                        Latitude = 0.1d, Longitude = 0.2d
                    }
                }
            };

            _locationSearchService.Setup(x => x.FindLocation("Location1")).Returns(locations);

            var searchProvider = new SearchProvider(_locationSearchService.Object,
                                                    _apprenticeshipSearchService.Object,
                                                    _traineeshipSearchService.Object,
                                                    _addressSearchService.Object,
                                                    _apprenticeshipMapper,
                                                    _traineeeshipMapper,
                                                    _logService.Object);

            var results = searchProvider.FindLocation("Location1");
            var result  = results.Locations.First();

            result.Should().NotBeNull();
            result.Latitude.Should().Be(0.1d);
            result.Longitude.Should().Be(0.2d);
        }
        public void ShouldReturnLocationViewModelsFromNullLocation()
        {
            _locationSearchService.Setup(x => x.FindLocation(It.IsAny <string>()))
            .Returns(default(IEnumerable <Location>));

            var searchProvider = new SearchProvider(_locationSearchService.Object,
                                                    _apprenticeshipMapper,
                                                    _logService.Object);

            var results = searchProvider.FindLocation(string.Empty);

            results.Locations.Should().BeEmpty();
        }