예제 #1
0
        public void ValidPhoneValueGeneratesValidObject()
        {
            foreach (var phoneNumber in PhoneValueObjectObjectMother.PhoneNumbers)
            {
                var phoneType = PhoneValueObjectObjectMother.GetRandomPhoneType();
                var vo        = new PhoneValueObject(phoneType, phoneNumber);

                Assert.NotNull(vo);
                Assert.AreEqual(phoneType, vo.PhoneType);
                Assert.AreEqual(phoneNumber, vo.PhoneNumber);
            }
        }
예제 #2
0
 public void InvalidPhoneNumberThrowsException()
 => Assert.Throws <DomainException>(() => new PhoneValueObject(PhoneValueObjectObjectMother.GetRandomPhoneType(), "abc"));
예제 #3
0
 public void EmptyValueThrowsException()
 => Assert.Throws <DomainException>(() => new PhoneValueObject(PhoneValueObjectObjectMother.GetRandomPhoneType(), string.Empty));
예제 #4
0
 public void NullValueThrowsException()
 => Assert.Throws <DomainException>(() => new PhoneValueObject(PhoneValueObjectObjectMother.GetRandomPhoneType(), null));