Ejemplo n.º 1
0
            public void SilverAndCobalt()
            {
                var stockpiles = new IngotStockpiles(new[] {
                    new IngotStockpile(new IngotType("Ingot/Cobalt", 220)
                    {
                        ProductionNormalisationFactor = 0.075
                    }),
                    new IngotStockpile(new IngotType("Ingot/Silver", 10)
                    {
                        ProductionNormalisationFactor = 0.1
                    })
                });
                var ingotWorklist = new IngotWorklist(stockpiles);

                stockpiles.UpdateAssemblerSpeed(10);

                stockpiles.UpdateQuantities(new TestIngotQuantities {
                    { "Ingot/Cobalt", 275 },
                    { "Ingot/Silver", 34 }
                });
                ingotWorklist.Initialise();

                IngotStockpile preferred;

                Assert.That(ingotWorklist.TryGetPreferred(out preferred));
                Assert.That(preferred.Ingot.ItemType, Is.EqualTo(new ItemType("Ingot/Cobalt")));
            }
Ejemplo n.º 2
0
            public void SilverAndCobalt2()
            {
                var cobalt     = new Blueprint("CobaltOreToIngot", 1, new ItemAndQuantity("Ore/Cobalt", 0.25), new ItemAndQuantity("Ingot/Cobalt", 0.075));
                var silver     = new Blueprint("SilverOreToIngot", 1, new ItemAndQuantity("Ore/Silver", 1), new ItemAndQuantity("Ingot/Silver", 0.1));
                var stockpiles = new IngotStockpiles(new[] {
                    new IngotStockpile(new IngotType("Ingot/Cobalt", 220)
                    {
                        ProductionNormalisationFactor = 0.075
                    }),
                    new IngotStockpile(new IngotType("Ingot/Silver", 10)
                    {
                        ProductionNormalisationFactor = 0.1
                    })
                });
                var ingotWorklist = new IngotWorklist(stockpiles);

                stockpiles.UpdateAssemblerSpeed(10);

                stockpiles.UpdateQuantities(new TestIngotQuantities {
                    { "Ingot/Cobalt", 220 },
                    { "Ingot/Silver", 10 }
                });
                ingotWorklist.Initialise();

                var cobaltScore = ingotWorklist.ScoreBlueprint(cobalt);
                var silverScore = ingotWorklist.ScoreBlueprint(silver);

                Assert.That(silverScore, Is.EqualTo(cobaltScore).Within(0.01).Percent);
            }
Ejemplo n.º 3
0
            public void IronAndGold()
            {
                var stockpiles = new IngotStockpiles(new[] {
                    new IngotStockpile(new IngotType("Ingot/Gold", 5)
                    {
                        ProductionNormalisationFactor = 0.025
                    }),
                    new IngotStockpile(new IngotType("Ingot/Iron", 80)
                    {
                        ProductionNormalisationFactor = 14
                    })
                });
                var ingotWorklist = new IngotWorklist(stockpiles);

                stockpiles.UpdateAssemblerSpeed(10);

                stockpiles.UpdateQuantities(new TestIngotQuantities {
                    { "Ingot/Gold", 27 },
                    { "Ingot/Iron", 15000 }
                });
                ingotWorklist.Initialise();

                IngotStockpile preferred;

                Assert.That(ingotWorklist.TryGetPreferred(out preferred));
                Assert.That(preferred.Ingot.ItemType, Is.EqualTo(new ItemType("Ingot/Gold")));
            }