Esempio n. 1
0
        public void ToEmail_Internal_CheckFormatExceptions()
        {
            // Arrange
            var inputMail = new ecn.communicator.mvc.Models.Email();

            inputMail.Birthdate      = SampleDummy;
            inputMail.UserEvent1Date = SampleDummy;
            inputMail.UserEvent2Date = SampleDummy;
            var inputUser = new KMPlatform.Entity.User();

            ShimEmail.GetByEmailIDInt32User = (p1, p2) => new Email();

            // Act
            try
            {
                var internalEmail = ConversionMethods.ToEmail_Internal(inputMail, inputUser);

                // Assert
                internalEmail.ShouldBeNull();
            }
            catch (ECNException ex)
            {
                ex.ErrorList.ShouldNotBeNull();
                ex.ErrorList.Count.ShouldBe(4);
                ex.ErrorList[0].ErrorMessage.ShouldBe(ExceptionMessageFormatBirthdate);
                ex.ErrorList[1].ErrorMessage.ShouldBe(ExceptionMessageFormatUserEvent1Date);
                ex.ErrorList[2].ErrorMessage.ShouldBe(ExceptionMessageFormatUserEvent2Date);
                ex.ErrorList[3].ErrorMessage.ShouldBe(ExceptionMessageEmailRequired);
            }
        }
Esempio n. 2
0
        public void ToEmail_Internal_CheckOneToOne_NoException()
        {
            // Arrange
            var inputMail = CreateSampleEmail();
            var inputUser = new KMPlatform.Entity.User();

            ShimEmail.GetByEmailIDInt32User = (p1, p2) => new Email();

            // Act
            var internalEmail = ConversionMethods.ToEmail_Internal(inputMail, inputUser);

            // Assert
            internalEmail.ShouldNotBeNull();
            CheckInternalEmail(internalEmail);
        }
Esempio n. 3
0
        public void ToEmail_Internal_CheckEmptyMail_NoException()
        {
            // Arrange
            var inputMail = new ecn.communicator.mvc.Models.Email();

            inputMail.EmailAddress = SampleEmailAddress;
            inputMail.EmailID      = SampleEmailId;
            var inputUser = new KMPlatform.Entity.User();

            ShimEmail.GetByEmailIDInt32User = (p1, p2) => new Email();

            // Act
            var internalEmail = ConversionMethods.ToEmail_Internal(inputMail, inputUser);

            // Assert
            internalEmail.ShouldNotBeNull();
        }