Esempio n. 1
0
        public static PersonWrapper GetPersonWrapper(int age = 35, int personType = Constants.PersonType.FULL_TIME_WORKER, int gender = 1, int workerType = 0, int studentType = 0, List <IPerson> persons = null, HouseholdWrapper household = null, int income = 25000, int sequence = 0)
        {
            if (persons == null)
            {
                persons = new List <IPerson>
                {
                    new Person()
                    {
                        Age         = age,
                        PersonType  = personType,
                        Gender      = gender,
                        WorkerType  = workerType,
                        StudentType = studentType,
                        Sequence    = sequence,
                    }
                };
            }
            if (household == null)
            {
                household = GetHouseholdWrapper(persons, income: income);
            }
            household.Init();
            PersonWrapper wrapper = new PersonWrapper(persons[0], household);

            return(wrapper);
        }
Esempio n. 2
0
        public void TestPersonWrapperTransitFareDiscountFraction()
        {
            Global.Configuration = new Configuration {
                HouseholdSamplingRateOneInX = 1
            };
            Global.Configuration.PathImpedance_TransitUseFareDiscountFractions = false;
            List <IPerson> persons = new List <IPerson>()
            {
                new Person()
                {
                    Age = 4,
                    TransitPassOwnership = 1,
                    PersonType           = Constants.PersonType.CHILD_UNDER_5,
                }
            };
            HouseholdWrapper household = TestHelper.GetHouseholdWrapper(persons);

            household.Init();
            PersonWrapper wrapper = new PersonWrapper(persons[0], household)
            {
            };

            Assert.Equal(0, wrapper.TransitFareDiscountFraction);
            Global.Configuration.PathImpedance_TransitUseFareDiscountFractions = true;
            Global.Configuration.IncludeTransitPassOwnershipModel = true;
            Assert.Equal(1, wrapper.TransitFareDiscountFraction);

            Global.Configuration.IncludeTransitPassOwnershipModel            = false;
            Global.Configuration.Policy_UniversalTransitFareDiscountFraction = .1;
            Assert.Equal(.1, wrapper.TransitFareDiscountFraction);

            Global.Configuration.PathImpedance_TransitFareDiscountFractionChildUnder5 = .2;
            Global.Configuration.Policy_UniversalTransitFareDiscountFraction          = 0;
            Assert.Equal(.2, wrapper.TransitFareDiscountFraction);

            wrapper = TestHelper.GetPersonWrapper(personType: Constants.PersonType.CHILD_AGE_5_THROUGH_15);
            Global.Configuration.PathImpedance_TransitFareDiscountFractionChild5To15 = .3;
            Assert.Equal(.3, wrapper.TransitFareDiscountFraction);

            wrapper = TestHelper.GetPersonWrapper(personType: Constants.PersonType.DRIVING_AGE_STUDENT);
            Global.Configuration.PathImpedance_TransitFareDiscountFractionHighSchoolStudent = .4;
            Assert.Equal(.4, wrapper.TransitFareDiscountFraction);

            wrapper = TestHelper.GetPersonWrapper(personType: Constants.PersonType.UNIVERSITY_STUDENT);
            Global.Configuration.PathImpedance_TransitFareDiscountFractionUniverityStudent = .5;
            Assert.Equal(.5, wrapper.TransitFareDiscountFraction);

            wrapper = TestHelper.GetPersonWrapper(age: 65);
            Global.Configuration.PathImpedance_TransitFareDiscountFractionAge65Up = .6;
            Assert.Equal(.6, wrapper.TransitFareDiscountFraction);

            wrapper = TestHelper.GetPersonWrapper(age: 64);
            Assert.Equal(0, wrapper.TransitFareDiscountFraction);
        }
Esempio n. 3
0
        public void TestHouseholdWrapperFractionWorkersWithJobsOutsideRegion()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 1;
            List <IPerson> persons = new List <IPerson> {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                }
            };
            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons, fractionWorkersWithJobsOutsideRegion: .24);

            wrapper.Init();
            Assert.Equal(.24, wrapper.FractionWorkersWithJobsOutsideRegion);
        }
Esempio n. 4
0
        public void TestHouseholdWrapperExpansionFactor()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 1;
            List <IPerson> persons = new List <IPerson> {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                }
            };
            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons, expansionFactor: .25);

            wrapper.Init();
            Assert.Equal(.25, wrapper.ExpansionFactor);

            Global.Configuration.HouseholdSamplingRateOneInX = 4;
            wrapper = TestHelper.GetHouseholdWrapper(persons, expansionFactor: .25);
            wrapper.Init();
            Assert.Equal(1, wrapper.ExpansionFactor);

            Global.Configuration.HouseholdSamplingRateOneInX = 256;
            wrapper = TestHelper.GetHouseholdWrapper(persons, expansionFactor: .25);
            wrapper.Init();
            Assert.Equal(64, wrapper.ExpansionFactor);
        }
Esempio n. 5
0
        public void TestHouseholdWrapper()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 256;

            const int id = 3;

            List <IPerson> persons = new List <IPerson> {
                new Person {
                    HouseholdId = id, Age = 20, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 35, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 20, PersonType = Constants.PersonType.PART_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 35, PersonType = Constants.PersonType.PART_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 10, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15
                },
            };

            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons);

            wrapper.Init();

            Assert.Equal(1, wrapper.HouseholdDays.Count);
            Assert.Equal(0, wrapper.HouseholdDays[0].AttemptedSimulations);
            Assert.Equal(0, wrapper.HouseholdDays[0].FullHalfTours);
            Assert.Equal(id, wrapper.HouseholdDays[0].Household.Id);
            Assert.Equal(false, wrapper.HouseholdDays[0].IsMissingData);
            Assert.Equal(0, wrapper.HouseholdDays[0].JointTours);
            Assert.Equal(0, wrapper.HouseholdDays[0].PartialHalfTours);
            Assert.Equal(7, wrapper.HouseholdDays[0].PersonDays.Count);
        }
Esempio n. 6
0
        public void TestAutoOwnershipModel()
        {
            Global.Configuration = new Configuration {
                NProcessors = 1
            };
            ParallelUtility.Init();
            Global.Configuration.AutoOwnershipModelCoefficients = "c:\\a.txt";
            ParallelUtility.Register(Thread.CurrentThread.ManagedThreadId, 0);
            List <IPerson> persons = new List <IPerson> {
                new Person()
            };
            CondensedParcel  residenceParcel = new CondensedParcel();
            HouseholdWrapper household       = TestHelper.GetHouseholdWrapper(persons, residenceParcel: residenceParcel);

            household.Init();
            AutoOwnershipModel model = new AutoOwnershipModel();

            model.RunInitialize(new TestCoefficientsReader());
            model.Run(household);
        }
Esempio n. 7
0
        public static HouseholdDayWrapper GetHouseholdDayWrapper(HouseholdWrapper householdWrapper = null, Household household = null, int id = 3)
        {
            List <IPerson> persons = new List <IPerson> {
                new Person()
            };

            if (householdWrapper == null)
            {
                householdWrapper = GetHouseholdWrapper(persons, household: household);
            }
            householdWrapper.Init();
            Global.Configuration.DataType = "Default";
            PersonDayWrapperFactory factory = new PersonDayWrapperFactory();

            factory.Register("Default", new PersonDayWrapperCreator());
            factory.Initialize();
            return(new HouseholdDayWrapper(new HouseholdDay()
            {
                Id = id
            }, householdWrapper, factory));
        }
Esempio n. 8
0
        public void TestAutoOwnershipModelNullHouseholdException()
        {
            Global.Configuration = new Configuration {
                NProcessors = 1
            };
            ParallelUtility.Init();
            Global.Configuration.AutoOwnershipModelCoefficients = "c:\\a.txt";
            ParallelUtility.Register(Thread.CurrentThread.ManagedThreadId, 0);
            List <IPerson> persons = new List <IPerson> {
                new Person()
            };
            CondensedParcel  residenceParcel = new CondensedParcel();
            HouseholdWrapper household       = TestHelper.GetHouseholdWrapper(persons, residenceParcel: residenceParcel);

            household.Init();
            AutoOwnershipModel model = new AutoOwnershipModel();

            model.RunInitialize(new TestCoefficientsReader());
            ArgumentNullException ex = Assert.Throws <ArgumentNullException>(() => model.Run(null));

            Assert.Equal("Value cannot be null.\r\nParameter name: household", ex.Message);
        }
Esempio n. 9
0
        public void TestPersonWrapperCarOwnershipSegment()
        {
            Global.Configuration = new Configuration {
                HouseholdSamplingRateOneInX = 1
            };

            List <IPerson> persons = new List <IPerson>()
            {
                new Person()
                {
                    Age = 15
                }
            };
            HouseholdWrapper household = TestHelper.GetHouseholdWrapper(persons);

            household.Init();
            PersonWrapper wrapper = new PersonWrapper(persons[0], household)
            {
            };

            Assert.Equal(Constants.CarOwnership.CHILD, wrapper.CarOwnershipSegment);


            persons = new List <IPerson>()
            {
                new Person()
                {
                    Age = 25
                }
            };
            household = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 0);
            household.Init();
            wrapper = new PersonWrapper(persons[0], household)
            {
            };

            Assert.Equal(Constants.CarOwnership.NO_CARS, wrapper.CarOwnershipSegment);

            persons = new List <IPerson>()
            {
                new Person()
                {
                    Age = 25, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person()
                {
                    Age = 25, PersonType = Constants.PersonType.FULL_TIME_WORKER
                }
            };
            household = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 1);
            household.Init();
            wrapper = new PersonWrapper(persons[0], household)
            {
            };

            Assert.Equal(Constants.CarOwnership.LT_ONE_CAR_PER_ADULT, wrapper.CarOwnershipSegment);

            persons = new List <IPerson>()
            {
                new Person()
                {
                    Age = 25, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person()
                {
                    Age = 25, PersonType = Constants.PersonType.FULL_TIME_WORKER
                }
            };
            household = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 2);
            household.Init();
            wrapper = new PersonWrapper(persons[0], household)
            {
            };

            Assert.Equal(Constants.CarOwnership.ONE_OR_MORE_CARS_PER_ADULT, wrapper.CarOwnershipSegment);
        }
Esempio n. 10
0
        public void TestFullHalfTourWrapper()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 256;


            const int id              = 1;
            const int householdDayId  = 2;
            const int householdId     = 3;
            const int day             = 4;
            const int sequence        = 5;
            const int direction       = 6;
            const int participants    = 7;
            const int personSequence1 = 8;
            const int tourSequence1   = 9;
            const int personSequence2 = 10;
            const int tourSequence2   = 11;
            const int personSequence3 = 12;
            const int tourSequence3   = 13;
            const int personSequence4 = 14;
            const int tourSequence4   = 15;
            const int personSequence5 = 16;
            const int tourSequence5   = 17;
            const int personSequence6 = 18;
            const int tourSequence6   = 19;
            const int personSequence7 = 20;
            const int tourSequence7   = 21;
            const int personSequence8 = 22;
            const int tourSequence8   = 23;

            FullHalfTour tour = new FullHalfTour
            {
                Day             = day,
                HouseholdDayId  = householdDayId,
                HouseholdId     = householdId,
                Id              = id,
                Direction       = direction,
                Participants    = participants,
                PersonSequence1 = personSequence1,
                TourSequence1   = tourSequence1,
                PersonSequence2 = personSequence2,
                TourSequence2   = tourSequence2,
                PersonSequence3 = personSequence3,
                TourSequence3   = tourSequence3,
                PersonSequence4 = personSequence4,
                TourSequence4   = tourSequence4,
                PersonSequence5 = personSequence5,
                TourSequence5   = tourSequence5,
                PersonSequence6 = personSequence6,
                TourSequence6   = tourSequence6,
                PersonSequence7 = personSequence7,
                TourSequence7   = tourSequence7,
                PersonSequence8 = personSequence8,
                TourSequence8   = tourSequence8,
                Sequence        = sequence
            };

            List <IPerson> persons = new List <IPerson> {
                new Person()
            };

            HouseholdWrapper householdWrapper = TestHelper.GetHouseholdWrapper(persons);

            householdWrapper.Init();
            //HouseholdDayWrapper householdDayWrapper = new HouseholdDayWrapper(new HouseholdDay(), householdWrapper, new PersonDayWrapperFactory());

            HouseholdDayWrapper householdDayWrapper = TestHelper.GetHouseholdDayWrapper(householdWrapper);

            FullHalfTourWrapper.SetPersister(new PersisterWithHDF5 <FullHalfTour>(new TestFullHalfTourExporter()));
            FullHalfTourWrapper wrapper = new FullHalfTourWrapper(tour, householdDayWrapper);

            Assert.Equal(direction, wrapper.Direction);
            Assert.Equal(id, wrapper.Id);
            Assert.Equal(participants, wrapper.Participants);
            Assert.Equal(personSequence1, wrapper.PersonSequence1);
            Assert.Equal(tourSequence1, wrapper.TourSequence1);
            Assert.Equal(personSequence2, wrapper.PersonSequence2);
            Assert.Equal(tourSequence2, wrapper.TourSequence2);
            Assert.Equal(personSequence3, wrapper.PersonSequence3);
            Assert.Equal(tourSequence3, wrapper.TourSequence3);
            Assert.Equal(personSequence4, wrapper.PersonSequence4);
            Assert.Equal(tourSequence4, wrapper.TourSequence4);
            Assert.Equal(personSequence5, wrapper.PersonSequence5);
            Assert.Equal(tourSequence5, wrapper.TourSequence5);
            Assert.Equal(personSequence6, wrapper.PersonSequence6);
            Assert.Equal(tourSequence6, wrapper.TourSequence6);
            Assert.Equal(personSequence7, wrapper.PersonSequence7);
            Assert.Equal(tourSequence7, wrapper.TourSequence7);
            Assert.Equal(personSequence8, wrapper.PersonSequence8);
            Assert.Equal(tourSequence8, wrapper.TourSequence8);
            Assert.Equal(sequence, wrapper.Sequence);


            Assert.Equal(householdWrapper, wrapper.Household);
            Assert.Equal(householdDayWrapper, wrapper.HouseholdDay);


            Global.Configuration = new Configuration {
                HouseholdSamplingRateOneInX = 1
            };
        }
Esempio n. 11
0
        public void TestFullHalfTourSetParticipantTourSequence()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 256;


            const int id              = 1;
            const int householdDayId  = 2;
            const int householdId     = 3;
            const int day             = 4;
            const int sequence        = 5;
            const int direction       = 6;
            const int participants    = 7;
            const int personSequence1 = 8;
            const int tourSequence1   = 9;
            const int personSequence2 = 10;
            const int tourSequence2   = 11;
            const int personSequence3 = 12;
            const int tourSequence3   = 13;
            const int personSequence4 = 14;
            const int tourSequence4   = 15;
            const int personSequence5 = 16;
            const int tourSequence5   = 17;
            const int personSequence6 = 18;
            const int tourSequence6   = 19;
            const int personSequence7 = 20;
            const int tourSequence7   = 21;
            const int personSequence8 = 22;
            const int tourSequence8   = 23;

            FullHalfTour tour = new FullHalfTour
            {
                Day             = day,
                Direction       = direction,
                HouseholdDayId  = householdDayId,
                HouseholdId     = householdId,
                Id              = id,
                Participants    = participants,
                PersonSequence1 = personSequence1,
                TourSequence1   = tourSequence1,
                PersonSequence2 = personSequence2,
                TourSequence2   = tourSequence2,
                PersonSequence3 = personSequence3,
                TourSequence3   = tourSequence3,
                PersonSequence4 = personSequence4,
                TourSequence4   = tourSequence4,
                PersonSequence5 = personSequence5,
                TourSequence5   = tourSequence5,
                PersonSequence6 = personSequence6,
                TourSequence6   = tourSequence6,
                PersonSequence7 = personSequence7,
                TourSequence7   = tourSequence7,
                PersonSequence8 = personSequence8,
                TourSequence8   = tourSequence8,
                Sequence        = sequence
            };

            List <IPerson> persons = new List <IPerson> {
                new Person()
            };

            HouseholdWrapper householdWrapper = TestHelper.GetHouseholdWrapper(persons);

            householdWrapper.Init();
            //HouseholdDayWrapper householdDayWrapper = new HouseholdDayWrapper(new HouseholdDay(), householdWrapper, new PersonDayWrapperFactory());

            HouseholdDayWrapper householdDayWrapper = TestHelper.GetHouseholdDayWrapper(householdWrapper);

            FullHalfTourWrapper.SetPersister(new PersisterWithHDF5 <FullHalfTour>(new TestFullHalfTourExporter()));
            FullHalfTourWrapper wrapper = new FullHalfTourWrapper(tour, householdDayWrapper);

            int[] sequences  = new[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            int[] pSequences = new[] { personSequence1, personSequence2, personSequence3, personSequence4, personSequence5, personSequence6, personSequence7, personSequence8 };

            for (int x = 0; x < 8; x++)
            {
                PersonWrapper    person             = TestHelper.GetPersonWrapper(sequence: pSequences[x]);
                PersonDayWrapper personDay          = TestHelper.GetPersonDayWrapper(personWrapper: person, income: -1);
                const int        destinationPurpose = Constants.Purpose.BUSINESS;

                Global.Configuration.Coefficients_BaseCostCoefficientIncomeLevel     = 25000;
                Global.Configuration.Coefficients_StdDeviationTimeCoefficient_Other  = .75;
                Global.Configuration.Coefficients_MeanTimeCoefficient_Other          = .45;
                Global.Configuration.Coefficients_BaseCostCoefficientPerMonetaryUnit = 5;
                Tour        ptour       = new Tour();
                TourWrapper tourWrapper = new TourWrapper(ptour, personDay, destinationPurpose, false)
                {
                    Sequence = sequences[x]
                };
                wrapper.SetParticipantTourSequence(tourWrapper);

                Assert.Equal(sequences[x], GetWrapperTourSequence(wrapper, x));
            }
        }
Esempio n. 12
0
        public void TestFullHalfTourExport()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 256;


            const int id              = 1;
            const int householdDayId  = 2;
            const int householdId     = 3;
            const int day             = 4;
            const int sequence        = 5;
            const int participants    = 7;
            const int personSequence1 = 8;
            const int tourSequence1   = 9;
            const int personSequence2 = 10;
            const int tourSequence2   = 11;
            const int personSequence3 = 12;
            const int tourSequence3   = 13;
            const int personSequence4 = 14;
            const int tourSequence4   = 15;
            const int personSequence5 = 16;
            const int tourSequence5   = 17;
            const int personSequence6 = 18;
            const int tourSequence6   = 19;
            const int personSequence7 = 20;
            const int tourSequence7   = 21;
            const int personSequence8 = 22;
            const int tourSequence8   = 23;
            const int mainPurpose     = 24;

            JointTour tour = new JointTour()
            {
                Day             = day,
                MainPurpose     = mainPurpose,
                HouseholdDayId  = householdDayId,
                HouseholdId     = householdId,
                Id              = id,
                Participants    = participants,
                PersonSequence1 = personSequence1,
                TourSequence1   = tourSequence1,
                PersonSequence2 = personSequence2,
                TourSequence2   = tourSequence2,
                PersonSequence3 = personSequence3,
                TourSequence3   = tourSequence3,
                PersonSequence4 = personSequence4,
                TourSequence4   = tourSequence4,
                PersonSequence5 = personSequence5,
                TourSequence5   = tourSequence5,
                PersonSequence6 = personSequence6,
                TourSequence6   = tourSequence6,
                PersonSequence7 = personSequence7,
                TourSequence7   = tourSequence7,
                PersonSequence8 = personSequence8,
                TourSequence8   = tourSequence8,
                Sequence        = sequence
            };

            List <IPerson> persons = new List <IPerson> {
                new Person()
            };

            HouseholdWrapper householdWrapper = TestHelper.GetHouseholdWrapper(persons);

            householdWrapper.Init();

            HouseholdDayWrapper householdDayWrapper = TestHelper.GetHouseholdDayWrapper(householdWrapper);
            var exporter = new TestJointTourExporter();

            JointTourWrapper.SetPersister(new PersisterWithHDF5 <JointTour>(exporter));
            JointTourWrapper wrapper = new JointTourWrapper(tour, householdDayWrapper);

            Assert.Equal(false, exporter.HasWritten);
            Assert.Equal(0, ChoiceModelFactory.JointTourFileRecordsWritten);
            wrapper.Export();
            Assert.Equal(true, exporter.HasWritten);
            Assert.Equal(1, ChoiceModelFactory.JointTourFileRecordsWritten);
        }
Esempio n. 13
0
        public void TestHouseholdWrapperIncome()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 1;
            List <IPerson> persons = new List <IPerson> {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                }
            };
            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons, income: 25000);

            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(false, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(true, wrapper.Has25To45KIncome);
            Assert.Equal(true, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 24999);
            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(true, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 14999);
            wrapper.Init();
            Assert.Equal(true, wrapper.Has0To15KIncome);
            Assert.Equal(true, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 45000);
            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(false, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(true, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 74999);
            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(false, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(true, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 85000);
            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(false, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(true, wrapper.Has75KPlusIncome);
            Assert.Equal(true, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 100000);
            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(false, wrapper.Has0To25KIncome);
            Assert.Equal(true, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(true, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: 0);
            wrapper.Init();
            Assert.Equal(true, wrapper.Has0To15KIncome);
            Assert.Equal(true, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(false, wrapper.HasMissingIncome);
            Assert.Equal(true, wrapper.HasValidIncome);

            wrapper = TestHelper.GetHouseholdWrapper(persons, income: -1);
            wrapper.Init();
            Assert.Equal(false, wrapper.Has0To15KIncome);
            Assert.Equal(false, wrapper.Has0To25KIncome);
            Assert.Equal(false, wrapper.Has100KPlusIncome);
            Assert.Equal(false, wrapper.Has25To45KIncome);
            Assert.Equal(false, wrapper.Has25To50KIncome);
            Assert.Equal(false, wrapper.Has50To75KIncome);
            Assert.Equal(false, wrapper.Has75KPlusIncome);
            Assert.Equal(false, wrapper.Has75To100KIncome);
            Assert.Equal(true, wrapper.HasMissingIncome);
            Assert.Equal(false, wrapper.HasValidIncome);
        }
Esempio n. 14
0
        public void TestHouseholdWrapperCarsPerDriver()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 256;
            //var daysimModule = new DaysimModule();


            const int id = 3;

            List <IPerson> persons = new List <IPerson> {
                new Person {
                    HouseholdId = id, Age = 20, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 35, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 20, PersonType = Constants.PersonType.PART_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 35, PersonType = Constants.PersonType.PART_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 10, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15
                },
            };

            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 1000);

            wrapper.Init();

            Assert.Equal(1, wrapper.CarsPerDriver);            //Even though there are more than 1 car per driver, the max is 1

            persons = new List <IPerson> {
                new Person {
                    HouseholdId = id, Age = 20, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 35, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 20, PersonType = Constants.PersonType.PART_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 35, PersonType = Constants.PersonType.PART_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER
                },
                new Person {
                    HouseholdId = id, Age = 10, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 3);
            wrapper.Init();

            Assert.Equal(0, wrapper.CarsPerDriver);            //Even though there are more than 1 car per driver, the max is 1

            wrapper = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 6);
            wrapper.Init();

            Assert.Equal(1, wrapper.CarsPerDriver);            //Even though there are more than 1 car per driver, the max is 1

            wrapper = TestHelper.GetHouseholdWrapper(persons, vehiclesAvailable: 5);
            wrapper.Init();

            Assert.Equal(0, wrapper.CarsPerDriver);            //Even though there are more than 1 car per driver, the max is 1
        }
Esempio n. 15
0
        public void TestHouseholdWrapperHouseholdType()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 1;
            List <IPerson> persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.UNIVERSITY_STUDENT, WorkerType = 1, StudentType = 1
                }
            };
            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons, size: 1);

            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.INDIVIDUAL_WORKER_STUDENT, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.NON_WORKING_ADULT, WorkerType = 0, StudentType = 0
                }
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 1);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.INDIVIDUAL_NONWORKER_NONSTUDENT, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.NON_WORKING_ADULT, WorkerType = 0, StudentType = 0
                },
                new Person {
                    Age = 6, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15, WorkerType = 0, StudentType = 1
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 2);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.ONE_ADULT_WITH_CHILDREN, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1, StudentType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.PART_TIME_WORKER, WorkerType = 1, StudentType = 0
                },
                new Person {
                    Age = 6, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15, WorkerType = 0, StudentType = 1
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 3);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.TWO_PLUS_WORKER_STUDENT_ADULTS_WITH_CHILDREN, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1, StudentType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.NON_WORKING_ADULT, WorkerType = 0, StudentType = 0
                },
                new Person {
                    Age = 6, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15, WorkerType = 0, StudentType = 1
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 3);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.TWO_PLUS_ADULTS_ONE_PLUS_WORKERS_STUDENTS_WITH_CHILDREN, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1, StudentType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1, StudentType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 2);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.TWO_PLUS_WORKER_STUDENT_ADULTS_WITHOUT_CHILDREN, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1, StudentType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.NON_WORKING_ADULT, WorkerType = 0, StudentType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 2);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.ONE_PLUS_WORKER_STUDENT_ADULTS_AND_ONE_PLUS_NONWORKER_NONSTUDENT_ADULTS_WITHOUT_CHILDREN, wrapper.HouseholdType);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.NON_WORKING_ADULT, WorkerType = 0, StudentType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.NON_WORKING_ADULT, WorkerType = 0, StudentType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons, size: 2);
            wrapper.Init();
            Assert.Equal(Constants.HouseholdType.TWO_PLUS_NONWORKER_NONSTUDENT_ADULTS_WITHOUT_CHILDREN, wrapper.HouseholdType);
        }
Esempio n. 16
0
        public void TestHouseholdWrapperChildren()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 1;
            List <IPerson> persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                }
            };
            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons);

            wrapper.Init();

            Assert.Equal(false, wrapper.HasChildrenAge5Through15);
            Assert.Equal(false, wrapper.HasChildrenUnder16);
            Assert.Equal(false, wrapper.HasChildrenUnder5);
            Assert.Equal(false, wrapper.HasChildren);


            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 4, PersonType = Constants.PersonType.CHILD_UNDER_5, WorkerType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();

            Assert.Equal(false, wrapper.HasChildrenAge5Through15);
            Assert.Equal(true, wrapper.HasChildrenUnder16);
            Assert.Equal(true, wrapper.HasChildrenUnder5);
            Assert.Equal(true, wrapper.HasChildren);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 7, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15, WorkerType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();

            Assert.Equal(true, wrapper.HasChildrenAge5Through15);
            Assert.Equal(true, wrapper.HasChildrenUnder16);
            Assert.Equal(false, wrapper.HasChildrenUnder5);
            Assert.Equal(true, wrapper.HasChildren);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 7, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15, WorkerType = 0
                },
                new Person {
                    Age = 4, PersonType = Constants.PersonType.CHILD_UNDER_5, WorkerType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();

            Assert.Equal(true, wrapper.HasChildrenAge5Through15);
            Assert.Equal(true, wrapper.HasChildrenUnder16);
            Assert.Equal(true, wrapper.HasChildrenUnder5);
            Assert.Equal(true, wrapper.HasChildren);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 17, PersonType = Constants.PersonType.DRIVING_AGE_STUDENT, WorkerType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();

            Assert.Equal(false, wrapper.HasChildrenAge5Through15);
            Assert.Equal(false, wrapper.HasChildrenUnder16);
            Assert.Equal(false, wrapper.HasChildrenUnder5);
            Assert.Equal(true, wrapper.HasChildren);
        }
Esempio n. 17
0
        public void TestHouseholdWrapperCarsLessFlag()
        {
            Global.Configuration = new Configuration();
            Global.Configuration.HouseholdSamplingRateOneInX = 1;
            List <IPerson> persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                }
            };
            HouseholdWrapper wrapper = TestHelper.GetHouseholdWrapper(persons);

            wrapper.Init();
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(0));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(0));
            Assert.Equal(true, wrapper.Has1Driver);
            Assert.Equal(false, wrapper.Has2Drivers);
            Assert.Equal(false, wrapper.Has3Drivers);
            Assert.Equal(false, wrapper.Has4OrMoreDrivers);
            Assert.Equal(true, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(false, wrapper.HasMoreDriversThan1);
            Assert.Equal(false, wrapper.HasMoreDriversThan2);
            Assert.Equal(false, wrapper.HasMoreDriversThan3);
            Assert.Equal(false, wrapper.HasMoreDriversThan4);
            Assert.Equal(false, wrapper.HasNoFullOrPartTimeWorker);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                }
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(false, wrapper.Has1Driver);
            Assert.Equal(true, wrapper.Has2Drivers);
            Assert.Equal(false, wrapper.Has3Drivers);
            Assert.Equal(false, wrapper.Has4OrMoreDrivers);
            Assert.Equal(true, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.HasMoreDriversThan1);
            Assert.Equal(false, wrapper.HasMoreDriversThan2);
            Assert.Equal(false, wrapper.HasMoreDriversThan3);
            Assert.Equal(false, wrapper.HasMoreDriversThan4);
            Assert.Equal(false, wrapper.HasNoFullOrPartTimeWorker);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 7, PersonType = Constants.PersonType.CHILD_AGE_5_THROUGH_15, StudentType = 1
                }
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(false, wrapper.Has1Driver);
            Assert.Equal(true, wrapper.Has2Drivers);
            Assert.Equal(false, wrapper.Has3Drivers);
            Assert.Equal(false, wrapper.Has4OrMoreDrivers);
            Assert.Equal(true, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.HasMoreDriversThan1);
            Assert.Equal(false, wrapper.HasMoreDriversThan2);
            Assert.Equal(false, wrapper.HasMoreDriversThan3);
            Assert.Equal(false, wrapper.HasMoreDriversThan4);
            Assert.Equal(false, wrapper.HasNoFullOrPartTimeWorker);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(3));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(3));
            Assert.Equal(false, wrapper.Has1Driver);
            Assert.Equal(false, wrapper.Has2Drivers);
            Assert.Equal(true, wrapper.Has3Drivers);
            Assert.Equal(false, wrapper.Has4OrMoreDrivers);
            Assert.Equal(false, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.HasMoreDriversThan1);
            Assert.Equal(true, wrapper.HasMoreDriversThan2);
            Assert.Equal(false, wrapper.HasMoreDriversThan3);
            Assert.Equal(false, wrapper.HasMoreDriversThan4);
            Assert.Equal(false, wrapper.HasNoFullOrPartTimeWorker);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.PART_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.RETIRED_ADULT, WorkerType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(3));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(3));
            Assert.Equal(false, wrapper.Has1Driver);
            Assert.Equal(false, wrapper.Has2Drivers);
            Assert.Equal(true, wrapper.Has3Drivers);
            Assert.Equal(false, wrapper.Has4OrMoreDrivers);
            Assert.Equal(true, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.HasMoreDriversThan1);
            Assert.Equal(true, wrapper.HasMoreDriversThan2);
            Assert.Equal(false, wrapper.HasMoreDriversThan3);
            Assert.Equal(false, wrapper.HasMoreDriversThan4);
            Assert.Equal(false, wrapper.HasNoFullOrPartTimeWorker);

            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.PART_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.RETIRED_ADULT, WorkerType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.FULL_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.PART_TIME_WORKER, WorkerType = 1
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.RETIRED_ADULT, WorkerType = 0
                },
                new Person {
                    Age = 37, PersonType = Constants.PersonType.PART_TIME_WORKER, WorkerType = 1
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(1, wrapper.GetCarsLessThanDriversFlag(3));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(1, wrapper.GetCarsLessThanWorkersFlag(3));
            Assert.Equal(false, wrapper.Has1Driver);
            Assert.Equal(false, wrapper.Has2Drivers);
            Assert.Equal(false, wrapper.Has3Drivers);
            Assert.Equal(true, wrapper.Has4OrMoreDrivers);
            Assert.Equal(false, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(false, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(false, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.HasMoreDriversThan1);
            Assert.Equal(true, wrapper.HasMoreDriversThan2);
            Assert.Equal(true, wrapper.HasMoreDriversThan3);
            Assert.Equal(true, wrapper.HasMoreDriversThan4);
            Assert.Equal(false, wrapper.HasNoFullOrPartTimeWorker);


            persons = new List <IPerson>
            {
                new Person {
                    Age = 37, PersonType = Constants.PersonType.RETIRED_ADULT, WorkerType = 0
                },
            };
            wrapper = TestHelper.GetHouseholdWrapper(persons);
            wrapper.Init();
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanDriversFlag(3));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(1));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(2));
            Assert.Equal(0, wrapper.GetCarsLessThanWorkersFlag(3));
            Assert.Equal(true, wrapper.Has1Driver);
            Assert.Equal(false, wrapper.Has2Drivers);
            Assert.Equal(false, wrapper.Has3Drivers);
            Assert.Equal(false, wrapper.Has4OrMoreDrivers);
            Assert.Equal(true, wrapper.Has2OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has3OrLessFullOrPartTimeWorkers);
            Assert.Equal(true, wrapper.Has4OrLessFullOrPartTimeWorkers);
            Assert.Equal(false, wrapper.HasMoreDriversThan1);
            Assert.Equal(false, wrapper.HasMoreDriversThan2);
            Assert.Equal(false, wrapper.HasMoreDriversThan3);
            Assert.Equal(false, wrapper.HasMoreDriversThan4);
            Assert.Equal(true, wrapper.HasNoFullOrPartTimeWorker);
        }