Ejemplo n.º 1
0
            public void WhenCalled_ThenReturnValueFormatted()
            {
                var sut = new UkPostcode("A99AA");

                var result = sut.ToString();

                Assert.That(result, Is.EqualTo(sut.ValueFormatted));
            }
Ejemplo n.º 2
0
 public void WhenInvalidSevenCharFormat_ThenThrowException(string postCode)
 {
     Assert.Throws <ArgumentException>(() => _ = new UkPostcode(postCode));
 }
Ejemplo n.º 3
0
            public void WhenValidFormat_ThenSetValue(string postCode, string expected)
            {
                var sut = new UkPostcode(postCode);

                Assert.That(sut.Value, Is.EqualTo(expected));
            }
Ejemplo n.º 4
0
            public void WhenCaseIsLower_ThenSetValueToUpper()
            {
                var sut = new UkPostcode("a99aa");

                Assert.That(sut.Value, Is.EqualTo("A99AA"));
            }
Ejemplo n.º 5
0
 public void WhenLengthMoreThanSevenChars_ThenThrowException()
 {
     Assert.Throws <ArgumentException>(() => _ = new UkPostcode("AA9A9AAA"));
 }
Ejemplo n.º 6
0
 public void WhenLengthLessThanFiveChars_ThenThrowException()
 {
     Assert.Throws <ArgumentException>(() => _ = new UkPostcode("A99A"));
 }
Ejemplo n.º 7
0
 public void WhenIsEmpty_ThenThrowException()
 {
     Assert.Throws <ArgumentException>(() => _ = new UkPostcode(string.Empty));
 }
Ejemplo n.º 8
0
            public void WhenValidFormat_ThenReturnUnit(string postCode, string expected)
            {
                var sut = new UkPostcode(postCode);

                Assert.That(sut.Unit, Is.EqualTo(expected));
            }
Ejemplo n.º 9
0
            public void WhenHasWhiteSpace_ThenTrimWhiteSpace()
            {
                var sut = new UkPostcode("  A9 9AA      ");

                Assert.That(sut.Value, Is.EqualTo("A99AA"));
            }
Ejemplo n.º 10
0
 public void WhenIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new UkPostcode(null));
 }
Ejemplo n.º 11
0
            public void WhenHasNoFormatting_ThenReturnFormatted()
            {
                var sut = new UkPostcode("A99AA");

                Assert.That(sut.ValueFormatted, Is.EqualTo("A9 9AA"));
            }