Ejemplo n.º 1
0
        public void Create_ids_for_units()
        {
            var population = new []
            {
                new Unit {
                    Id = "*****@*****.**", TargetGroup = "TG1", VisitDate = DateTime.Parse("2020-02-25")
                },
                new Unit {
                    Id = "*****@*****.**", TargetGroup = "TG2", VisitDate = DateTime.Parse("2020-02-25")
                },
                new Unit {
                    Id = "*****@*****.**", TargetGroup = "TG1", VisitDate = DateTime.Parse("2020-02-25")
                },
                new Unit {
                    Id = "*****@*****.**", TargetGroup = "TG2", VisitDate = DateTime.Parse("2020-02-25")
                }
            };

            var sampler = new Sampler();
            var sample  = sampler.CreateIdsForUnits(population);

            // Units ids should be composed by Id_TargetGroup_VisitDate
            sample[0].ShouldBe("[email protected]_TG1_2020-02-25");
            sample[1].ShouldBe("[email protected]_TG2_2020-02-25");
            sample[2].ShouldBe("[email protected]_TG1_2020-02-25");
            sample[3].ShouldBe("[email protected]_TG2_2020-02-25");
        }