private static void emptyTableContactType()
 {
     ContactTypeService contactTypeSrv = new ContactTypeService();
     contactTypeSrv.emptyTable();
     List<ContactTypeBO> contactTypes = contactTypeSrv.getAllFromTable();
     Assert.AreEqual(0, contactTypes.Count(), string.Format("'ContactType' Table should be empty."));
 }
        //constructor creating page with pre-filled data from selected customer details
        public CustomerUpdateV(CustomerBO selectedCustomer, bool newCustomer)
        {
            InitializeComponent();

            //determine, whether user want to add new customer, or update existing customer
            this._addingNewCustomer = newCustomer;
            this._selectedCustomer = selectedCustomer;

            //top part of the window is the same asd CustomerAddV, so the information is transferred
            txtCompanyName.Text = selectedCustomer.CompanyName;
            txtCompanyContactName.Text = selectedCustomer.ContactPerson;

            // filling ContactTypes combobox with respective values
            ContactTypeService contactTypeSrv = new ContactTypeService();
            List<ContactTypeBO> contactTypes = contactTypeSrv.getAllFromTable();
            cboxContacts.ItemsSource = contactTypes;

            // filling Contact list with respective values
            updateListContacts();
        }
 private static void fullFillContactTypeTable()
 {
     ContactTypeService contactTypeSrv = new ContactTypeService();
     contactTypeSrv.addNew("skype", false);//TODO: take first from list
     contactTypeSrv.addNew("phone", true);
     contactTypeSrv.addNew("email", false);
     List<ContactTypeBO> contactTypes = contactTypeSrv.getAllFromTable();
     Assert.AreNotEqual(0, contactTypes.Count(), string.Format("There should be values in 'ContactType' Table."));
 }
        /// <summary>
        /// This method tests ContactType Table
        /// We test that minimum expected rows are exist
        /// and their values are correct
        /// </summary>
        public static void testContactTypesDataCorrectness()
        {

            ContactTypeService contactTypeSrv = new ContactTypeService();
            List<ContactTypeBO> contactTypes = contactTypeSrv.getAllFromTable();

            String expValueName1 = "skype";
            bool isVerifiedValue1 = false;

            String expValueName2 = "phone";
            bool isVerifiedValue2 = false;

            String expValueName3 = "email";
            bool isVerifiedValue3 = false;

            foreach (var contactType in contactTypes)
            {
                if (expValueName1 == contactType.Name)
                {
                    isVerifiedValue1 = true;
                }
                if (expValueName2 == contactType.Name)
                {
                    isVerifiedValue2 = true;
                }
                if (expValueName3 == contactType.Name)
                {
                    isVerifiedValue3 = true;
                }
                //debug info
                //string valjund = string.Format("{0} {1} ", contactType.ContactTypeID, contactType.Name);
                //Console.WriteLine(valjund);
            }

            Assert.AreEqual(true, isVerifiedValue1, string.Format("'{0}' Verification failed", expValueName1));
            Assert.AreEqual(true, isVerifiedValue2, string.Format("'{0}' Verification failed", expValueName2));
            Assert.AreEqual(true, isVerifiedValue3, string.Format("'{0}' Verification failed", expValueName3));
        }
        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."));
        }