Ejemplo n.º 1
0
        public void CanCreateAccessoriesCombination()
        {
            IClosetRepository    cr      = new ClosetRepository();
            IOutfitEngineService service = CreateOutfitEngineService();

            IList <int> lst    = new List <int>();
            string      values = "244531,1309246,2062726,2979991,2981161,2980771,178231,178621,172771,169261,170041,2554111,2555281,3029131,3029911,3030691";

            foreach (string val in values.Split(','))
            {
                lst.Add(Convert.ToInt32(val));
            }

            cr.DbContext.BeginTransaction();
            Closet c = cr.Get(2);

            foreach (int i in lst)
            {
                c.AddGarment(new MasterGarment(i));
            }
            cr.SaveOrUpdate(c);
            cr.DbContext.CommitTransaction();

            IList <int> lstFlavors = new List <int>();

            lstFlavors.Add(1);

            service.AddOutfits(2, lst);
        }
        public void CanRetrieveValidCombination()
        {
            IStyleRuleRepository     srr = new StyleRuleRepository();
            IClosetRepository        cr  = new ClosetRepository();
            IGarmentRepository       gr  = new GarmentRepository();
            IFashionFlavorRepository fr  = new FashionFlavorRepository();

            IOutfitEngineProcessor processor = new OutfitEngineProcessor(srr, cr);

            IOutfitEngineService service = new OutfitEngineService(gr, cr, processor, fr);

            IList <int> lst    = new List <int>();
            string      values = "457546,1358386,2144626,2570491";

            foreach (string val in values.Split(','))
            {
                lst.Add(Convert.ToInt32(val));
            }

            IList <int> lstFlavors = new List <int>();

            lstFlavors.Add(1);

            Assert.IsTrue(service.HasValidCombinations(lst, lstFlavors));
        }
Ejemplo n.º 3
0
        public void CanCreateLargeClosetWithAccessoriesCombination()
        {
            IClosetRepository    cr      = new ClosetRepository();
            IOutfitEngineService service = CreateOutfitEngineService();

            IList <int> lst    = new List <int>();
            string      values = "781,14431,54601,55771,56551,62791,107251,109201,123631,179011,180571,391951,670411,671588,861908,948871,962911,1000748,1325611,1326001,1337191,1391131,1571311,1735111,1749931,1915305,1916851,1918411,2064271,2070901,2586871,2637961,2752621,2848951,2996371,2998321,3040051,3066181";

            foreach (string val in values.Split(','))
            {
                lst.Add(Convert.ToInt32(val));
            }

            cr.DbContext.BeginTransaction();
            Closet c = cr.Get(2);

            foreach (int i in lst)
            {
                c.AddGarment(new MasterGarment(i));
            }
            cr.SaveOrUpdate(c);
            cr.DbContext.CommitTransaction();

            IList <int> lstFlavors = new List <int>();

            lstFlavors.Add(1);
            lstFlavors.Add(8);

            service.AddOutfits(2, lst);
        }
Ejemplo n.º 4
0
        public void CanCreateSummerCombinationWithCoats()
        {
            IClosetRepository    cr      = new ClosetRepository();
            IOutfitEngineService service = CreateOutfitEngineService();

            IList <int> lst    = new List <int>();
            string      values = "244531,245311,246091,1587706,1588876,1589656,2210146,2211316,2226526,2227696,2979991,2981161";

            foreach (string val in values.Split(','))
            {
                lst.Add(Convert.ToInt32(val));
            }

            cr.DbContext.BeginTransaction();
            Closet c = cr.Get(2);

            foreach (int i in lst)
            {
                c.AddGarment(new MasterGarment(i));
            }
            cr.SaveOrUpdate(c);
            cr.DbContext.CommitTransaction();

            IList <int> lstFlavors = new List <int>();

            lstFlavors.Add(1);
            lstFlavors.Add(6);

            service.AddOutfits(2, lst);
        }
        public void CanCombine()
        {
            IStyleRuleRepository     srr = new StyleRuleRepository();
            IClosetRepository        cr  = new ClosetRepository();
            IGarmentRepository       gr  = new GarmentRepository();
            IFashionFlavorRepository fr  = new FashionFlavorRepository();

            IOutfitEngineProcessor processor = new OutfitEngineProcessor(srr, cr);

            IOutfitEngineService service = new OutfitEngineService(gr, cr, processor, fr);

            service.CreateOutfits(1);
        }
Ejemplo n.º 6
0
        public static IOutfitEngineService CreateOutfitEngineService()
        {
            IStyleRuleRepository  srr = new StyleRuleRepository();
            IClosetRepository     cr  = new ClosetRepository();
            IIndexCreationService ois = new IndexCreationService(new ClosetRepository(), new ClosetOutfitRepository());
            IOutfitUpdaterService ous = new OutfitUpdaterService(new OutfitUpdaterRepository(),
                                                                 new PreCombinationRepository(), srr);

            IOutfitEngineProcessor processor = new OutfitEngineProcessor(srr, cr, ous, ois);


            IGarmentRepository       gr = new GarmentRepository();
            IFashionFlavorRepository fr = new FashionFlavorRepository();

            return(new OutfitEngineService(gr, cr, processor, fr));
        }
Ejemplo n.º 7
0
        public void CanCreateBigClosetCombination(string values, int flavor1, int flavor2)
        {
            IClosetRepository        cr  = new ClosetRepository();
            IFashionFlavorRepository fr  = new FashionFlavorRepository();
            IBasicUserRepository     bur = new BasicUserRepository();

            IOutfitEngineService service = CreateOutfitEngineService();

            IList <int> lst = new List <int>();

            foreach (string val in values.Split(','))
            {
                lst.Add(Convert.ToInt32(val));
            }

            cr.DbContext.BeginTransaction();
            Closet c = cr.Get(2);

            foreach (int i in lst)
            {
                c.AddGarment(new MasterGarment(i));
            }
            cr.SaveOrUpdate(c);

            IList <UserFlavor> lstFlavors = new List <UserFlavor>();

            lstFlavors.Add(new UserFlavor(fr.Get(flavor1), 1));
            if (flavor2 != 0)
            {
                lstFlavors.Add(new UserFlavor(fr.Get(flavor2), 1));
            }

            c.User.SetFlavors(lstFlavors);

            bur.SaveOrUpdate(c.User);
            cr.DbContext.CommitTransaction();

            service.CreateOutfits(2);

            c = cr.Get(2);
            Assert.IsTrue(c.Outfits.Count > 0);
        }
Ejemplo n.º 8
0
        public void CanCreateWithOtherAccessories()
        {
            IClosetRepository cr = new ClosetRepository();

            IList <int> lst    = new List <int>();
            string      values = "89701,94771,95161,99451,100231,162241,162631,163021,179011,181351,184471,184861,189541,244921,246091,249991,251161,256621,277291,278461,283921,287431,588511,594361,599431,703171,707851,709021,713701,998401,1003471,1007761,1008151,1342381,1343551,1347451,1351351,1353691,2177371,2181661,2182051,2182831,2186731,2210521,2215201,2216371,2717911,2727661,2729611,2731171,2979991,2981551,2985061,2986621,3029131,3029521,3033811,3039661";

            foreach (string val in values.Split(','))
            {
                lst.Add(Convert.ToInt32(val));
            }

            cr.DbContext.BeginTransaction();
            Closet c = cr.Get(2);

            foreach (int i in lst)
            {
                c.AddGarment(new MasterGarment(i));
            }
            cr.SaveOrUpdate(c);
            cr.DbContext.CommitTransaction();

            IList <int> lstFlavors = new List <int>();

            lstFlavors.Add(1);
            lstFlavors.Add(5);

            IOutfitEngineService service = CreateOutfitEngineService();

            service.AddOutfits(2, lst);

            //IList<int> lstFlavors = new List<int>();
            //lstFlavors.Add(1);

            //Assert.IsTrue(service.HasValidCombinations(lst, lstFlavors));
        }