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

            Assert.NotNull(officeObj);
            Assert.IsType <OfficeER>(officeObj);
        }
Example #2
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));
        }
Example #3
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);
        }
Example #4
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());
        }
Example #5
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);
        }
Example #6
0
 public async Task OfficeER_InvalidGet()
 {
     await Assert.ThrowsAsync <DataPortalException>(() => OfficeER.GetOfficeER(999));
 }