예제 #1
0
        public CalculatorPage()
        {
            InitializeComponent();

            var item = RecipeBook.GetRecipe(RecipeNames.ModularFrame);

            viewModel      = new CalculatorViewModel(item);
            BindingContext = viewModel;
        }
        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);
        }