public void ReportByNameNoneFound() { //filtered data instance clsCustomerCollection FilteredNames = new clsCustomerCollection(); //apply a name that does not exist FilteredNames.ReportByName("abc"); //test to see that there are no records Assert.AreEqual(0, FilteredNames.Count); }
public void ReportByUsernameNoneFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //apply a username that doesn't exist FilteredCustomers.ReportByUsername("xxx xxx"); //test to see that there are no records Assert.AreEqual(0, FilteredCustomers.Count); }
public void ReportByNameOK() { //normal instance clsCustomerCollection AllCustomers = new clsCustomerCollection(); //filtered data instance clsCustomerCollection FilteredNames = new clsCustomerCollection(); //empty filtered name FilteredNames.ReportByName(""); Assert.AreEqual(AllCustomers.Count, FilteredNames.Count); }
public void ReportByUsernameMethodOK() { //create an instance of the class containing unfiltered results clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //apply a blank string (should return all records); FilteredCustomers.ReportByUsername(""); //test to see that the two values are the same Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count); }
public void ThisCustomerPropertyOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create the test customer clsCustomer TestCustomer = new clsCustomer(); //set properties TestCustomer.CustomerId = 10; TestCustomer.Name = "Ten"; TestCustomer.Address = "Ten"; TestCustomer.Postcode = "Post"; TestCustomer.DoB = DateTime.Now.Date; TestCustomer.GdprRequest = true; AllCustomers.ThisCustomer = TestCustomer; Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer); }
public void ThisCustomerPropertyOK() { clsCustomerCollection allCustomers = new clsCustomerCollection(); clsCustomer TestCustomer = new clsCustomer(); TestCustomer.Active = true; TestCustomer.CustomerId = 4; TestCustomer.Name = "Zeynep Tugce"; TestCustomer.CustomerRegisteredDate = DateTime.Now.Date; TestCustomer.ProductId = 40; TestCustomer.Point = 0; allCustomers.ThisCustomer = TestCustomer; Assert.AreEqual(allCustomers.ThisCustomer, TestCustomer); }
public void CustomerListOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); List <clsCustomer> TestList = new List <clsCustomer>(); clsCustomer TestItem = new clsCustomer(); 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; TestList.Add(TestItem); AllCustomers.CustomerList = TestList; Assert.AreEqual(AllCustomers.Count, TestList.Count); }
public void ListAndCountOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); List <clsCustomer> CustomerList = new List <clsCustomer>(); //create the test customer clsCustomer TestCustomer = new clsCustomer(); //set properties TestCustomer.CustomerId = 2; TestCustomer.Name = "a"; TestCustomer.Address = "ad"; TestCustomer.Postcode = "PP112DD"; TestCustomer.DoB = DateTime.Now.Date; TestCustomer.GdprRequest = false; //add TestCustomer to the CustomerList CustomerList.Add(TestCustomer); AllCustomers.CustomerList = CustomerList; Assert.AreEqual(AllCustomers.Count, CustomerList.Count); }
public void ThisCustomerPropertyOK() { //create an instance of the class we want to create clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create some test data to assign to the property clsCustomer TestCustomer = new clsCustomer(); //set the properties of the test object TestCustomer.Active = true; TestCustomer.CustomerId = 1; TestCustomer.Username = "******"; TestCustomer.Password = "******"; TestCustomer.Address = "some address"; TestCustomer.DateAdded = DateTime.Now.Date; //assign the data to the property AllCustomers.ThisCustomer = TestCustomer; //test to see that the two values are the same Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer); }
public void CustomerListOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); List <clsCustomer> CustomerList = new List <clsCustomer>(); //create the test customer clsCustomer TestCustomer = new clsCustomer(); //set properties TestCustomer.CustomerId = 1; TestCustomer.Name = "John Snow"; TestCustomer.Address = "1 Kings Landing"; TestCustomer.Postcode = "KL01 1QL"; TestCustomer.DoB = DateTime.Now.Date; TestCustomer.GdprRequest = false; //add TestCustomer to the CustomerList CustomerList.Add(TestCustomer); AllCustomers.CustomerList = CustomerList; Assert.AreEqual(AllCustomers.CustomerList, CustomerList); }
public void AddMethodOK() { 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); Assert.AreEqual(AllCustomers.ThisCustomer, TestItem); }
public void ListAndCountOK() { clsCustomerCollection allCustomers = new clsCustomerCollection(); List <clsCustomer> TestList = new List <clsCustomer>(); clsCustomer TestItem = new clsCustomer(); TestItem.Active = true; TestItem.CustomerId = 4; TestItem.Name = "Zeynep Tugce"; TestItem.CustomerRegisteredDate = DateTime.Now.Date; TestItem.ProductId = 40; TestItem.Point = 0; TestList.Add(TestItem); allCustomers.CustomerList = TestList; Assert.AreEqual(allCustomers.Count, TestList.Count); }
public void AddMethodOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create the test customer clsCustomer TestCustomer = new clsCustomer(); Int32 PrimaryKey = 0; //set properties TestCustomer.CustomerId = 5; TestCustomer.Name = "Bruce Lee"; TestCustomer.Address = "Turbo Road"; TestCustomer.Postcode = "PE10 1AB"; TestCustomer.DoB = DateTime.Now.Date; TestCustomer.GdprRequest = true; AllCustomers.ThisCustomer = TestCustomer; //add customer to key PrimaryKey = AllCustomers.Add(); //set key TestCustomer.CustomerId = PrimaryKey; AllCustomers.ThisCustomer.Find(PrimaryKey); Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer); }
public void UpdateMethodOK() { //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 = "an address"; 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; //modify the test data TestItem.Active = false; TestItem.CustomerId = 3; TestItem.Username = "******"; TestItem.DateAdded = DateTime.Now.Date; TestItem.Address = "an address2"; TestItem.Password = "******"; //set the record based on the new test data AllCustomers.ThisCustomer = TestItem; //update the record AllCustomers.Update(); //find the record AllCustomers.ThisCustomer.Find(PrimaryKey); //test to see ThisCustomer matches the test data Assert.AreEqual(AllCustomers.ThisCustomer, TestItem); }
public void ReportByNameOK() { clsCustomerCollection filteredCustomers = new clsCustomerCollection(); Boolean OK = true; filteredCustomers.ReportByName(""); //????????? if (filteredCustomers.Count == 2) { if (filteredCustomers.CustomerList[0].CustomerId != 2) { OK = false; } if (filteredCustomers.CustomerList[1].CustomerId != 3) { OK = false; } } Assert.IsTrue(OK); }
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 InstanceOK() { clsCustomerCollection AllCustomers = new clsCustomerCollection(); Assert.IsNotNull(AllCustomers); }