Esempio n. 1
0
 public void CompanyNameMaxLessOneOk()
 {
     //create an instance of the class we want to create
      clsEvent AEvent = new clsEvent();
      //boolean variable to store the result of the validation
      Boolean OK = false;
      //create some test data to pass to the method
      string EventName = "Women in Technology";
      string CompanyName = "";
      string Contact = "075432345";
      string StartDate = DateTime.Now.Date.ToString();
      string GuestSpeaker = "Elizabeth Saw";
      string TypeOfEvent = "Conference";
      string ConsultantAttending = "Egle Sciglinskaite";
      string Location = "Excel London";
      CompanyName = CompanyName.PadRight(29, 'b');
      //invoke method
      OK = AEvent.Valid(EventName, CompanyName, Contact, StartDate, GuestSpeaker, Location, TypeOfEvent, ConsultantAttending);
      //check if it is correct
      Assert.IsTrue(OK);
 }
 //public constructor for the class
 public clsEventCollection()
 {
     Int32 Index = 0;
       //var to store the record count
       Int32 RecordCount = 0;
       //object for data connection
       clsDataConnection DB = new clsDataConnection();
       //execute the stored procedure
       DB.Execute("sproc_tblEvent_SelectAll");
       //get the count of records
       RecordCount = DB.Count;
     //while there are records to process
     while (Index < RecordCount)
     {
         //create an isntance of the event class
         clsEvent AnEvent = new clsEvent();
         //get the event code
         AnEvent.EventCode = Convert.ToInt32(DB.DataTable.Rows[Index]["EventCode"]);
         //get the event name
         AnEvent.EventName = Convert.ToString(DB.DataTable.Rows[Index]["EventName"]);
         //
         AnEvent.CompanyName = Convert.ToString(DB.DataTable.Rows[Index]["CompanyName"]);
         //
         AnEvent.ConsultantAttending = Convert.ToString(DB.DataTable.Rows[Index]["ConsultantAttending"]);
         //
         AnEvent.Contact = Convert.ToString(DB.DataTable.Rows[Index]["Contact"]);
         //
         AnEvent.StartDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["StartDate"]);
         //
         AnEvent.GuestSpeaker = Convert.ToString(DB.DataTable.Rows[Index]["GuestSpeaker"]);
         //
         AnEvent.Location= Convert.ToString(DB.DataTable.Rows[Index]["Location"]);
         //
         AnEvent.TypeOfEvent = Convert.ToString(DB.DataTable.Rows[Index]["TypeOfEvent"]);
         //add the event to the array list
         eventList.Add(AnEvent);
         //increment index
         Index++;
     }
 }
Esempio n. 3
0
 public void InstanceOK()
 {
     //create an instance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //test to see that it exists
     Assert.IsNotNull(AEvent);
 }
Esempio n. 4
0
 public void GuestSpeakersPropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     string TestData = "Elizabeth Saw";
     //assign the data to the property
     AEvent.GuestSpeaker = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.GuestSpeaker, TestData);
 }
Esempio n. 5
0
        public void GuestSpeakerMaxPlusOneOk()
        {
            //create an instance of the class we want to create
             clsEvent AEvent = new clsEvent();
             //boolean variable to store the result of the validation
             Boolean OK = false;
             //create some test data to pass to the method
             string EventName = "Women in Technology";
             string CompanyName = "CTech";
             string Contact = "075432345";
             string StartDate = DateTime.Now.Date.ToString();
             string GuestSpeaker = "";
             string TypeOfEvent = "Conference";
             string ConsultantAttending = "Egle Sciglinskaite";
             //variable to store location
             string Location = "Excel London";
             //creates  29 characters instead of writing many out
            GuestSpeaker = GuestSpeaker.PadRight(31, 'b');
             //variable to store date

             //invoke method
             OK = AEvent.Valid(EventName, CompanyName, Contact, StartDate, GuestSpeaker, Location, TypeOfEvent, ConsultantAttending);
             //check iff it is correct
             Assert.IsFalse(OK);
        }
Esempio n. 6
0
 public void FindMethodOK()
 {
     //create an instance of the class we want to create
      clsEvent AEvent = new clsEvent();
      //boolean varibale to store the result of the validation
      Boolean Found = false;
      //create some test data to use with the method
      Int32 EventCode = 1;
      //invoke the method
      Found = AEvent.Find(EventCode);
      //test rto see that the result is correct
      Assert.IsTrue(Found);
 }
Esempio n. 7
0
 public void EventNamePropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     string TestData = "Women in Technology";
     //assign the data to the property
     AEvent.EventName = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.EventName, TestData);
 }
Esempio n. 8
0
 public void EventCodePropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     Int32 TestData = 1;
     //assign the data to the property
     AEvent.EventCode = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.EventCode, TestData);
 }
Esempio n. 9
0
 public void ContactPropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     string TestData = "0795432345";
     //assign the data to the property
     AEvent.Contact = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.Contact, TestData);
 }
Esempio n. 10
0
 public void ConsultantAttendingPropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     string TestData = "Egle Sciglinskaite";
     //assign the data to the property
     AEvent.ConsultantAttending = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.ConsultantAttending, TestData);
 }
Esempio n. 11
0
 public void TestTypeOfEventFound()
 {
     //create an instance of the class we want to create
      clsEvent AEvent = new clsEvent();
      //boolean varibale to store the result of the validation
      Boolean Found = false;
      //boolean variable to store the result of the search
      Boolean OK = true;
      //create some test data to use with the method
      Int32 EventCode = 1;
      //invoke the method
      Found = AEvent.Find(EventCode);
      //check the event code
      if (AEvent.TypeOfEvent != "Conference")
      {
          OK = false;
      }
      //test to see that the result is correct
      Assert.IsFalse(OK);
 }
Esempio n. 12
0
 public void TestStartDateFound()
 {
     //create an instance of the class we want to create
      clsEvent AEvent = new clsEvent();
      //boolean varibale to store the result of the validation
      Boolean Found = false;
      //boolean variable to store the result of the search
      Boolean OK = true;
      //create some test data to use with the method
      Int32 EventCode = 1;
      //invoke the method
      Found = AEvent.Find(EventCode);
      //check the event code
      if (AEvent.StartDate != Convert.ToDateTime("22/03/2016"))
      {
          OK = false;
      }
      //test to see that the result is correct
      Assert.IsTrue(OK);
 }
Esempio n. 13
0
 public void StartDatePropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     DateTime TestData = DateTime.Now.Date;
     //assign the data to the property
     AEvent.StartDate = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.StartDate, TestData);
 }
Esempio n. 14
0
 public void StartDateMinPlusOneOK()
 {
     //create an instance of the class we want to create
      clsEvent AEvent = new clsEvent();
      //boolean variable to store the result of the validation
      Boolean OK = false;
      //create some test data to pass to the method
      string EventName = "Women in Technolog";
      string CompanyName = "CTech";
      string Contact = "075432345";
      string GuestSpeaker = "Elizabeth Saw";
      string Location = "Excel London";
      string TypeOfEvent = "Conference";
      string ConsultantAttending = "Egle Sciglinskaite";
      //variable to store date
      DateTime TestDate;
      //set to todays date
      TestDate = DateTime.Now.Date;
      //date changed to 1, this test should fail
      TestDate = TestDate.AddDays(1);
      //convert date variable to string variable
      string StartDate = TestDate.ToString();
      //invoke method
      OK = AEvent.Valid(EventName, CompanyName, Contact, StartDate, GuestSpeaker, Location, TypeOfEvent, ConsultantAttending);
      //check iff it is correct
      Assert.IsFalse(OK);
 }
Esempio n. 15
0
 public void StartDateInvalidDataOK()
 {
     //create an instance of the class we want to create
      clsEvent AEvent = new clsEvent();
      //boolean variable to store the result of the validation
      Boolean OK = false;
      //create some test data to pass to the method
      string EventName = "Women in Technolog";
      string CompanyName = "CTech";
      string Contact = "075432345";
      string GuestSpeaker = "Elizabeth Saw";
      string Location = "Excel London";
      string TypeOfEvent = "Conference";
      //variable to store date
      string StartDate = "January twentieth";
      string ConsultantAttending = "Egle Sciglinskaite";
      //invoke method
      OK = AEvent.Valid(EventName, CompanyName, Contact, StartDate, GuestSpeaker, Location, TypeOfEvent, ConsultantAttending);
      //check iff it is correct
      Assert.IsFalse(OK);
 }
Esempio n. 16
0
 public void LocationPropertyOK()
 {
     //create an isntance of the class we want to create
     clsEvent AEvent = new clsEvent();
     //create some test data to assign to the property
     string TestData = " Excel London";
     //assign the data to the property
     AEvent.Location = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AEvent.Location, TestData);
 }