예제 #1
0
        public void SolutionModify()
        {
            var    item1 = new Item("a");
            var    item2 = new Item("b");
            Recipe r     = new Recipe("");

            r.AddIngredient(new ItemAmount(item1, 1));
            r.AddResult(new ItemAmount(item2, 1));
            r.CraftingCategory = "test";

            Building b = new Building("");

            b.AddCraftingCategory("test");
            b.IngredientCount = 4;
            b.ProductionSpeed = 1;

            Library l = new Library();

            l.AddItem(item1);
            l.AddItem(item2);
            l.AddRecipe(r);
            l.AddBuilding(b);
            l.Initialize();

            var coarseGraph = RecipeGraph.FromLibrary(l, new Item[] { item1 }, new ItemAmount[] { new ItemAmount(item2, 0.01) }, (a) => 1);
            var denseGraph  = TrivialSolutionFactory.CreateFactory(coarseGraph);

            var parameters = SolutionParameters.FromFactory(12, 12, denseGraph);

            Assert.AreEqual(parameters, parameters.Modify(0));
        }