public async Task EMailTypeER_TestGetNewEMailTypeER()
        {
            var eMailType = await EMailTypeER.NewEMailTypeER();

            Assert.NotNull(eMailType);
            Assert.False(eMailType.IsValid);
        }
        public async Task EMailTypeER_TestInvalidSaveEMailTypeER()
        {
            var eMailType = await EMailTypeER.NewEMailTypeER();

            eMailType.Description = String.Empty;
            EMailTypeER savedEMailType = null;

            Assert.False(eMailType.IsValid);
            Assert.Throws <Csla.Rules.ValidationException>(() => savedEMailType = eMailType.Save());
        }
        public async Task EMailTypeER_TestInsertNewEMailTypeER()
        {
            var eMailType = await EMailTypeER.NewEMailTypeER();

            eMailType.Description = "Standby";
            eMailType.Notes       = "This person is on standby";

            var savedEMailType = await eMailType.SaveAsync();

            Assert.NotNull(savedEMailType);
            Assert.IsType <EMailTypeER>(savedEMailType);
            Assert.True(savedEMailType.Id > 0);
        }
        public async Task EMailTypeER_TestDescriptionRequired()
        {
            var eMailType = await EMailTypeER.NewEMailTypeER();

            eMailType.Description = "make valid";
            var isObjectValidInit = eMailType.IsValid;

            eMailType.Description = string.Empty;

            Assert.NotNull(eMailType);
            Assert.True(isObjectValidInit);
            Assert.False(eMailType.IsValid);
            Assert.Equal("Description", eMailType.BrokenRulesCollection[0].Property);
            Assert.Equal("Description required", eMailType.BrokenRulesCollection[0].Description);
        }
        public async Task EMailTypeER_TestDescriptionExceedsMaxLengthOf50()
        {
            var eMailType = await EMailTypeER.NewEMailTypeER();

            eMailType.Description = "valid length";
            Assert.True(eMailType.IsValid);

            eMailType.Description = "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.False(eMailType.IsValid);
            Assert.Equal("Description", eMailType.BrokenRulesCollection[0].Property);
            Assert.Equal("Description can not exceed 50 characters", eMailType.BrokenRulesCollection[0].Description);
        }