Example #1
0
 private static void GuardAgainstNullOrEmptyPhoneNumber(HeadMasterPhoneNumber phoneNumber)
 {
     if (string.IsNullOrEmpty(phoneNumber.Value))
     {
         throw new NullReferenceException();
     }
 }
Example #2
0
 private static void Validate(HeadMasterName name, HeadMasterNationalCode nationalCode,
                              HeadMasterPhoneNumber phoneNumber, HeadMasterEmail email)
 {
     GuardAgainstInvalidName(name);
     GuardAgainstInvalidNationalCode(nationalCode);
     GuardAgainstNullOrEmptyPhoneNumber(phoneNumber);
     GuardAgainsNullOrEmptyEmail(email);
 }
        public void Constructor_Should_Throw_Exception_When_Email_Is_NullOrEmpty(string value)
        {
            //Arrange
            var phoneNumber       = new HeadMasterPhoneNumber(value);
            var headMasterBuilder = _aHeadMaster.But().With(phoneNumber);

            //Act
            Action headMaster = () => headMasterBuilder.Build();

            //Assert
            headMaster.Should().ThrowExactly <NullReferenceException>();
        }
Example #4
0
        public HeadMaster(long id, HeadMasterName name, HeadMasterNationalCode nationalCode,
                          HeadMasterPhoneNumber phoneNumber,
                          HeadMasterEmail email,
                          string degree,
                          string major) : base(id)
        {
            Validate(name, nationalCode, phoneNumber, email);

            Name         = name;
            NationalCode = nationalCode;
            PhoneNumber  = phoneNumber;
            Email        = email;
            Degree       = degree;
            Major        = major;
        }
 public HeadMasterTestBuilder With(HeadMasterPhoneNumber phoneNumber)
 {
     PhoneNumber = phoneNumber;
     return(this);
 }