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 }
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 }