Exemplo n.º 1
0
        public void SubtractOperatorWorks()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity = 4
            };

            Assert.IsTrue(bank - 2 == 2, "- operator does not work properly");
        }
Exemplo n.º 2
0
        public void PlusOperatorWorks()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity = 4,
            };

            Assert.IsTrue(bank + 2 == 6, "+ operator does not work properly");
        }
Exemplo n.º 3
0
        public void ImplicitOperatorIntExists()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity = 4
            };
            int hi = bank;

            Assert.IsTrue(hi == (int)4, "Something went wrong with the conversion");
        }
Exemplo n.º 4
0
        public void ImplicitOperatorStringExists()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity = 4
            };
            string amt = bank;

            Assert.IsTrue(amt == "4", "Something went wrong with the conversion");
        }
Exemplo n.º 5
0
 public ProductionBaySlot(RegeneratingBank pool, RegeneratingBank reserve, ResourceBank resources, uint seats)
 {
     Pool         = pool;
     Reserve      = reserve;
     Resources    = resources;
     Workers      = new CappedList <Citizen>(seats);
     WorkPairings = new Dictionary <Citizen, Ingredient <Resource> >( );
     Lineup       = new List <Recipe <Resource, Resource> >( );
 }
Exemplo n.º 6
0
        public void FailsOnDecayTooLarge()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity  = 4,
                DecayRate = 5,
            };
            bool worked = false;

            bank.Decay(() => worked = true);
            Assert.IsTrue(worked);
        }
Exemplo n.º 7
0
        public void RegenRespectsCapacity()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity  = 4,
                Maximum   = 5,
                RegenRate = 5
            };

            bank.Regen( );
            Assert.IsTrue(bank == 5, "Does not respect capacity");
        }
Exemplo n.º 8
0
        public void DecayWorks()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity  = 4,
                DecayRate = 2
            };

            bank.Decay(onFailure: () => {
                Assert.Fail("Not enough energy. Something is wrong with the Quantity.");
            });
            Assert.IsTrue(bank == 2);
        }
Exemplo n.º 9
0
        public void RegenWorks()
        {
            RegeneratingBank bank = new RegeneratingBank {
                Quantity  = 4,
                Maximum   = 10,
                RegenRate = 4
            };

            bank.Regen(1);
            Assert.IsTrue(bank == 5);

            bank.Regen( );
            Assert.IsTrue(bank == 9, "Does not respect default regeneration value");
        }
Exemplo n.º 10
0
 /// <summary>
 /// Create a new ProductionBaySlot limiting the quantity of seats.
 /// </summary>
 /// <param name="pool">The pool of the ProductionBay</param>
 /// <param name="reserve">The reserve of the ProductionBay</param>
 /// <param name="resources"The ResourceBank of the ProductionBay></param>
 /// <param name="seats">The maximum amount of workers in the station</param>
 /// <param name="workers">The list of workers to grab from</param>
 /// <remarks>Note: If the list of workers is larger than the seat count, it'll just grab the first 'seats' quantity of workers</remarks>
 public ProductionBaySlot(RegeneratingBank pool, RegeneratingBank reserve, ResourceBank resources, uint seats, List <Citizen> workers)