public void FilterOccurrences_Should_Return_List_When_Special_Needs_Valid()
        {
            using (new TransactionScope())
            {
                var person                = CheckInTestSetup.SetupPhoneSearch();
                var kiosk                 = CheckInTestSetup.SetupKiosk();
                var occurrence            = CheckInTestSetup.SetupOccurrenceSearchSpecialNeeds(kiosk);
                List <Occurrence> classes = new List <Occurrence> {
                    occurrence
                };
                List <DateTime> times = new List <DateTime> {
                    occurrence.StartTime
                };

                var maxAbility   = CheckInTestSetup.SetupPersonAttribute(person);
                var specialNeeds = CheckInTestSetup.SetupPersonAttribute(person);
                specialNeeds.IntValue = 1;
                specialNeeds.Save(CheckInTestConstants.USER_ID);

                var result = CheckInController.FilterOccurrences(
                    classes, person, times, maxAbility.AttributeId, specialNeeds.AttributeId);

                Assert.IsInstanceOf(typeof(Occurrence), result.First());
                Assert.AreEqual(occurrence.OccurrenceID, result.First().OccurrenceID);
            }
        }
        public void CheckInFamily_Should_Return_Valid_When_Successful()
        {
            using (new TransactionScope())
            {
                var person     = CheckInTestSetup.SetupPhoneSearch();
                var kiosk      = CheckInTestSetup.SetupKiosk();
                var occurrence = CheckInTestSetup.SetupOccurrenceSearch(kiosk);
                PersonCheckInRequest request = new PersonCheckInRequest
                {
                    PersonID     = person.PersonID,
                    FamilyMember = person,
                    Occurrences  = new List <Occurrence> {
                        occurrence
                    }
                };

                var familyMap = new List <PersonCheckInRequest> {
                    request
                };
                var results  = CheckInController.CheckInFamily(new MockPrintLabel(), person.FamilyID, familyMap, kiosk);
                var location = new Location(occurrence.LocationID);
                var result   = results.First();

                Assert.IsTrue(result.CheckInResults.All(r => r.IsCheckInSuccessful));
                Assert.AreEqual(location.CurrentCount, 1);
            }
        }
        public void FilterOccurrences_Should_Return_Empty_When_Last_Name_Invalid()
        {
            using (new TransactionScope())
            {
                var person = CheckInTestSetup.SetupPhoneSearch();
                person.LastName = "Zeeeeeeee";
                person.Save(1, CheckInTestConstants.USER_ID, false);
                var kiosk                 = CheckInTestSetup.SetupKiosk();
                var occurrence            = CheckInTestSetup.SetupOccurrenceSearchLastName(kiosk);
                List <Occurrence> classes = new List <Occurrence> {
                    occurrence
                };
                List <DateTime> times = new List <DateTime> {
                    occurrence.StartTime
                };

                var maxAbility   = CheckInTestSetup.SetupPersonAttribute(person);
                var specialNeeds = CheckInTestSetup.SetupPersonAttribute(person);

                var result = CheckInController.FilterOccurrences(
                    classes, person, times, maxAbility.AttributeId, specialNeeds.AttributeId);

                Assert.IsInstanceOf(typeof(EmptyOccurrence), result.First());
            }
        }
        public void FilterOccurrences_Should_Return_Empty_When_Location_Closed()
        {
            using (new TransactionScope())
            {
                var person     = CheckInTestSetup.SetupPhoneSearch();
                var kiosk      = CheckInTestSetup.SetupKiosk();
                var occurrence = CheckInTestSetup.SetupOccurrenceSearch(kiosk);
                var location   = new Location(occurrence.LocationID)
                {
                    RoomClosed = true
                };
                location.Save(CheckInTestConstants.USER_ID);
                List <Occurrence> classes = new List <Occurrence> {
                    occurrence
                };
                List <DateTime> times = new List <DateTime> {
                    occurrence.StartTime
                };

                var maxAbility   = CheckInTestSetup.SetupPersonAttribute(person);
                var specialNeeds = CheckInTestSetup.SetupPersonAttribute(person);

                var result = CheckInController.FilterOccurrences(
                    classes, person, times, maxAbility.AttributeId, specialNeeds.AttributeId);

                Assert.IsInstanceOf(typeof(EmptyOccurrence), result.First());
            }
        }
        public void FilterOccurrences_Should_Return_Empty_When_Person_Grade_Too_High()
        {
            using (new TransactionScope())
            {
                var person = CheckInTestSetup.SetupPhoneSearch();
                person.GraduationDate = DateTime.Now.AddYears(1);
                person.Save(1, CheckInTestConstants.USER_ID, false);
                var kiosk      = CheckInTestSetup.SetupKiosk();
                var occurrence = CheckInTestSetup.SetupOccurrenceSearch(kiosk);
                occurrence.OccurrenceType.MaxGrade = 6;
                occurrence.OccurrenceType.Save(CheckInTestConstants.USER_ID);
                List <Occurrence> classes = new List <Occurrence> {
                    occurrence
                };
                List <DateTime> times = new List <DateTime> {
                    occurrence.StartTime
                };

                var maxAbility   = CheckInTestSetup.SetupPersonAttribute(person);
                var specialNeeds = CheckInTestSetup.SetupPersonAttribute(person);

                var result = CheckInController.FilterOccurrences(
                    classes, person, times, maxAbility.AttributeId, specialNeeds.AttributeId);

                Assert.IsInstanceOf(typeof(EmptyOccurrence), result.First());
            }
        }
 public void GetOccurrences_Should_Return_Empty_When_No_Occurrences_Found()
 {
     using (new TransactionScope())
     {
         var kiosk  = CheckInTestSetup.SetupKiosk();
         var result = CheckInController.GetOccurrences(DateTime.Now.AddMinutes(2), DateTime.Now, kiosk);
         Assert.IsEmpty(result);
     }
 }
        public void GetCurrentKiosk_Should_Return_Kiosk_When_IP_Is_Valid()
        {
            using (new TransactionScope())
            {
                CheckInTestSetup.SetupKiosk();
                var result = CheckInController.GetCurrentKiosk(Dns.GetHostName());

                Assert.IsNotNull(result);
                Assert.AreNotEqual(result.SystemId, Constants.NULL_INT);
            }
        }
 public void GetAttendance_Should_Return_Null_When_Attendance_Not_Found()
 {
     using (new TransactionScope())
     {
         var kiosk      = CheckInTestSetup.SetupKiosk();
         var occurrence = CheckInTestSetup.SetupOccurrenceSearch(kiosk);
         var attendee   = CheckInTestFactories.CreateFamilyMember();
         attendee.Save(1, CheckInTestConstants.USER_ID, false);
         var result = CheckInController.GetAttendance(occurrence.StartTime, attendee.PersonID);
         Assert.IsNull(result);
     }
 }
        public void GetOccurrences_Should_Return_List_When_Occurrences_Found()
        {
            using (new TransactionScope())
            {
                var kiosk = CheckInTestSetup.SetupKiosk();
                CheckInTestSetup.SetupOccurrenceSearch(kiosk);
                var result = CheckInController.GetOccurrences(DateTime.Now.AddMinutes(30), DateTime.Now, kiosk);

                Assert.IsNotEmpty(result);
                Assert.AreNotEqual(result[0].OccurrenceID, Constants.NULL_INT);
            }
        }
        public void Print_Should_Return_True_When_Successful()
        {
            using (new TransactionScope())
            {
                var person     = CheckInTestSetup.SetupPhoneSearch();
                var kiosk      = CheckInTestSetup.SetupKiosk();
                var occurrence = CheckInTestSetup.SetupOccurrenceSearch(kiosk);
                var attendance = CheckInTestFactories.CreateAttendance(occurrence, person);
                attendance.Save(CheckInTestConstants.USER_ID);

                var result = CheckInController.Print(new MockPrintLabel(), person,
                                                     new List <Occurrence> {
                    occurrence
                }, attendance, kiosk);

                Assert.IsTrue(result);
            }
        }
        public void FilterOccurrences_Should_Return_Result_When_Multiple_Locations_Available()
        {
            using (new TransactionScope())
            {
                var person = CheckInTestSetup.SetupPhoneSearch();
                var kiosk  = CheckInTestSetup.SetupKiosk();
                List <Occurrence> classes = CheckInTestSetup.SetupOccurrenceSearchMultipleOccurrences(kiosk);
                List <DateTime>   times   = new List <DateTime> {
                    classes.First().StartTime
                };

                var maxAbility   = CheckInTestSetup.SetupPersonAttribute(person);
                var specialNeeds = CheckInTestSetup.SetupPersonAttribute(person);

                var result = CheckInController.FilterOccurrences(
                    classes, person, times, maxAbility.AttributeId, specialNeeds.AttributeId);

                Assert.AreEqual(result.Count, 1);
                Assert.IsInstanceOf(typeof(Occurrence), result.First());
            }
        }
        public void FilterOccurrences_Should_Return_Empty_When_Membership_Required_Invalid()
        {
            using (new TransactionScope())
            {
                var person                = CheckInTestSetup.SetupPhoneSearch();
                var kiosk                 = CheckInTestSetup.SetupKiosk();
                var occurrence            = CheckInTestSetup.SetupOccurrenceSearchInvalidMembershipRequired(kiosk, person);
                List <Occurrence> classes = new List <Occurrence> {
                    occurrence
                };
                List <DateTime> times = new List <DateTime> {
                    occurrence.StartTime
                };

                var maxAbility   = CheckInTestSetup.SetupPersonAttribute(person);
                var specialNeeds = CheckInTestSetup.SetupPersonAttribute(person);

                var result = CheckInController.FilterOccurrences(
                    classes, person, times, maxAbility.AttributeId, specialNeeds.AttributeId);

                Assert.IsInstanceOf(typeof(EmptyOccurrence), result.First());
            }
        }