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_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 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 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_No_Classes_Found()
        {
            using (new TransactionScope())
            {
                var person = CheckInTestSetup.SetupPhoneSearch();
                List <Occurrence> classes = new List <Occurrence>();
                List <DateTime>   times   = new List <DateTime> {
                    DateTime.Now
                };

                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_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());
            }
        }