public void DeleteMethodOK() { clsCustomerCollection allCustomers = new clsCustomerCollection(); clsCustomer TestItem = new clsCustomer(); Int32 PrimaryKey = 0; TestItem.Active = true; TestItem.CustomerId = 4; TestItem.Name = "Zeynep Tugce"; TestItem.CustomerRegisteredDate = DateTime.Now.Date; TestItem.ProductId = 40; TestItem.Point = 0; allCustomers.ThisCustomer = TestItem; PrimaryKey = allCustomers.Add(); TestItem.CustomerId = PrimaryKey; allCustomers.ThisCustomer.Find(PrimaryKey); allCustomers.Delete(); Boolean Found = allCustomers.ThisCustomer.Find(PrimaryKey); Assert.IsFalse(Found); }
public void DeleteMethodOK() { //create an instance of the class we want to create clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create the item of test data clsCustomer TestItem = new clsCustomer(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.Active = true; TestItem.CustomerId = 1; TestItem.Username = "******"; TestItem.DateAdded = DateTime.Now.Date; TestItem.Address = "anaddress"; TestItem.Password = "******"; //set ThisCustomer to the test data AllCustomers.ThisCustomer = TestItem; //add the record PrimaryKey = AllCustomers.Add(); //set the primary key of the test data TestItem.CustomerId = PrimaryKey; //find the record AllCustomers.ThisCustomer.Find(PrimaryKey); //delete the record AllCustomers.Delete(); //now find the record Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void DeleteMethodOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create the test customer clsCustomer TestCustomer = new clsCustomer(); Int32 PrimaryKey = 0; //set properties TestCustomer.Name = "John Barry"; TestCustomer.Address = "The Road"; TestCustomer.Postcode = "N111FF"; TestCustomer.DoB = DateTime.Now.Date; TestCustomer.GdprRequest = false; AllCustomers.ThisCustomer = TestCustomer; //add customer to key PrimaryKey = AllCustomers.Add(); TestCustomer.CustomerId = PrimaryKey; AllCustomers.ThisCustomer.Find(PrimaryKey); AllCustomers.Delete(); Boolean found = AllCustomers.ThisCustomer.Find(PrimaryKey); Assert.IsFalse(found); }
public void DeleteMethodOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); clsCustomer TestItem = new clsCustomer(); Int32 PrimaryKey = 0; TestItem.Name = "John Smith"; TestItem.EmailAddress = "*****@*****.**"; TestItem.Address = "Flat 10, Charles street, Leicester"; TestItem.Password = "******"; TestItem.isEmailConfirmed = true; TestItem.LoyaltyPoints = 10.5; TestItem.CreatedAt = DateTime.Now.Date; AllCustomers.ThisCustomer = TestItem; PrimaryKey = AllCustomers.Add(); TestItem.CustomerId = PrimaryKey; AllCustomers.ThisCustomer.Find(PrimaryKey); AllCustomers.Delete(); Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey); Assert.IsFalse(Found); }