public void TestIfUpgradingBakersWork() { Bakery bakery = new Bakery(); DateTime test = DateTime.Now; bakery.HireApprentice(test); test = test.AddDays(7); bakery.UpgradeApprentice(test); Assert.AreEqual("Baker", bakery.listOfBakers[0].WorkTitle); }
public override void Update(int deltaTime) { clockDisplay.Value = "Day: " + simulationDay + " " + actualTime.ToString("HH:mm"); workingBakers.Lines = writer.WorkingBakers(bakery); moneyDisplay.Value = bakery.currentMoney + " Schmeckles"; pantryDisplay.Value = ("Sugar: " + bakery.pantry["Sugar"] + " Egg: " + bakery.pantry["Egg"] + " Butter: " + bakery.pantry["Butter"]); if (generateCustomers) { actualTime = actualTime.AddMinutes(30); string newOrderString = bakery.GenerateNewOrder(actualTime); string orderCompleteString = bakery.CheckIfOrderIsComplete(actualTime, payments); string apprenticeUpgradeString = bakery.UpgradeApprentice(actualTime); if (newOrderString != "") { newOrdersLog.Log(newOrderString); } if (orderCompleteString != "") { completedOrdersLog.Log(orderCompleteString); } if (apprenticeUpgradeString != "") { logForBakeryRelatedUpdates.Log(apprenticeUpgradeString); } } //making sure that this runs even if month or year changes if (actualTime.Day > currentDay.Day || actualTime.Month > currentDay.Month || actualTime.Year > currentDay.Year) { bakery.currentMoney = (payments.PayRent(bakery.currentMoney)); bakery.currentMoney = (payments.PayBakers(bakery.currentMoney, bakery.listOfBakers)); logForBakeryRelatedUpdates.Log("Day " + simulationDay + ": " + "Rent paid!"); simulationDay++; currentDay = actualTime; } while (input.HasInput) { string commandInput = input.Consume(); ExecuteCommand(commandInput, this); } }