public void MakeSampleSelecterTest_100PCT()
        {
            var st = new StratumModel() { Method = "100PCT" };

            var sg = new SampleGroupModel()
            {
                Stratum = st,
                SampleSelectorState = "something",
                SampleSelectorType = "something"
            };

            sg.SampleSelectorState = null;

            Assert.IsNull(sg.MakeSampleSelecter());
            Assert.IsNull(sg.Sampler);
        }
        public void MakeSampleSelecterTest_F3P()
        {
            var st = new StratumModel()
            {
                Method = "F3P"
            };

            var sg = new SampleGroupModel()
            {
                Stratum = st,
                SampleSelectorState = null,
                KZ = 100
            };

            Assert.IsNotNull(sg.MakeSampleSelecter());
            Assert.IsNotNull(sg.Sampler);
            Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.ThreePSelecter));
            Assert.AreEqual(100, ((ThreePSelecter)sg.Sampler).KZ);
        }
        void MakeSampleSelecterTest_FCM_PCM_helper(string method)
        {
            var st = new StratumModel() { Method = method };

            //test: if sampling freq is 0
            //then Sampler is null
            var sg = new SampleGroupModel()
            {
                Stratum = st,
                SamplingFrequency = 0
            };

            Assert.IsNull(sg.MakeSampleSelecter());
            Assert.IsNull(sg.Sampler);

            //test: if sampling freq is > 0
            //AND SampleSelectorType is not defined
            //THEN Sampler is not null
            //AND is of type Systematic
            sg = new SampleGroupModel()
            {
                Stratum = st,
                SamplingFrequency = 1,
                InsuranceFrequency = 1
            };

            Assert.IsNotNull(sg.MakeSampleSelecter());
            Assert.IsNotNull(sg.Sampler);
            Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.SystematicSelecter));

            var sampler = sg.Sampler as FMSC.Sampling.IFrequencyBasedSelecter;
            Assert.AreEqual(1, sampler.Frequency);
            Assert.AreEqual(1, sampler.ITreeFrequency);
        }
        public void MakeSampleSelecterTest_STR()
        {
            var st = new StratumModel() { Method = "STR" };

            //test: if sampling freq is 0
            //then Sampler is null
            var sg = new SampleGroupModel()
            {
                Stratum = st,
                SamplingFrequency = 0,
                SampleSelectorState = "something"
            };

            Assert.IsNull(sg.MakeSampleSelecter());
            Assert.IsNull(sg.Sampler);

            //test: if sampling freq is > 0
            //AND SampleSelectorType is not defined
            //THEN Sampler is not null
            //AND is of type Blocked
            sg = new SampleGroupModel()
            {
                Stratum = st,
                SamplingFrequency = 1,
                SampleSelectorState = "something"
            };

            Assert.IsNotNull(sg.MakeSampleSelecter());
            Assert.IsNotNull(sg.Sampler);
            Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.BlockSelecter));

            var blockSampler = sg.Sampler as FMSC.Sampling.BlockSelecter;
            Assert.AreEqual(1, blockSampler.Frequency);

            //test: if sampling freq is > 0
            //AND SampleSelectorType is Systematic
            //THEN Sampler is not null
            //AND is of type Systematic
            sg = new SampleGroupModel()
            {
                Stratum = st,
                SamplingFrequency = 1,
                SampleSelectorType = "SystematicSelecter",
                SampleSelectorState = "something"
            };

            Assert.IsNotNull(sg.MakeSampleSelecter());
            Assert.IsNotNull(sg.Sampler);

            Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.SystematicSelecter));

            var systmaticSampler = sg.Sampler as FMSC.Sampling.SystematicSelecter;
            Assert.AreEqual(1, systmaticSampler.Frequency);
        }