public void CanCalculateOre()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.IronOre);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldBeEmpty();
            needs.TotalResourceNeeds.ShouldBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(1);
        }
        public void CanCalculateEncasedIndustrialBeam()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.EncasedIndustrialBeam);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(3.4d);

            needs.TotalResourceNeeds[RecipeNames.IronOre].ShouldBe(72);
            needs.TotalResourceNeeds[RecipeNames.Coal].ShouldBe(72);
        }
        public void CanCalculateConcrete()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.Concrete);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(.75d);
            needs.TotalMachineNeeds[Machines.Constructor].ShouldBe(1d);

            needs.TotalResourceNeeds[RecipeNames.Limestone].ShouldBe(45);
        }
        public void CanCalculateSteelIngot()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.SteelIngot);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(1.5d);
            needs.TotalMachineNeeds[Machines.Foundry].ShouldBe(1d);

            needs.TotalResourceNeeds[RecipeNames.IronOre].ShouldBe(45);
            needs.TotalResourceNeeds[RecipeNames.Coal].ShouldBe(45);
        }
        public void CanCalculateReinforcedIronPlate()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.ReinforcedIronPlate);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(1.2d);
            needs.TotalMachineNeeds[Machines.Smelter].ShouldBe(2.4d);
            needs.TotalMachineNeeds[Machines.Constructor].ShouldBe(4.8d);

            needs.TotalResourceNeeds[RecipeNames.IronOre].ShouldBe(72);
            needs.TotalResourceNeeds[RecipeNames.IronIngot].ShouldBe(72d);
        }
        public void CanCalculateRod()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.IronRod);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(.25);
            needs.TotalMachineNeeds[Machines.Smelter].ShouldBe(.5);
            needs.TotalMachineNeeds[Machines.Constructor].ShouldBe(1);

            needs.TotalResourceNeeds[RecipeNames.IronOre].ShouldBe(15);
            needs.TotalResourceNeeds[RecipeNames.IronIngot].ShouldBe(15);
        }
        public void CanCalculateCable()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.Cable);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(0.5d);
            needs.TotalMachineNeeds[Machines.Smelter].ShouldBe(1d);
            needs.TotalMachineNeeds[Machines.Constructor].ShouldBe(3d);

            needs.TotalResourceNeeds[RecipeNames.CopperIngot].ShouldBe(30);
            needs.TotalResourceNeeds[RecipeNames.CopperOre].ShouldBe(30);
        }
        public void CanCalculateModularFrame()
        {
            var recipe = RecipeBook.GetRecipe(RecipeNames.ModularFrame);

            var needs = RecipeCalculator.CalculateRecipeNeeds(recipe);

            needs.ShouldNotBeNull();
            needs.Inputs.ShouldNotBeEmpty();
            needs.TotalResourceNeeds.ShouldNotBeEmpty();
            needs.TotalMachineNeeds.ShouldNotBeEmpty();

            needs.TotalMachineNeeds[Machines.Miner].ShouldBe(2.8d);
            needs.TotalMachineNeeds[Machines.Smelter].ShouldBe(5.6d);
            needs.TotalMachineNeeds[Machines.Constructor].ShouldBe(11.2d);

            needs.TotalResourceNeeds[RecipeNames.IronOre].ShouldBe(168);
            needs.TotalResourceNeeds[RecipeNames.IronIngot].ShouldBe(168);
        }
Exemple #9
0
        private void PopulateNeeds()
        {
            var needs = RecipeCalculator.CalculateRecipeNeeds(Item);

            MachineNeeds  = new ObservableCollection <NeedItem>();
            ResourceNeeds = new ObservableCollection <NeedItem>();

            foreach (var machineNeed in needs.TotalMachineNeeds)
            {
                MachineNeeds.Add(new NeedItem
                {
                    Name = $"{machineNeed.Key.Humanize().Transform(To.TitleCase)}: {machineNeed.Value}"
                });
            }
            foreach (var resourceNeed in needs.TotalResourceNeeds)
            {
                ResourceNeeds.Add(new NeedItem
                {
                    Name = $"{resourceNeed.Key.Humanize().Transform(To.TitleCase)}: {resourceNeed.Value}"
                });
            }
        }