예제 #1
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsContactUsCollection AContact = new clsContactUsCollection("Fbloggs");
            //create an instance of test data
            clsContactUs TestItem = new clsContactUs();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            //TestItem.CustomerID = 3;
            TestItem.Email   = "[email protected]";
            TestItem.Name    = "Ayub Osman1";
            TestItem.Message = " I Loved the meal. Thanks !1 ";
            //set ThisCustomer to validate test data
            AContact.ThisContact = TestItem;
            //add the record
            PK = AContact.Add();
            //set primary key of test data
            TestItem.ContactId = PK;
            //find the record
            AContact.ThisContact.Find(PK);
            //delete the record
            AContact.Delete();
            //now find the record
            Boolean Found = AContact.ThisContact.Find(PK);

            //test to see that it exists
            Assert.IsFalse(Found);
        }