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

            // Act
            Location sacto = locationService.GetByZipCode("95814");

            // Assert
            Assert.NotNull(sacto);
        }
示例#2
0
        public void GetByZipCode_WhiteSpaceZipCode_ThrowsArgumentException()
        {
            var locationService = new LocationService(new FakeLocationRepository());

            var argEx = Assert.Throws<ArgumentException>(() => locationService.GetByZipCode("\t "));
            Assert.True(argEx.Message.StartsWith("ZIP Code must be"));
        }
示例#3
0
        public void GetByZipCode_InvalidZipCode_ReturnsNullLocation()
        {
            // Arrange
            var locationService = new LocationService(new FakeLocationRepository());

            // Act
            Location fantasyLand = locationService.GetByZipCode("xzy123");

            // Assert
            Assert.Null(fantasyLand);
        }