예제 #1
0
        public void UpdateMethodOK()
        {
            clsOfficeCollection AllOffices = new clsOfficeCollection();
            OfficeClasses       TestItem   = new OfficeClasses();
            Int32 PrimaryKey = 0;

            TestItem.IsActive       = true;
            TestItem.InspectionDate = DateTime.Now.Date;
            TestItem.AddressLine1   = "123a";
            TestItem.AddressLine2   = "Some Street";
            TestItem.City           = "Some City";
            TestItem.PhoneNumber    = "07464074954";
            TestItem.PostCode       = "LE1 1WE";
            AllOffices.ThisOffice   = TestItem;
            PrimaryKey              = AllOffices.Add();
            TestItem.OfficeCode     = PrimaryKey;
            TestItem.IsActive       = false;
            TestItem.InspectionDate = DateTime.Now.Date;
            TestItem.AddressLine1   = "123b";
            TestItem.AddressLine2   = "Another Street";
            TestItem.City           = "Another City";
            TestItem.PhoneNumber    = "07464074954";
            TestItem.PostCode       = "LE2 2WE";
            AllOffices.ThisOffice   = TestItem;
            AllOffices.Update();
            AllOffices.ThisOffice.Find(PrimaryKey);
            Assert.AreEqual(AllOffices.ThisOffice, TestItem);
        }
예제 #2
0
        public void DeleteMethodOK()
        {
            clsOfficeCollection AllOffices = new clsOfficeCollection();
            OfficeClasses       TestItem   = new OfficeClasses();
            Int32 PrimaryKey = 0;

            TestItem.IsActive       = true;
            TestItem.OfficeCode     = 3;
            TestItem.InspectionDate = DateTime.Now.Date;
            TestItem.AddressLine1   = "123a";
            TestItem.AddressLine2   = "Some Street";
            TestItem.City           = "Some City";
            TestItem.PhoneNumber    = "07464074954";
            TestItem.PostCode       = "LE1 1WE";
            AllOffices.ThisOffice   = TestItem;
            PrimaryKey          = AllOffices.Add();
            TestItem.OfficeCode = PrimaryKey;
            AllOffices.ThisOffice.Find(PrimaryKey);
            AllOffices.Delete();
            Boolean Found = AllOffices.ThisOffice.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }