public async Task TermInOfficeER_TestGetNewTermInOfficeER()
        {
            var termObj = await TermInOfficeER.NewTermInOfficeER();

            Assert.NotNull(termObj);
            Assert.False(termObj.IsValid);
        }
        public async Task TermInOfficeER_TestDeleteObjectFromDatabase()
        {
            const int ID_TO_DELETE = 99;

            await TermInOfficeER.DeleteTermInOfficeER(ID_TO_DELETE);

            await Assert.ThrowsAsync <DataPortalException>(() => TermInOfficeER.GetTermInOfficeER(ID_TO_DELETE));
        }
        public async Task TermInOfficeER_TestGetTermInOffice()
        {
            var termObj = await TermInOfficeER.GetTermInOfficeER(1);

            Assert.NotNull(termObj);
            Assert.IsType <TermInOfficeER>(termObj);
            Assert.Equal(1, termObj.Id);
        }
        public async Task TermInOfficeER_TestInvalidSaveTermInOfficeER()
        {
            var termObj = await TermInOfficeER.NewTermInOfficeER();

            termObj.LastUpdatedBy = String.Empty;

            Assert.False(termObj.IsValid);
            await Assert.ThrowsAsync <Csla.Rules.ValidationException>(() => termObj.SaveAsync());
        }
        public async Task TermInOfficeER_TestUpdateExistingTermInOfficeER()
        {
            var termObj = await TermInOfficeER.GetTermInOfficeER(1);

            termObj.Notes = "These are updated Notes";

            var result = await termObj.SaveAsync();

            Assert.NotNull(result);
            Assert.Equal("These are updated Notes", result.Notes);
        }
        public async Task TermInOfficeER_TestInsertNewTermInOfficeER()
        {
            var termObj = await TermInOfficeER.NewTermInOfficeER();

            await BuildTermInOffice(termObj);

            var savedTermInOffice = await termObj.SaveAsync();

            Assert.NotNull(savedTermInOffice);
            Assert.IsType <TermInOfficeER>(savedTermInOffice);
            Assert.True(savedTermInOffice.Id > 0);
        }
        private async Task BuildTermInOffice(TermInOfficeER termObj)
        {
            termObj.Office = await OfficeEC.GetOfficeEC(new Office()
            {
                Id = 1
            });

            termObj.Person = await PersonEC.GetPersonEC(new Person()
            {
                Id = 1
            });

            termObj.StartDate       = DateTime.Now;
            termObj.LastUpdatedBy   = "edm";
            termObj.LastUpdatedDate = DateTime.Now;
            termObj.Notes           = "notes for doctype";
        }