Esempio n. 1
0
        public void UpdateMethodOK()
        {
            //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.Email   = "[email protected]";
            TestItem.Name    = "Ayub Osman2";
            TestItem.Message = " I Loved the meal. Thanks !2 ";
            //set ThisCustomer to validate test data
            AContact.ThisContact = TestItem;
            //add the record
            PK = AContact.Add();
            //set primary key of test data
            TestItem.ContactId = PK;
            //modify the record
            TestItem.Email   = "[email protected]";
            TestItem.Name    = "Ayub Osman1";
            TestItem.Message = " I Loved the meal. Thanks !1 ";
            //set the record based on the new record
            AContact.ThisContact = TestItem;
            //update the record
            AContact.Update();
            //find the record
            AContact.ThisContact.Find(PK);
            //test to see that it exists
            Assert.AreEqual(AContact.ThisContact, TestItem);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void InstanceOK()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();

            //test to see if it exists
            Assert.IsNotNull(AContact);
        }
Esempio n. 4
0
        public void MessageOK()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //create some test data
            string Message = " It was a nice experience. Thanks  ";

            AContact.Message = Message;
            //test to see if it exists
            Assert.AreEqual(AContact.Message, Message);
        }
Esempio n. 5
0
        public void NameOK()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //create some test data
            string Name = " Ayub Osman ";

            AContact.Name = Name;
            //test to see if it exists
            Assert.AreEqual(AContact.Name, Name);
        }
Esempio n. 6
0
        public void EmailOK()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //create some test data
            string Email = " [email protected]";

            AContact.Email = Email;
            //test to see if it exists
            Assert.AreEqual(AContact.Email, Email);
        }
Esempio n. 7
0
        public void ContactIdOK()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //create some test data
            Int32 ContactId = 1;

            AContact.ContactId = ContactId;
            //test to see if it exists
            Assert.AreEqual(AContact.ContactId, ContactId);
        }
Esempio n. 8
0
        public void FilterbyEmailOK()
        {
            clsContactUs TestItem = new clsContactUs();
            //create an instance of the class we want to create
            clsContactUsCollection AContact = new clsContactUsCollection();
            //create an instance of the filtered data
            clsContactUsCollection FilteredContacts = new clsContactUsCollection("");

            //apply a blank string (should return all records)
            FilteredContacts.FilterbyEmail("");
            //test to see the two values are the same
            Assert.AreEqual(AContact.Count, FilteredContacts.Count);
        }
Esempio n. 9
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsContactUs TestItem = new clsContactUs();
            //boolean variable to store the result of the validisation
            Boolean Found = false;
            //create some test data to use the method
            Int32 ContactId = 2000;

            //Invoke the method
            Found = TestItem.Find(ContactId);
            //test to see if it exists
            Assert.IsTrue(Found);
        }
Esempio n. 10
0
        public void ValidExist()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string Email   = " [email protected]";
            string Name    = " Ayub Osman ";
            string Message = " It was a nice experience. Thanks  ";

            //invoke method
            OK = AContact.Valid(Email, Name, Message);
            //test to see if it exists
            Assert.AreEqual(OK, "");
        }
Esempio n. 11
0
        public void MessageExtremeMax()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string Email   = " [email protected]";
            string Name    = " Ayub Osman ";
            string Message = "Samsung65325621478583254441251Samsung65325621478583254441251 ";

            //invoke method
            OK = AContact.Valid(Email, Name, Message);
            //test to see if it exists
            Assert.AreNotEqual(OK, "");
        }
Esempio n. 12
0
        public void MessageMaxPlus1()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string Email   = " [email protected]";
            string Name    = " Ayub Osman ";
            string Message = "AabcdefhjklmnjhsaqweAbcdefhjklmnjhsaqweaa";

            //invoke method
            OK = AContact.Valid(Email, Name, Message);
            //test to see if it exists
            Assert.AreEqual(OK, "");
        }
Esempio n. 13
0
        public void ThisContactPropertyOK()
        {
            //create an instance of the class we want to create
            clsContactUsCollection AContact = new clsContactUsCollection();
            //create some test data to assign to the property
            //add an item to the list
            clsContactUs TestContact = new clsContactUs();

            //set its properties
            TestContact.ContactId = 1;
            TestContact.Email     = "*****@*****.**";
            TestContact.Name      = "10";
            TestContact.Message   = "Dinner";
            //assign the data to the property
            AContact.ThisContact = TestContact;//test to see that it exists
            Assert.AreEqual(AContact.ThisContact, TestContact);
        }
Esempio n. 14
0
        public void TestMessageFound()
        {
            //create a new instance of the class we want to create
            clsContactUs AContact = new clsContactUs();
            //string variable to store result of validation
            Boolean Found = false;
            //create some test data to assign to property
            Int32 ContactId = 2000;

            //invoke method
            Found = AContact.Find(ContactId);
            //check the Customer ID
            if (AContact.Message != "Nice Restaurant")
            {
                Found = false;
            }
            //test to see if it exists
            Assert.IsTrue(Found);
        }
Esempio n. 15
0
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsContactUsCollection AContact = new clsContactUsCollection();
            //create some test data to assign to the property
            //in this sceanario it needs to be a lists of objects
            List <clsContactUs> TestList = new List <clsContactUs>();
            //add an item to the list
            //create the item of test data
            clsContactUs TestItem = new clsContactUs();

            //set its properties
            TestItem.Email   = "*****@*****.**";
            TestItem.Name    = "Ayub Osman";
            TestItem.Message = " I Loved the meal. Thanks ! ";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AContact.ContactList = TestList;
            //test to see that it exists
            Assert.AreEqual(AContact.Count, TestList.Count);
        }