예제 #1
0
        public async Task TestEMailER_New()
        {
            var eMail = await EMailER.NewEMailER();

            Assert.NotNull(eMail);
            Assert.False(eMail.IsValid);
        }
예제 #2
0
        public async Task TestEMailER_TestInvalidSave()
        {
            var eMail = await EMailER.NewEMailER();

            await BuildEMail(eMail);

            eMail.EMailAddress = string.Empty;

            Assert.False(eMail.IsValid);
            await Assert.ThrowsAsync <ValidationException>(() => eMail.SaveAsync());
        }
예제 #3
0
        public async void TestEMailER_Insert()
        {
            var eMail = await EMailER.NewEMailER();

            await BuildEMail(eMail);

            var savedEMail = await eMail.SaveAsync();

            Assert.NotNull(savedEMail);
            Assert.IsType <EMailER>(savedEMail);
            Assert.True(savedEMail.Id > 0);
        }
예제 #4
0
        public async Task TestEMailER_LastUpdatedByRequired()
        {
            var eMailType = await EMailER.NewEMailER();

            await BuildEMail(eMailType);

            var isObjectValidInit = eMailType.IsValid;

            eMailType.LastUpdatedBy = string.Empty;

            Assert.NotNull(eMailType);
            Assert.True(isObjectValidInit);
            Assert.False(eMailType.IsValid);
            Assert.Equal("LastUpdatedBy", eMailType.BrokenRulesCollection[0].Property);
            Assert.Equal("LastUpdatedBy required", eMailType.BrokenRulesCollection[0].Description);
        }
예제 #5
0
        public async Task TestEMailER_EMailAddressRequired()
        {
            var eMail = await EMailER.NewEMailER();

            await BuildEMail(eMail);

            var isObjectValidInit = eMail.IsValid;

            eMail.EMailAddress = string.Empty;

            Assert.NotNull(eMail);
            Assert.True(isObjectValidInit);
            Assert.False(eMail.IsValid);
            Assert.Equal("EMailAddress", eMail.BrokenRulesCollection[0].Property);
            Assert.Equal("EMailAddress required", eMail.BrokenRulesCollection[0].Description);
        }
예제 #6
0
        public async Task TestEMailER_EMailAddressMaxLengthLessThan255()
        {
            var eMailType = await EMailER.NewEMailER();

            await BuildEMail(eMailType);

            var isObjectValidInit = eMailType.IsValid;

            eMailType.EMailAddress = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " +
                                     "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " +
                                     "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " +
                                     "Duis aute irure dolor in reprehenderit";

            Assert.NotNull(eMailType);
            Assert.True(isObjectValidInit);
            Assert.False(eMailType.IsValid);
            Assert.Equal("EMailAddress", eMailType.BrokenRulesCollection[0].Property);
            Assert.Equal("EMailAddress can not exceed 255 characters", eMailType.BrokenRulesCollection[0].Description);
        }