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)); }
public void CanCreatePreCombinations() { ICombinationRepository repCombination = new CombinationRepository(); IPreCombinationRepository repPreCombination = new PreCombinationRepository(); IStyleRuleRepository repStyleRule = new StyleRuleRepository(); IOutfitEngineProcessor processor = new OutfitEngineProcessor(repStyleRule); OutfitEngineService oes = new OutfitEngineService( repCombination, repPreCombination, processor); IList <PreGarment> pregarments = new PreGarmentRepository().GetFetched(); foreach (FashionFlavor fv in new FashionFlavorRepository().GetAll()) { //if (fv.Name.Contains("Preppy") || fv.Name.Contains("Trendy")) // continue; IList <FashionFlavor> flavors = new List <FashionFlavor>(); flavors.Add(fv); IList <PreGarment> reducedPregarments = (from cg in pregarments where cg.PreSilouhette.Flavors.Contains(fv) select cg).ToList <PreGarment>(); Console.WriteLine("Amount of pregarments: {0}", reducedPregarments.Count); oes.CreatePreCombinations( flavors, reducedPregarments); } }
public void CreateStyleRules() { IFashionFlavorRepository repFlavors = new FashionFlavorRepository(); IStyleRuleRepository repStyleRule = new StyleRuleRepository(); foreach (FashionFlavor fv in repFlavors.GetAll()) { repStyleRule.SaveOrUpdate(CreateStyleRule(fv)); } }
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); }
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)); }
public void CanMatchColor() { Color c1 = new ColorRepository().Get(1); //Black Color c2 = new ColorRepository().Get(8); //Red Color c3 = new ColorRepository().Get(4); //Beige Color c4 = new ColorRepository().Get(24); //Dark Blue Green HashSet <Color> colors = new HashSet <Color>(); colors.Add(c1); colors.Add(c2); colors.Add(c3); colors.Add(c4); HashSet <ColorFamily> colorFamiliesHash = new HashSet <ColorFamily>(); colorFamiliesHash.Add(c1.Family); colorFamiliesHash.Add(c2.Family); colorFamiliesHash.Add(c3.Family); colorFamiliesHash.Add(c4.Family); HashSet <PatternType> pt = new HashSet <PatternType>(); pt.Add(new PatternRepository().Get(1).Type); HashSet <StructureType> st = new HashSet <StructureType>(); st.Add(StructureType.Structured); HashSet <ShapeType> sh = new HashSet <ShapeType>(); sh.Add(ShapeType.Fitted100); sh.Add(ShapeType.Fitted600Plus); StyleRule sr = new StyleRuleRepository().Get(8); Assert.IsFalse(OutfitValidationService.IsValidCombination( colorFamiliesHash, colors, pt, null, sr, null, false, false)); }
public void CanReadStyleRuleAccessories() { IStyleRuleRepository repStyleRule = new StyleRuleRepository(); Assert.IsTrue(repStyleRule.Get(1).AccessoriesAmount.Count > 0); }