private static void emptyTableContact() { ContactService contactSrv = new ContactService(); contactSrv.emptyTable(); List<ContactBO> contacts = contactSrv.getAllFromTable(); Assert.AreEqual(0, contacts.Count(), string.Format("'Contact' Table should be empty.")); }
private static void fullFillContactTable() { ContactTypeService contactTypeSrv = new ContactTypeService(); List<ContactTypeBO> contactTypes = contactTypeSrv.getAllFromTable(); Assert.AreNotEqual(0, contactTypes.Count(), string.Format("There should be values in 'ContactType' Table.")); int existingContactTypeID = contactTypes.ElementAt(0).ContactTypeID; CustomerService customerSrv = new CustomerService(); List<CustomerBO> customers = customerSrv.getAllFromTable(); Assert.AreNotEqual(0, customers.Count(), string.Format("There should be values in 'Customer' Table.")); int existingCustomerID = customers.ElementAt(0).CustomerID; //TODO: Verify that contact cannot be created before Customer (CustomerID foreign key) //TODO: Verify that contact cannot be created before ContactType (ContactTypeID foreign key) ContactService contactSrv = new ContactService(); contactSrv.addNew(existingCustomerID, existingContactTypeID, "val_skype", DateTime.Now);//TODO: take first from list contactSrv.addNew(existingCustomerID, existingContactTypeID, "val_mail", DateTime.Now); contactSrv.addNew(existingCustomerID, existingContactTypeID, "val_phone", DateTime.Now); List<ContactBO> contacts = contactSrv.getAllFromTable(); Assert.AreNotEqual(0, contacts.Count(), string.Format("There should be values in 'Contact' Table.")); }