public void IsValid_given_invalid_code_returns_true(string code)
        {
            var val = new PostalCodeValidator();

            var actual = val.IsValid(code);

            Assert.False(actual);
        }
        public void IsValid_given_2000_returns_true()
        {
            // Arrange
            var postalCode = "2000";

            // Act
            var valid = PostalCodeValidator.IsValid(postalCode);

            // Assert
            Assert.True(valid);
        }
        public void IsValid_given_2000foo_returns_false()
        {
            // Arrange
            var postalCode = "2000foo";

            // Act
            var valid = PostalCodeValidator.IsValid(postalCode);

            // Assert
            Assert.False(valid);
        }
示例#4
0
        public void IsValid()
        {
            var v = new PostalCodeValidator();

            Assert.IsTrue(v.IsValid("12-345", null));
            Assert.IsTrue(v.IsValid(null, null));
            Assert.IsTrue(v.IsValid(string.Empty, null));

            Assert.IsFalse(v.IsValid("12 -345", null));
            Assert.IsFalse(v.IsValid("12345", null));
            Assert.IsFalse(v.IsValid(" 12-345", null));
            Assert.IsFalse(v.IsValid("12-345 ", null));
        }
示例#5
0
        public void IsValid_given_2000_returns_true()
        {
            var valid = PostalCodeValidator.IsValid("2000");

            Assert.True(valid);
        }
示例#6
0
        public void IsValid_given_100_Tórshavn_returns_true()
        {
            var valid = PostalCodeValidator.IsValid("100");

            Assert.True(valid);
        }
示例#7
0
        public void IsValid_given_2000x_returns_false()
        {
            var valid = PostalCodeValidator.IsValid("2000x");

            Assert.False(valid);
        }
示例#8
0
        public void IsValid_given_2000_returns_true()
        {
            var actual = PostalCodeValidator.IsValid("2000");

            Assert.True(actual);
        }
        public void IsValid_given_postalCode_returns_expected(string postalCode, bool expected)
        {
            var valid = PostalCodeValidator.IsValid(postalCode);

            Assert.Equal(expected, valid);
        }