Exemplo n.º 1
0
        public void ExpendIngredient_ErrorsIfLackingMaterials()
        {
            ProductionBaySlot slot = new ProductionBaySlot(null, null, new ResourceBank(200, new List <Quantified <Resource> > {
                new Quantified <Resource>(Scrap, 3)
            }), 0);

            Assert.ThrowsException <LackingResourceException>(() => slot.ExpendIngredient(ScrapIng));
        }
Exemplo n.º 2
0
        public void ExpendIngredient_Works()
        {
            ProductionBaySlot slot = new ProductionBaySlot(null, null, new ResourceBank(200, new List <Quantified <Resource> > {
                new Quantified <Resource>(Scrap, 20)
            }), 0);

            slot.ExpendIngredient(ScrapIng);
            Assert.IsTrue(slot.Resources[Scrap] == 16, $"Expected 16, instead have {slot.Resources[Scrap].Quantity}");
        }
Exemplo n.º 3
0
        public void ExpendIngredient_CallsOnLackingInsteadOfError()
        {
            ProductionBaySlot slot = new ProductionBaySlot(null, null, new ResourceBank(200, new List <Quantified <Resource> > {
                new Quantified <Resource>(Scrap, 3)
            }), 0);
            bool works = false;

            slot.ExpendIngredient(ScrapIng, () => works = true);
            Assert.IsTrue(works, "Did not call action");
        }