public void GetSoda() { if (CurrentCleanCupTray != null) { audio.PlayOneShot(Mug, 0.3f); Debug.Log("Did"); var cup = CurrentCleanCupTray.TakeCup(); this.Cup = cup; cup.transform.SetParent(this.Hand.transform); cup.transform.localPosition = Vector3.zero; cup.transform.localEulerAngles = Vector3.zero; CurrentCleanCupTray = null; Debug.Log("SettoNull"); } else if (CurrentSodaMachine != null) { TakeCup(CurrentSodaMachine.TakeCup()); CurrentSodaMachine = null; } else { print("else"); TakeCup(AccessingCounter.GetDirtyCup()); AccessingCounter = null; } }
public void Execute_OverPayForOrange_TwoQuarters_RegisterHas95CoinsAfterSale() { //Arrange //Same Arrange as last test! //There are lots of things happening in this method, so we can test many different things with same setup! //This test checks to make sure register has correct amount of coins after sale //What else could you test with a similar setup? SodaMachine soda = new SodaMachine(); Customer cust = new Customer(); List <Coin> twoQuarters = new List <Coin>() { new Quarter(), new Quarter() }; //100 coins in starting reg + 2 quarters payment - 7 coins as change = 95 coins, so 'expected' = 95 int expected = 95; int actual; //Act //Call Execute to trigger sale soda.Execute(cust, "Orange Soda", twoQuarters); //We're testing number of coins in the register, so 'actual' = count of coin list. actual = soda.register.Count; //Assert Assert.AreEqual(expected, actual); }
public override void OnTriggerEnter(Collider c) { base.OnTriggerEnter(c); if (c.gameObject.tag == "sodaMachine") { if (!entitiesHit.Contains(c.transform.gameObject)) { Debug.Log("soda"); entitiesHit.Add(c.gameObject); oeffect = hitEffect(objecthiteffects, objhiteffect); if (entity.facingRight) { oeffect.transform.position = transform.position + new Vector3(sc.center.x, sc.center.y, 0); } else { oeffect.transform.position = transform.position - new Vector3(sc.center.x, sc.center.y, 0); } oeffect.transform.parent = null; sm = c.transform.root.GetComponent <SodaMachine>(); sm.setTexture(); } //handle smh } }
public AdminMenu(SodaMachine machine) : base(machine, "Stocker Menu") { ActionCommands.Add(new ActionCommand(Commands.NameItems, HandleNameItem)); ActionCommands.Add(new ActionCommand(Commands.AdjustQuantity, HandleAdjustQuantity)); ActionCommands.Add(new ActionCommand(Commands.ViewInventory, HandlePrintInventory)); ActionCommands.Add(new ActionCommand(Commands.ViewMachineBalance, HandleViewBalance)); ActionCommands.Add(ActionCommandFactory.CreateQuitToPreviousMenuCommand(QuitToPreviousMenu)); }
public void ShouldPrintCorrectCustomerBalance() { SodaMachine machine = new SodaMachine(10); SodaMachineUi machineUi = new SodaMachineUi(machine); machine.DepositCustomerMoney(2.25); string result = machineUi.PerformAction(MainMenu.Commands.PrintCustomerBalance.Command).ToString(); Assert.IsTrue(result.Contains("2.25"), string.Format("Result should contain 2.25, actual result was {0}", result)); }
public MainMenu(SodaMachine machine) : base(machine, "Main Menu") { ActionCommands.Add(new ActionCommand(Commands.StockerMenu, NavigateToAdminMenu)); ActionCommands.Add(new ActionCommand(Commands.AddMoney, HandleAddMoney)); ActionCommands.Add(new ActionCommand(Commands.PrintCustomerBalance, HandlePrintCustomerBalance)); ActionCommands.Add(new ActionCommand(Commands.ViewProductList, HandleViewProductList)); ActionCommands.Add(new ActionCommand(Commands.ChooseItem, HandleBuyAnItem)); ActionCommands.Add(new ActionCommand(Commands.ReturnChange, HandleReturnChange)); ActionCommands.Add(ActionCommandFactory.CreateQuitToPreviousMenuCommand(Quit)); }
protected void Page_Load(object sender, EventArgs e) { ReadData(); if (sodaM == null) { sodaM = new SodaMachine(); lblSmallCups.Text = sodaM.CupStorage.SmallCups.ToString(); lblMedCups.Text = sodaM.CupStorage.MediumCups.ToString(); lblLgCups.Text = sodaM.CupStorage.LargeCups.ToString(); } //lblSmallCups.Text = sodaMachine.CupStorage.SmallCups.ToString(); }
public void ValidateInStock_FullInventoryValidateRootBeer_ReturnTrueInStock() { // Arrange SodaMachine sodaMachine = new SodaMachine(); // Act // Assert }
public void DetermineAmountOfChange_CaculateChangeToReturn_AmountOfChangeIs15Cents() { //Arrange - objects, variables, etc. SodaMachine soda = new SodaMachine(); Can orangeSoda = new OrangeSoda(); double payment = 0.25; double expected = 0.19; double actual; //Act actual = soda.DetermineAmountOfChange(orangeSoda, payment); //Assert Assert.AreEqual(expected, actual); }
static void Main(string[] args) { AbstractSoda cola = new CocaColaSoda("Coca Cola Zero", 500, 2.50); AbstractSoda fanta = new FantaSoda("Fanta Madness", 500, 2.60); AbstractSoda sprite = new SpriteSoda("Sprite - Regular Flavor", 500, 3.10); ISodaMachine sodaMachine = new SodaMachine(); sodaMachine.ListOfSodas.Add(cola); sodaMachine.ListOfSodas.Add(fanta); sodaMachine.ListOfSodas.Add(sprite); sodaMachine.AddMoney(5); sodaMachine.SelectSoda(cola); sodaMachine.SelectSoda(fanta); }
public void AddCoinsToRegister_AreCoinsAddedToRegister_RegisterWillHave21Quarters() { //Arrange SodaMachine soda = new SodaMachine(); Coin quarter = new Coin(); int expected = 101; int actual; //Act soda.AddCoinsToRegister(1, quarter); actual = soda.register.Count; //Assert Assert.AreEqual(expected, actual); }
public void ContainsCan_DoesInventoryHaveSelectedCan_InventoryDoesHaveCan() { //Arrange - objects/variables/etc SodaMachine soda = new SodaMachine(); Can cola = new Cola(); bool expected = true; bool actual; //Act actual = soda.ContainsCan(cola); //Assert Assert.AreEqual(expected, actual); }
public void Setup() { _inventory = new[] { new Soda { Name = "coke", Nr = 2, Cost = 20 }, new Soda { Name = "sprite", Nr = 3, Cost = 15 }, new Soda { Name = "fanta", Nr = 3, Cost = 15 } }; _testMachine = new SodaMachine(_inventory); }
public void PrepareCan_CheckToSeeIfSelectedCanIsAvailable_ReturnColaIfAvailable() { // Arrange SodaMachine soda = new SodaMachine(); Can cola = new Cola(); Can orangeSoda = new OrangeSoda(); Can newCan; string expected = cola.name; string actual; // Act newCan = soda.PrepareCan("Cola"); actual = newCan.name; // Assert Assert.AreEqual(expected, actual); }
public void ContainsCoin_DoesRegisterContainCoin_RegisterContainsAQuarterAndDime() { //Arrange - objects,variables, etc. //need to instantiate soda machine, need list of coins, and a register list SodaMachine soda = new SodaMachine(); //List<Coin> register = new List<Coin>() { new Quarter(), new Dime() }; bool expected = true; bool actual; //Act - call methods to test //call ContainsCoins to check if coins are in register actual = soda.ContainsCoin("quarter"); //Assert - expected output Assert.AreEqual(expected, actual); }
public void RemoveAndAdd_RemoveSelectedCanFromInventoryToAddToBackpack_InventoryIs35CansBackpackIs1() { // Arrange SodaMachine soda = new SodaMachine(); Customer customer = new Customer(); Can cola = new Cola(); double inventoryExpected = 35; double backpackExpected = 1; double inventoryActual; double backpackActual; // Act soda.DispenseSodaToCustomer(customer, cola); inventoryActual = soda.inventory.Count; backpackActual = customer.backpack.cans.Count; //Assert Assert.AreEqual(inventoryExpected, inventoryActual); Assert.AreEqual(backpackExpected, backpackActual); }
public void Execute_OverPayForOrange_TwoQuarters_GetStatus4() { //Arrange //We need a SodaMachine, a Customer, and a list of coins to test this method, so we instantiate them in the Arrange SodaMachine soda = new SodaMachine(); Customer cust = new Customer(); List <Coin> twoQuarters = new List <Coin>() { new Quarter(), new Quarter() }; //Since we're overpaying, we expect to get status code of 4 when we run the method, so 'expected' = 4 int expected = 4; //Just declaring 'actual', not setting its value yet int actual; //Act //Here we actually call the method we want to test, and set 'actual' equal to the method's return actual = soda.Execute(cust, "Orange Soda", twoQuarters); //Assert Assert.AreEqual(expected, actual); }
public void Add_soda_to_system() { _inventory = new[] { new Soda { Name = "coke", Nr = 2, Cost = 20 }, new Soda { Name = "sprite", Nr = 3, Cost = 15 }, new Soda { Name = "fanta", Nr = 3, Cost = 15 }, new Soda { Name = "pepsi", Nr = 10, Cost = 20 } }; _testMachine = new SodaMachine(_inventory); _testMachine.Order("pepsi", true); Assert.Less(_inventory[3].Nr, 10); }
public void SetUp() { machine = new SodaMachine(10); ui = new SodaMachineUi(machine); ui.PerformAction(MainMenu.Commands.StockerMenu.Command); }
public void SetUp() { machine = new SodaMachine(10); ui = new SodaMachineUi(machine); machine.Slots[0].Quantity = 10; }
public void SetUp() { machine = new SodaMachine(10); ui = new SodaMachineUi(machine); }
private static void Main(string[] args) { SodaMachine sodaMachine = new SodaMachine(); sodaMachine.Start(); }
protected SodaMachineMenu(SodaMachine machine, string header) : base(header) { this.machine = machine; }
protected SodaMachineMenu(SodaMachine machine) { this.machine = machine; }