Exemple #1
0
        public async Task OfficeER_TestGetOffice()
        {
            var officeObj = await OfficeER.GetOfficeER(1);

            Assert.NotNull(officeObj);
            Assert.IsType <OfficeER>(officeObj);
        }
Exemple #2
0
        public async Task OfficeER_TestGetNewOfficeER()
        {
            var officeObj = await OfficeER.NewOfficeER();

            Assert.NotNull(officeObj);
            Assert.False(officeObj.IsValid);
        }
Exemple #3
0
        public async Task OfficeER_TestDeleteObjectFromDatabase()
        {
            const int ID_TO_DELETE = 99;

            await OfficeER.DeleteOfficeER(ID_TO_DELETE);

            await Assert.ThrowsAsync <DataPortalException>(() => OfficeER.GetOfficeER(ID_TO_DELETE));
        }
Exemple #4
0
        public async Task OfficeER_TestInvalidSaveOfficeER()
        {
            var officeObj = await OfficeER.NewOfficeER();

            officeObj.Name = String.Empty;
            OfficeER savedOffice = null;

            Assert.False(officeObj.IsValid);
            Assert.Throws <Csla.Rules.ValidationException>(() => savedOffice = officeObj.Save());
        }
Exemple #5
0
        public async Task OfficeER_TestUpdateExistingOfficeER()
        {
            var officeObj = await OfficeER.GetOfficeER(1);

            officeObj.Notes = "These are updated Notes";

            var result = await officeObj.SaveAsync();

            Assert.NotNull(result);
            Assert.Equal("These are updated Notes", result.Notes);
        }
Exemple #6
0
        private async Task <OfficeER> BuildOfficeER()
        {
            var officeObj = await OfficeER.NewOfficeER();

            officeObj.Term            = 1;
            officeObj.CalendarPeriod  = "annual";
            officeObj.Name            = "office name";
            officeObj.ChosenHow       = 2;
            officeObj.Appointer       = "members";
            officeObj.LastUpdatedBy   = "edm";
            officeObj.LastUpdatedDate = DateTime.Now;
            officeObj.Notes           = "notes for office";

            return(officeObj);
        }
Exemple #7
0
        public async Task OfficeER_TestSaveOutOfOrder()
        {
            var office1 = await OfficeER.GetOfficeER(1);

            var office2 = await OfficeER.GetOfficeER(1);

            office1.Notes = "set up timestamp issue"; // turn on IsDirty
            office2.Notes = "set up timestamp issue";

            var office2_2 = await office2.SaveAsync();

            Assert.NotEqual(office2_2.RowVersion, office1.RowVersion);
            Assert.Equal("set up timestamp issue", office2_2.Notes);
            await Assert.ThrowsAsync <DataPortalException>(() => office1.SaveAsync());
        }
Exemple #8
0
        public async Task OfficeER_TestSubsequentSaves()
        {
            var office = await OfficeER.GetOfficeER(1);

            office.Notes = "set up timestamp issue"; // turn on IsDirty

            var office2 = await office.SaveAsync();

            var rowVersion1 = office2.RowVersion;

            office2.Notes = "another timestamp trigger";

            var office3 = await office2.SaveAsync();

            Assert.NotEqual(office2.RowVersion, office3.RowVersion);
        }
Exemple #9
0
 public async Task OfficeER_InvalidGet()
 {
     await Assert.ThrowsAsync <DataPortalException>(() => OfficeER.GetOfficeER(999));
 }