示例#1
0
        public void UpdateMethodOK()
        {
            clsSessionCollection AllSession = new clsSessionCollection();
            clsSession           TestItem   = new clsSession();
            Int32 PrimaryKey = 0;

            TestItem.EquipmentRequired = true;
            TestItem.TrainerID         = 4;
            TestItem.BranchID          = 3;
            TestItem.SessionType       = "update Method";
            TestItem.DateTime          = DateTime.Now.Date;
            TestItem.Cost = 5;

            AllSession.ThisSession = TestItem;
            PrimaryKey             = AllSession.Add();
            TestItem.SessionID     = PrimaryKey;

            TestItem.EquipmentRequired = false;
            TestItem.TrainerID         = 2;
            TestItem.BranchID          = 6;
            TestItem.SessionType       = "update Method";
            TestItem.DateTime          = DateTime.Now.Date;
            TestItem.Cost = 3;

            AllSession.ThisSession = TestItem;
            PrimaryKey             = AllSession.Update();
            AllSession.ThisSession.Find(PrimaryKey);
            Assert.AreEqual(AllSession.ThisSession, TestItem);
        }
示例#2
0
        public void DateTimePropertyOK()
        {
            clsSession ASession = new clsSession();
            DateTime   TestData = DateTime.Now.Date;

            ASession.DateTime = TestData;
            Assert.AreEqual(ASession.DateTime, TestData);
        }
示例#3
0
        public void EquipmentRequiredPropertyOK()
        {
            clsSession ASession = new clsSession();
            Boolean    TestData = true;

            ASession.EquipmentRequired = TestData;
            Assert.AreEqual(ASession.EquipmentRequired, TestData);
        }
示例#4
0
        public void ValidMethodOK()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreEqual(Error, "");
        }
示例#5
0
        public void TrainerIDPropertyOK()
        {
            clsSession ASession = new clsSession();
            int        TestData = 3;

            ASession.TrainerID = TestData;
            Assert.AreEqual(ASession.TrainerID, TestData);
        }
示例#6
0
        public void BranchIDPropertyOK()
        {
            clsSession ASession = new clsSession();
            int        TestData = 2;

            ASession.BranchID = TestData;
            Assert.AreEqual(ASession.BranchID, TestData);
        }
示例#7
0
        public void TypePropertyOK()
        {
            clsSession ASession = new clsSession();
            string     TestData = "Swimming";

            ASession.SessionType = TestData;
            Assert.AreEqual(ASession.SessionType, TestData);
        }
示例#8
0
        public void SessionIDPropertyOK()
        {
            clsSession ASession = new clsSession();
            int        TestData = 4;

            ASession.SessionID = TestData;
            Assert.AreEqual(ASession.SessionID, TestData);
        }
示例#9
0
        public void CostPropertyOK()
        {
            clsSession ASession = new clsSession();
            Decimal    TestData = 0;

            ASession.Cost = TestData;
            Assert.AreEqual(ASession.Cost, TestData);
        }
示例#10
0
        public void FindMethodOK()
        {
            clsSession ASession  = new clsSession();
            Boolean    Found     = false;
            Int32      SessionID = 4;

            Found = ASession.Find(SessionID);
            Assert.IsTrue(Found);
        }
示例#11
0
        public void BranchIDMid()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            string     branchID = "aaa";

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreEqual(Error, "");
        }
示例#12
0
        public void TrianerIDMinLessOne()
        {
            clsSession ASession  = new clsSession();
            string     Error     = "";
            string     trainerID = "";

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreNotEqual(Error, "");
        }
示例#13
0
        public void DateTimeInvalidData()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            String     dateTime = "this is not a date!";

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreNotEqual(Error, "");
        }
示例#14
0
        public void CostMaxPlusOne()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            string     cost     = "aaaaaaa";

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreNotEqual(Error, "");
        }
示例#15
0
        public void CostExtremeMax()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            String     Cost     = "";

            cost  = Cost.PadRight(10, 'a') + "";
            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreNotEqual(Error, "");
        }
示例#16
0
        public void SessionsTypeMid()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            string     Type     = "";

            Type  = Type.PadRight(25, 'a');
            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreEqual(Error, "");
        }
示例#17
0
        public void DateTimeMin()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            DateTime   TestDate;

            TestDate = DateTime.Now.Date;
            string DateAdded = TestDate.ToString();

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreEqual(Error, "");
        }
示例#18
0
        public void DateTimeMinLessOne()
        {
            clsSession ASession = new clsSession();
            String     Error    = "";
            DateTime   TestDate;

            TestDate = DateTime.Now.Date;
            TestDate = TestDate.AddDays(-1);
            string dateTime = TestDate.ToString();

            Error = ASession.Valid(trainerID, branchID, sessionType, dateTime, cost);
            Assert.AreNotEqual(Error, "");
        }
示例#19
0
        public void TestCostFound()
        {
            clsSession ASession  = new clsSession();
            Boolean    Found     = false;
            Boolean    OK        = true;
            Int32      SessionID = 4;

            Found = ASession.Find(SessionID);
            if (ASession.Cost != Convert.ToDecimal(3))
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
示例#20
0
        public void TestDateTimeFound()
        {
            clsSession ASession  = new clsSession();
            Boolean    Found     = false;
            Boolean    OK        = true;
            Int32      SessionID = 4;

            Found = ASession.Find(SessionID);
            if (ASession.DateTime != Convert.ToDateTime("03/05/2020 00:00:00"))
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
示例#21
0
        public void TestEquipmenRequiedFound()
        {
            clsSession ASession  = new clsSession();
            Boolean    Found     = false;
            Boolean    OK        = true;
            Int32      SessionID = 4;

            Found = ASession.Find(SessionID);
            if (ASession.EquipmentRequired != false)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
示例#22
0
        public void TestSessionTypeFound()
        {
            clsSession ASession  = new clsSession();
            Boolean    Found     = false;
            Boolean    OK        = true;
            Int32      SessionID = 4;

            Found = ASession.Find(SessionID);
            if (ASession.SessionType != "Swimming")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
示例#23
0
        public void TestBranchIDFound()
        {
            clsSession ASession  = new clsSession();
            Boolean    Found     = false;
            Boolean    OK        = true;
            Int32      SessionID = 4;

            Found = ASession.Find(SessionID);
            if (ASession.BranchID != 2)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
示例#24
0
        public void ThisSessionPropertyOK()
        {
            clsSessionCollection AllSession  = new clsSessionCollection();
            clsSession           TestSession = new clsSession();

            TestSession.EquipmentRequired = false;
            TestSession.SessionID         = 1;
            TestSession.SessionType       = "Some Type";
            TestSession.DateTime          = DateTime.Now.Date;
            TestSession.TrainerID         = 4;
            TestSession.BranchID          = 3;
            TestSession.Cost       = 5;
            AllSession.ThisSession = TestSession;
            Assert.AreEqual(AllSession.ThisSession, TestSession);
        }
示例#25
0
        public void ListandCountOK()
        {
            clsSessionCollection AllSession = new clsSessionCollection();
            List <clsSession>    TestList   = new List <clsSession>();
            clsSession           TestItem   = new clsSession();

            TestItem.EquipmentRequired = false;
            TestItem.SessionID         = 1;
            TestItem.SessionType       = "Some Type";
            TestItem.DateTime          = DateTime.Now.Date;
            TestItem.TrainerID         = 4;
            TestItem.BranchID          = 3;
            TestItem.Cost = 5;
            TestList.Add(TestItem);
            AllSession.SessionList = TestList;
            Assert.AreEqual(AllSession.Count, TestList.Count);
        }
示例#26
0
        public void AddMethodOK()
        {
            clsSessionCollection AllSession = new clsSessionCollection();
            clsSession           TestItem   = new clsSession();
            Int32 PrimaryKey = 0;

            TestItem.EquipmentRequired = true;
            TestItem.TrainerID         = 1;
            TestItem.BranchID          = 1;
            TestItem.SessionID         = 2;
            TestItem.SessionType       = "Add Method";
            TestItem.DateTime          = DateTime.Now.Date;
            TestItem.Cost          = 5;
            AllSession.ThisSession = TestItem;
            PrimaryKey             = AllSession.Add();
            //set the primary key of the test data
            TestItem.SessionID = PrimaryKey;
            //find the record
            AllSession.ThisSession.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllSession.ThisSession, TestItem);
        }
示例#27
0
        public void DeleteMethodOK()
        {
            clsSessionCollection AllSession = new clsSessionCollection();
            clsSession           TestItem   = new clsSession();
            Int32 PrimaryKey = 0;

            TestItem.EquipmentRequired = true;
            TestItem.TrainerID         = 4;
            TestItem.BranchID          = 3;
            TestItem.SessionID         = 51;
            TestItem.SessionType       = "Delete Method";
            TestItem.DateTime          = DateTime.Now.Date;
            TestItem.Cost          = 5;
            AllSession.ThisSession = TestItem;
            PrimaryKey             = AllSession.Add();
            TestItem.SessionID     = PrimaryKey;
            AllSession.ThisSession.Find(PrimaryKey);
            AllSession.Delete();
            Boolean Found = AllSession.ThisSession.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
示例#28
0
        public void InstanceOK()
        {
            clsSession ASession = new clsSession();

            Assert.IsNotNull(ASession);
        }