Beispiel #1
0
 private static void GuardAgainstInvalidNationalCode(HeadMasterNationalCode nationalCode)
 {
     if (string.IsNullOrEmpty(nationalCode.Value))
     {
         throw new NullReferenceException();
     }
 }
Beispiel #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_NationalCode_Is_Invalid(string value)
        {
            //Arrange
            var nationalCode      = new HeadMasterNationalCode(value);
            var headMasterBuilder = _aHeadMaster.With(nationalCode);

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

            //Assert
            headMaster.Should().ThrowExactly <NullReferenceException>();
        }
Beispiel #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(HeadMasterNationalCode nationalCode)
 {
     NationalCode = nationalCode;
     return(this);
 }