Esempio n. 1
0
        public void AddQueueAttendantTest_ExpectedInputs_OptionalInputsUnsupplied()
        {
            var testLane1 = new Lane();

            testLane1.LaneNumber = 1;
            testLane1.LaneName   = "Test Lane 1";
            testLane1.Capacity   = 10;

            Assert.IsTrue(
                dal.AddLane(testLane1)
                );

            testLane1 = dal.GetLaneWithLaneNumber(1);

            Assert.IsNotNull(
                testLane1
                );

            var testUser1 = new QueueAttendant();

            testUser1.SetFullName("A", "", "AAA");
            testUser1.SetEmail("*****@*****.**");
            testUser1.SetContactNumber("");
            testUser1.SetPassword("AAA");
            //lane id is unsupplied by default

            Assert.IsTrue(
                dal.AddQueueAttendant(testUser1)
                );
        }
Esempio n. 2
0
        public void AddQueueAttendantTest_ExpectedInputs_AllSupplied()
        {
            var testLane1 = new Lane();

            testLane1.LaneNumber = 1;
            testLane1.LaneName   = "Test Lane 1";
            testLane1.Capacity   = 10;

            Assert.IsTrue(
                dal.AddLane(testLane1)
                );

            testLane1 = dal.GetLaneWithLaneNumber(1);

            Assert.IsNotNull(
                testLane1
                );

            var testUser1 = new QueueAttendant();

            testUser1.SetFullName("A", "AA", "AAA");
            testUser1.SetEmail("*****@*****.**");
            testUser1.SetContactNumber("12345678901");
            testUser1.SetPassword("AAA");
            testUser1.DesignatedLane.LaneID = testLane1.LaneID;

            Assert.IsTrue(
                dal.AddQueueAttendant(testUser1)
                );
        }
Esempio n. 3
0
        public void AddLaneQueue_Test()
        {
            //LANE INSTANCE START
            Lane newLane = new Lane();

            newLane.LaneName = "Customer Service 1";
            newLane.Capacity = 15;

            Assert.IsTrue(
                queueSystem.AddNewQueueLane(
                    newLane
                    )
                );

            newLane = queueSystem.GetQueueLane(newLane.LaneNumber);

            Assert.IsNotNull(newLane);

            //LANE INSTANCE END
            //QUEUEATTENDANT INSTANCE START
            var testUser1 = new QueueAttendant();

            testUser1.SetFullName("A", "AA", "AAA");
            testUser1.SetEmail("*****@*****.**");
            testUser1.SetContactNumber("12345678901");
            testUser1.SetPassword("AAA");
            testUser1.DesignatedLane = null; //leave it unset

            Assert.IsTrue(
                loginSystem.RegisterAsQueueAttendant(testUser1)
                );
            testUser1 = loginSystem.LoginAsQueueAttendant(
                testUser1.GetEmail(),
                testUser1.GetPassword()
                );

            Assert.IsNotNull(
                testUser1
                );
            //QUEUEATTENDANT INSTANCE END

            //LANE QUEUE INSTANCE START
            //consider max. 12 hours for priority numbers
            var tolerance = TimeSpan.FromHours(12);

            Assert.IsTrue(
                queueSystem.SetLaneActive(
                    newLane.LaneNumber,
                    testUser1,
                    tolerance
                    )
                );

            Assert.IsTrue(
                queueSystem.GetActiveLaneCount() == 1
                );
            //LANE QUEUE INSTANCE END
        }
Esempio n. 4
0
        public void AddQueueAttendantTest_ExpectedInputs_RequiredInputsUnsupplied_InvalidLaneID()
        {
            var testUser1 = new QueueAttendant();

            testUser1.SetFullName("A", "AA", null);
            testUser1.SetEmail(null);
            testUser1.SetContactNumber("12345678901");
            testUser1.SetPassword("AAA");
            testUser1.DesignatedLane.LaneID = -999; //laneid not available in database

            Assert.IsFalse(
                dal.AddQueueAttendant(testUser1)
                );
        }
Esempio n. 5
0
        public void AddQueueAttendantTest_ExpectedInputs_RequiredInputsUnsupplied()
        {
            var testUser1 = new QueueAttendant();

            testUser1.SetFullName("A", "AA", null);
            testUser1.SetEmail(null);
            testUser1.SetContactNumber("12345678901");
            testUser1.SetPassword("AAA");
            //lane id is unsupplied by default

            Assert.IsFalse(
                dal.AddQueueAttendant(testUser1)
                );
        }
Esempio n. 6
0
        public void QueueingSystem_NormalQueueFunctionality_Test()
        {
            //LANE INSTANCE START
            Lane newLane = new Lane();

            newLane.LaneName = "Customer Service 1";
            newLane.Capacity = 15;

            Assert.IsTrue(
                queueSystem.AddNewQueueLane(
                    newLane
                    )
                );

            newLane = queueSystem.GetQueueLane(newLane.LaneNumber);

            Assert.IsNotNull(newLane);

            //LANE INSTANCE END
            //QUEUEATTENDANT INSTANCE START
            var testUser1 = new QueueAttendant();

            testUser1.SetFullName("A", "AA", "AAA");
            testUser1.SetEmail("*****@*****.**");
            testUser1.SetContactNumber("12345678901");
            testUser1.SetPassword("AAA");
            testUser1.DesignatedLane = null; //leave it unset

            Assert.IsTrue(
                loginSystem.RegisterAsQueueAttendant(testUser1)
                );
            testUser1 = loginSystem.LoginAsQueueAttendant(
                testUser1.GetEmail(),
                testUser1.GetPassword()
                );

            Assert.IsNotNull(
                testUser1
                );
            //QUEUEATTENDANT INSTANCE END

            //LANE QUEUE INSTANCE START
            //consider max. 12 hours for priority numbers
            var tolerance = TimeSpan.FromHours(12);

            Assert.IsTrue(
                queueSystem.SetLaneActive(
                    newLane.LaneNumber,
                    testUser1,
                    tolerance
                    )
                );

            Assert.IsTrue(
                queueSystem.GetActiveLaneCount() == 1
                );
            //LANE QUEUE INSTANCE END

            //USER INSTANCE START
            var testQueuer = new User();

            testQueuer.SetFullName("B", "BB", "BBB");
            testQueuer.SetEmail("*****@*****.**");
            testQueuer.SetContactNumber("12345678901");
            testQueuer.SetPassword("BBB");

            Assert.IsTrue(
                loginSystem.RegisterAsUser(testQueuer)
                );
            testQueuer = loginSystem.LoginAsUser(
                testQueuer.GetEmail(),
                testQueuer.GetPassword()
                );

            Assert.IsNotNull(
                testQueuer
                );

            var testQueuer2 = new User();

            testQueuer2.SetFullName("C", "CC", "CCC");
            testQueuer2.SetEmail("*****@*****.**");
            testQueuer2.SetContactNumber("12345678901");
            testQueuer2.SetPassword("CCC");

            Assert.IsTrue(
                loginSystem.RegisterAsUser(testQueuer2)
                );
            testQueuer2 = loginSystem.LoginAsUser(
                testQueuer2.GetEmail(),
                testQueuer2.GetPassword()
                );

            Assert.IsNotNull(
                testQueuer2
                );
            //USER INSTANCE END
            //QUEUE TICKET INSTANCE START
            //  normal priorities for queues

            //this should still be at front
            var qt = new QueueTicket();

            qt.owner          = testQueuer;
            qt.PriorityNumber = 0; //default priority
            qt.QueueLane      = newLane;
            qt.Status         = QueueStatus.WAITING;

            Assert.IsTrue(
                queueSystem.EnqueueLane(
                    qt
                    )
                );

            var qt2 = new QueueTicket();

            qt2.owner          = testQueuer2;
            qt2.PriorityNumber = 0; //default priority
            qt2.QueueLane      = newLane;
            qt2.Status         = QueueStatus.WAITING;

            Assert.IsTrue(
                queueSystem.EnqueueLane(
                    qt2
                    )
                );

            //make sure the two tickets are added
            Assert.AreEqual(
                2,
                queueSystem.GetQueueCountAtLane(qt.QueueLane.LaneNumber));

            var dequeuedTicket = queueSystem.DequeueLane(1);
            var dequeuedUser   = dequeuedTicket.owner as User;

            //normal queues still work with same priority
            Assert.AreEqual(
                testQueuer.UserID,
                dequeuedUser.UserID
                );

            //QUEUE TICKET INSTANCE END
        }
Esempio n. 7
0
        public void AddMultipleLaneQueues_Test()
        {
            //LANE INSTANCE START
            Lane newLane = new Lane();

            newLane.LaneName = "Customer Service";
            newLane.Capacity = 15;

            //  add three lanes
            for (int i = 0; i < 3; i++)
            {
                Assert.IsTrue(
                    queueSystem.AddNewQueueLane(
                        newLane
                        )
                    );
            }

            Assert.IsTrue(
                queueSystem.GetLaneCount() == 3
                );

            Assert.IsTrue(
                queueSystem.GetInactiveLaneCount() == 3
                );

            var laneList = new List <Lane>();

            var newLane1 = queueSystem.GetQueueLane(1);
            var newLane2 = queueSystem.GetQueueLane(2);
            var newLane3 = queueSystem.GetQueueLane(3);

            Assert.IsNotNull(newLane1);
            Assert.IsNotNull(newLane2);
            Assert.IsNotNull(newLane3);

            laneList.Add(newLane1);
            laneList.Add(newLane2);
            laneList.Add(newLane3);

            //LANE INSTANCE END
            //QUEUEATTENDANT INSTANCE START
            var  testUserList = new List <QueueAttendant>();
            char letter       = 'A';

            for (int i = 0; i < 3; i++)
            {
                var testUser1 = new QueueAttendant();

                testUser1.SetFullName(
                    letter.ToString(),
                    new string(letter, i + 1),
                    new string(letter, i + 2));
                testUser1.SetEmail(letter + "@email.com");
                testUser1.SetContactNumber("12345678901");
                testUser1.SetPassword(new string(letter, 3));
                testUser1.DesignatedLane = null; //leave it unset

                testUserList.Add(testUser1);
                letter++;
            }


            //add three queue attendants
            for (int i = 0; i < testUserList.Count; i++)
            {
                Assert.IsTrue(
                    loginSystem.RegisterAsQueueAttendant(testUserList[i])
                    );

                testUserList[i] = loginSystem.LoginAsQueueAttendant(
                    testUserList[i].GetEmail(),
                    testUserList[i].GetPassword()
                    );

                Assert.IsNotNull(
                    testUserList[i]
                    );
            }
            //QUEUEATTENDANT INSTANCE END

            //LANE QUEUE INSTANCE START
            var lqList = new List <LaneQueue>();

            for (int i = 0; i < 3; i++)
            {
                //consider max. 12 hours for priority numbers
                var tolerance = TimeSpan.FromHours(12);

                Assert.IsTrue(
                    queueSystem.SetLaneActive(
                        laneList[i].LaneNumber,
                        testUserList[i],
                        tolerance
                        )
                    );
            }

            Assert.IsTrue(
                queueSystem.GetActiveLaneCount() == 3
                );

            //LANE QUEUE INSTANCE END
        }
Esempio n. 8
0
        public void AddLaneQueueTest_QueueMechanismTest3()
        {
            var testLane1 = new Lane();

            testLane1.LaneNumber = 1;
            testLane1.LaneName   = "Test Lane 1";
            testLane1.Capacity   = 15;

            Assert.IsTrue(
                dal.AddLane(testLane1)
                );

            testLane1 = dal.GetLaneWithLaneNumber(1);

            Assert.IsNotNull(
                testLane1
                );

            var testUserList = new List <User>();

            char letter = 'B';

            for (int i = 0; i < 10; i++)
            {
                var testUser1 = new User();
                letter++;

                testUser1.SetFullName(
                    new string(letter, 1),
                    new string(letter, 2),
                    new string(letter, 3));
                testUser1.SetEmail(letter + "@email.com");
                testUser1.SetContactNumber("12345678901");
                testUser1.SetPassword("password");

                testUserList.Add(testUser1);
            }

            for (int i = 0; i < testUserList.Count; i++)
            {
                Assert.IsTrue(
                    dal.AddUser(testUserList[i])
                    );

                testUserList[i] = dal.GetUserWithEmail(testUserList[i].GetEmail());

                Assert.IsNotNull(
                    testUserList[i]
                    );
            }

            var testAttendant1 = new QueueAttendant();

            testAttendant1.SetFullName("A", "AA", "AAA");
            testAttendant1.SetEmail("*****@*****.**");
            testAttendant1.SetContactNumber("12345678901");
            testAttendant1.SetPassword("AAA");
            testAttendant1.DesignatedLane.LaneID = testLane1.LaneID;

            Assert.IsTrue(
                dal.AddQueueAttendant(testAttendant1)
                );

            testAttendant1 = dal.GetQueueAttendantWithEmail("*****@*****.**");

            Assert.IsNotNull(
                testAttendant1
                );

            var testUserTicketList = new List <QueueTicket>();

            for (int i = 0; i < testUserList.Count; i++)
            {
                var testUser1Ticket = new QueueTicket();
                testUser1Ticket.owner     = testUserList[i];
                testUser1Ticket.QueueLane = testLane1;
                testUser1Ticket.Status    = QueueStatus.WAITING;
                //create a test ticket with high priority within tolerance
                //this should be at the front of the list when queued
                if (i == 7)
                {
                    testUser1Ticket.PriorityNumber = 2;
                }

                //create a test old ticket with high priority outside tolerance,
                //this should be at the front of the list when queued
                if (i == 9)
                {
                    testUser1Ticket.PriorityNumber = 10;
                    testUser1Ticket.QueueDateTime  = DateTime.Now.Subtract(TimeSpan.FromDays(2));
                }

                Assert.IsTrue(
                    dal.AddQueueTicket(
                        testUser1Ticket,
                        queueStatusMapper
                        )
                    );
            }

            //Lane Queue Start

            var testLaneQueue1 = new LaneQueue();

            testLaneQueue1.SetQueueLane(testLane1);
            testLaneQueue1.SetAttendant(testAttendant1);
            testLaneQueue1.Tolerance = TimeSpan.FromHours(3);

            Assert.IsTrue(
                dal.AddLaneQueue(testLaneQueue1)
                );

            testLaneQueue1 = dal.GetLaneQueueWithLaneID(testLane1.LaneID);

            Assert.IsNotNull(
                testLaneQueue1
                );

            testLaneQueue1.SetQueueList(dal.GetQueueTicketsWithLaneIDAndStatus(
                                            testLane1.LaneID, QueueStatus.WAITING, queueStatusMapper
                                            ));

            Assert.IsFalse(
                testLaneQueue1.QueueList.Count == 0
                );

            //verify that the priority mechanic is working
            // tolerances working (old ticket outside of tolerance automatically has highest priority)
            Assert.AreEqual(
                testUserList[9].GetLastName(),
                (testLaneQueue1.DequeueTicket().owner as User).GetLastName()
                );

            //priorities working, higher priorities go earlier in queues
            Assert.AreEqual(
                testUserList[7].GetLastName(),
                (testLaneQueue1.DequeueTicket().owner as User).GetLastName()
                );

            //create two new priority tickets within tolerance with the same priority
            var testUser1Ticket1 = new QueueTicket();

            testUser1Ticket1.owner          = testUserList[3];
            testUser1Ticket1.QueueLane      = testLane1;
            testUser1Ticket1.Status         = QueueStatus.WAITING;
            testUser1Ticket1.PriorityNumber = 1;

            var testUser1Ticket2 = new QueueTicket();

            testUser1Ticket2.owner          = testUserList[2];
            testUser1Ticket2.QueueLane      = testLane1;
            testUser1Ticket2.Status         = QueueStatus.WAITING;
            testUser1Ticket2.PriorityNumber = 1;

            testLaneQueue1.EnqueueTicket(testUser1Ticket1);
            testLaneQueue1.EnqueueTicket(testUser1Ticket2);

            Assert.AreEqual(
                testUserList[3].GetLastName(),
                (testLaneQueue1.DequeueTicket().owner as User).GetLastName()
                );

            Assert.AreEqual(
                testUserList[2].GetLastName(),
                (testLaneQueue1.DequeueTicket().owner as User).GetLastName()
                );

            //Lane Queue End
        }
Esempio n. 9
0
        public void AddLaneQueueTest_QueueMechanismTest1()
        {
            var testLane1 = new Lane();

            testLane1.LaneNumber = 1;
            testLane1.LaneName   = "Test Lane 1";
            testLane1.Capacity   = 10;

            Assert.IsTrue(
                dal.AddLane(testLane1)
                );

            testLane1 = dal.GetLaneWithLaneNumber(1);

            Assert.IsNotNull(
                testLane1
                );

            var testUserList = new List <User>();

            char letter = 'B';

            for (int i = 0; i < 10; i++)
            {
                var testUser1 = new User();
                letter++;

                testUser1.SetFullName(
                    new string(letter, 1),
                    new string(letter, 2),
                    new string(letter, 3));
                testUser1.SetEmail(letter + "@email.com");
                testUser1.SetContactNumber("12345678901");
                testUser1.SetPassword("password");

                testUserList.Add(testUser1);
            }

            for (int i = 0; i < testUserList.Count; i++)
            {
                Assert.IsTrue(
                    dal.AddUser(testUserList[i])
                    );

                testUserList[i] = dal.GetUserWithEmail(testUserList[i].GetEmail());

                Assert.IsNotNull(
                    testUserList[i]
                    );
            }

            var testAttendant1 = new QueueAttendant();

            testAttendant1.SetFullName("A", "AA", "AAA");
            testAttendant1.SetEmail("*****@*****.**");
            testAttendant1.SetContactNumber("12345678901");
            testAttendant1.SetPassword("AAA");
            testAttendant1.DesignatedLane.LaneID = testLane1.LaneID;

            Assert.IsTrue(
                dal.AddQueueAttendant(testAttendant1)
                );

            testAttendant1 = dal.GetQueueAttendantWithEmail("*****@*****.**");

            Assert.IsNotNull(
                testAttendant1
                );

            var testUserTicketList = new List <QueueTicket>();

            for (int i = 0; i < testUserList.Count; i++)
            {
                var testUser1Ticket = new QueueTicket();
                testUser1Ticket.owner     = testUserList[i];
                testUser1Ticket.QueueLane = testLane1;
                testUser1Ticket.Status    = QueueStatus.WAITING;
                if (i == 9)
                {
                    testUser1Ticket.PriorityNumber = 1;
                }

                Assert.IsTrue(
                    dal.AddQueueTicket(
                        testUser1Ticket,
                        queueStatusMapper
                        )
                    );
            }

            //Lane Queue Start

            var testLaneQueue1 = new LaneQueue();

            testLaneQueue1.SetQueueLane(testLane1);
            testLaneQueue1.SetAttendant(testAttendant1);

            Assert.IsTrue(
                dal.AddLaneQueue(testLaneQueue1)
                );

            testLaneQueue1 = dal.GetLaneQueueWithLaneID(testLane1.LaneID);

            Assert.IsNotNull(
                testLaneQueue1
                );

            testLaneQueue1.SetQueueList(dal.GetQueueTicketsWithLaneIDAndStatus(
                                            testLane1.LaneID, QueueStatus.WAITING, queueStatusMapper
                                            ));

            Assert.IsFalse(
                testLaneQueue1.QueueList.Count == 0
                );

            //verify that the priority mechanic is working
            Assert.AreEqual(
                testUserList[9].GetLastName(),
                (testLaneQueue1.DequeueTicket().owner as User).GetLastName()
                );

            //Lane Queue End
        }
Esempio n. 10
0
        public void AddLaneQueueTest()
        {
            var testLane1 = new Lane();

            testLane1.LaneNumber = 1;
            testLane1.LaneName   = "Test Lane 1";
            testLane1.Capacity   = 10;

            Assert.IsTrue(
                dal.AddLane(testLane1)
                );

            testLane1 = dal.GetLaneWithLaneNumber(1);

            Assert.IsNotNull(
                testLane1
                );

            var testUser1 = new User();

            testUser1.SetFullName("B", "BB", "BBB");
            testUser1.SetEmail("*****@*****.**");
            testUser1.SetContactNumber("12345678901");
            testUser1.SetPassword("BBB");

            Assert.IsTrue(
                dal.AddUser(testUser1)
                );

            testUser1 = dal.GetUserWithEmail(testUser1.GetEmail());

            Assert.IsNotNull(
                testUser1
                );

            var testAttendant1 = new QueueAttendant();

            testAttendant1.SetFullName("A", "AA", "AAA");
            testAttendant1.SetEmail("*****@*****.**");
            testAttendant1.SetContactNumber("12345678901");
            testAttendant1.SetPassword("AAA");
            testAttendant1.DesignatedLane.LaneID = testLane1.LaneID;

            Assert.IsTrue(
                dal.AddQueueAttendant(testAttendant1)
                );

            testAttendant1 = dal.GetQueueAttendantWithEmail("*****@*****.**");

            Assert.IsNotNull(
                testAttendant1
                );

            var testUser1Ticket = new QueueTicket();

            testUser1Ticket.owner     = testUser1;
            testUser1Ticket.QueueLane = testLane1;
            testUser1Ticket.Status    = QueueStatus.WAITING;

            Assert.IsTrue(
                dal.AddQueueTicket(
                    testUser1Ticket,
                    queueStatusMapper
                    )
                );

            //Lane Queue Start

            var testLaneQueue1 = new LaneQueue();

            testLaneQueue1.SetQueueLane(testLane1);
            testLaneQueue1.SetAttendant(testAttendant1);

            Assert.IsTrue(
                dal.AddLaneQueue(testLaneQueue1)
                );

            testLaneQueue1 = dal.GetLaneQueueWithLaneID(testLane1.LaneID);

            Assert.IsNotNull(
                testLaneQueue1
                );

            testLaneQueue1.SetQueueList(dal.GetQueueTicketsWithLaneIDAndStatus(
                                            testLane1.LaneID, QueueStatus.WAITING, queueStatusMapper
                                            ));

            Assert.IsFalse(
                testLaneQueue1.QueueList.Count == 0
                );

            //Lane Queue End
        }