public void AddMethodOK()
        {
            //Create an instance of the class we want to create
            clsScreeningCollection AllScreenings = new clsScreeningCollection();
            //Create the item of test data
            clsScreening TestItem = new clsScreening();
            //Variable to store the primary kjey
            Int32 PrimaryKey = 0;

            //Set its properties
            TestItem.FilmID        = 1;
            TestItem.ScreenID      = 2;
            TestItem.ScreeningCost = 12.50m;
            TestItem.ScreeningDate = new DateTime(2018, 7, 23, 12, 15, 0);
            TestItem.Cancelled     = false;
            //Set ThisFilm to the test data
            AllScreenings.ThisScreening = TestItem;
            //Add the record
            PrimaryKey = AllScreenings.Add();
            //Set the primary key of the test data
            TestItem.ScreeningID = PrimaryKey;
            //Find the record
            AllScreenings.ThisScreening.Find(PrimaryKey);
            //Test to see that the two values are the same
            Assert.AreEqual(AllScreenings.ThisScreening, TestItem);
        }
        public void ScreeningDateMinPlusOne()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //String variable to store an error message
            String Error = "";
            //Create some test data to pass to the method
            string FilmID        = "1";
            string ScreenID      = "2";
            string ScreeningCost = "12.50";
            //Create a variable to store test data
            DateTime TestDate;

            //Set the date
            TestDate = DateTime.Now;
            //Change to date to whatever the date is less than 100 years
            TestDate = TestDate.AddDays(1);
            //Convert the date variable to a string variable
            string ScreeningDate = TestDate.ToString();

            //Invoke the method
            Error = AScreening.Valid(FilmID, ScreenID, ScreeningCost, ScreeningDate);
            //Test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
        public void InstanceOK()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();

            //Test to see that it exists
            Assert.IsNotNull(AScreening);
        }
        public void CancelledPropertyOK()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //Create some test data to assign to the property
            Boolean TestData = false;

            //Assign the data to the property
            AScreening.Cancelled = TestData;
            //Test to see that the two values are the same
            Assert.AreEqual(AScreening.Cancelled, TestData);
        }
        public void ScreeningDatePropertyOK()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //Create some test data to assign to the property
            DateTime TestData = new DateTime(2018, 7, 23, 12, 15, 0);

            //Assign the data to the property
            AScreening.ScreeningDate = TestData;
            //Test to see that the two values are the same
            Assert.AreEqual(AScreening.ScreeningDate, TestData);
        }
        public void ScreeningCostPropertyOK()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //Create some test data to assign to the property
            Decimal TestData = 12.50m;

            //Assign the data to the property
            AScreening.ScreeningCost = TestData;
            //Test to see that the two values are the same
            Assert.AreEqual(AScreening.ScreeningCost, TestData);
        }
        public void ScreenIDPropertyOK()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //Create some test data to assign to the property
            Int32 TestData = 2;

            //Assign the data to the property
            AScreening.ScreenID = TestData;
            //Test to see that the two values are the same
            Assert.AreEqual(AScreening.ScreenID, TestData);
        }
        public void FindMethodOK()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //Boolean variable to store the result of the validation
            Boolean Found = false;
            //Create some test data to use with the method
            Int32 ScreeningID = 1;

            //Invoke the method
            Found = AScreening.Find(ScreeningID);
            //Test to see that the result is correct
            Assert.IsTrue(Found);
        }
        public void ScreeningCostInvalidData()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //String variable to store an error message
            String Error = "";
            //Create some test data to pass to the method
            string FilmID        = "1";
            string ScreenID      = "2";
            string ScreeningCost = "ABCD.EFGm";
            string ScreeningDate = new DateTime(2018, 7, 23, 12, 15, 0).ToString();

            //Invoke the method
            Error = AScreening.Valid(FilmID, ScreenID, ScreeningCost, ScreeningDate);
            //Test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
        public void ScreeningDateInvalidData()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //String variable to store an error message
            String Error = "";
            //Create some test data to pass to the method
            string FilmID        = "1";
            string ScreenID      = "2";
            string ScreeningCost = "12.50";
            //Set ScreeningDate to a non-date value
            string ScreeningDate = "Definitely not a date!";

            //Invoke the method
            Error = AScreening.Valid(FilmID, ScreenID, ScreeningCost, ScreeningDate);
            //Test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
        public void ThisScreeningPropertyOK()
        {
            //Create an instance of the class we want to create
            clsScreeningCollection AllScreenings = new clsScreeningCollection();
            //Create some test data to assign to the property
            clsScreening TestItem = new clsScreening();

            //Set the properties of the test object
            TestItem.FilmID        = 1;
            TestItem.ScreenID      = 2;
            TestItem.ScreeningCost = 12.50m;
            TestItem.ScreeningDate = new DateTime(2018, 7, 23, 12, 15, 0);
            TestItem.Cancelled     = false;
            //Assign the data to the property
            AllScreenings.ThisScreening = TestItem;
            //Test to see that the two values are the same
            Assert.AreEqual(AllScreenings.ThisScreening, TestItem);
        }
        public void TestCancelledFound()
        {
            //Create an instance of the class we want to create
            clsScreening AScreening = new clsScreening();
            //Boolean variable to store the result of the search
            Boolean Found = false;
            //Boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //Create some test data to use with the method
            Int32 ScreeningID = 1;

            //Invoke the method
            Found = AScreening.Find(ScreeningID);
            //Check the Screening cost
            if (AScreening.Cancelled != false)
            {
                OK = false;
            }
            //Test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void ListAndCountOK()
        {
            //Create an instance of the class we want to create
            clsScreeningCollection AllScreenings = new clsScreeningCollection();
            //Create some test data to assign to the property
            //In this case the data needs to be a list of objects
            List <clsScreening> TestList = new List <clsScreening>();
            //Add an item to the list
            //Create the item of test data
            clsScreening TestItem = new clsScreening();

            //Set its properties
            TestItem.FilmID        = 1;
            TestItem.ScreenID      = 2;
            TestItem.ScreeningCost = 12.50m;
            TestItem.ScreeningDate = new DateTime(2018, 7, 23, 12, 15, 0);
            TestItem.Cancelled     = false;
            //Add the item to the test list
            TestList.Add(TestItem);
            //Assign the data to the property
            AllScreenings.ScreeningList = TestList;
            //Test to see that the two values are the same
            Assert.AreEqual(AllScreenings.Count, TestList.Count);
        }