示例#1
0
        public void GetByCityState_ValidCityEmptyState_ThrowsArgumentException()
        {
            var locationService = new LocationService(new FakeLocationRepository());

            var argEx = Assert.Throws<ArgumentException>(() => locationService.GetByCityState("San Luis Obispo", string.Empty));
            Assert.True(argEx.Message.StartsWith("State must be non-null"));
        }
示例#2
0
        public void GetByCityState_NullCityValidState_ThrowsArgumentException()
        {
            var locationService = new LocationService(new FakeLocationRepository());

            var argEx = Assert.Throws<ArgumentException>(() => locationService.GetByCityState(null, "ZZ"));
            Assert.True(argEx.Message.StartsWith("City must be non-null"));
        }
示例#3
0
        public void GetByCityState_ValidCityInvalidState_ReturnsEmptyList()
        {
            // Arrange
            var locationService = new LocationService(new FakeLocationRepository());

            // Act
            IEnumerable<Location> nonsenseLocations = locationService.GetByCityState("Sacramento", "BB");

            // Assert
            Assert.True(nonsenseLocations.Count() == 0);
        }
示例#4
0
        public void GetByCityState_ValidCityValidState_ReturnsNonEmptyList()
        {
            // Arrange
            var locationService = new LocationService(new FakeLocationRepository());

            // Act
            IEnumerable<Location> sactoLocations = locationService.GetByCityState("Sacramento", "CA");

            // Assert
            Assert.True(sactoLocations.Count() > 0);
        }