public void InitializeGQueue(int lvl) { //set this number based on level int numElements = levelQueueAmount[lvl]; Random random = new Random(); int colourNum; int innerColourNum; for (int i = 0; i < numElements; i++) { //randomly pick a colour colourNum = (int)Math.Floor(random.NextDouble() * 4); Gum innerGum = null; // TODO, set back to 4 if (lvl >= 1) { innerColourNum = (int)Math.Floor(random.NextDouble() * 4); if (colourNum != innerColourNum) { innerGum = new Gum((GumColours)innerColourNum, null); } } this.GQueue.Add(new Gum((GumColours)colourNum, innerGum)); } }
public void AddGum(Gum g) { this.Gum = g; this.OnPropertyChanged(new PropertyChangedEventArgs("Gum")); this.OnPropertyChanged(new PropertyChangedEventArgs("Source")); this.OnPropertyChanged(new PropertyChangedEventArgs("InnerSource")); }
public void VendItem_TestGum() { Gum overpriced = new Gum(5.50m, "Gum"); Assert.AreEqual("Chew Chew, Yum!", overpriced.MakeEatNoise()); Assert.AreEqual(5.50m, overpriced.Cost); }
public void GumMakesChewChewSound() { Gum gum = new Gum("A1", "Spearmint", (decimal)1.00, "Gum"); string actualString = gum.MakeSound(); Assert.AreEqual("Chew Chew, Yum!", actualString, "Gum items should make chew sound."); }
public void GumToStringTest() { DollarAmount dollar = new DollarAmount(0); Gum test = new Gum("gum", dollar); Assert.AreEqual("PSA: Peanutbutter removes gum from hair!", test.ToString()); }
public void OnTriggerEnter(Collider col) { Powerup p = col.gameObject.GetComponent <Powerup>(); if (p != null) { if (extraBoxesToPush < 2) { extraBoxesToPush++; boxCooldown = 10; Destroy(col.gameObject); } } Gum g = col.gameObject.GetComponent <Gum>(); if (g != null) { if (g.pickedUp) { stunTime = 4; g.renderer.material = g.splat; g.splatted = true; g.moving = false; } else { myGum = g; myGum.pickedUp = true; myGum.gameObject.active = false; } } }
public void MakeSoundMethod_Normal() { Gum gum = new Gum("Chiclets", 0.75M); string sound = gum.MakeSound(); Assert.AreEqual("Chew Chew, Yum!", sound); }
public void TestCandySound() { //Arrange Gum gumSound = new Gum("Chiclets", 0.75M); //Assert Assert.AreEqual("Chew Chew, Yum!", gumSound.EatingSoundEffects()); }
public void GumExpectedSound() { Gum gum = new Gum("Some Gum", 3); string actual = gum.MakeSound(); Assert.AreEqual("Chew Chew, Yum!", actual, "Make sound for gum"); }
public void GumTest_Consume() { decimal price = 1.00M; string item = "Gum"; Gum testItem = new Gum(price, item); Assert.AreEqual("Chew, Chew, YUM!", testItem.Consume()); }
public void Money_Till_Should_Return_125_When_Purchasing_Chiclets_With_2() { MoneyTill moneyTill = new MoneyTill(); Gum newGum = new Gum("Chiclets", .75m, "D3"); decimal expected = 1.25m; decimal actual = moneyTill.Purchase(newGum, 2m); Assert.AreEqual(expected, actual); }
public void GumTest_Constructor() { decimal price = 1.00M; string item = "Gum"; Gum testItem = new Gum(price, item); Assert.AreEqual(item, testItem.Name); Assert.AreEqual(price, testItem.Price); }
public void EatMessage_Gum_Test() { //arrange VendingMachineItem testItem = new Gum("Spearmint"); //act string eatMessage = testItem.EatMessage; //assert Assert.AreEqual("Chew Chew, Yum!", eatMessage); }
public void Testingsound() { Item testCandy = new Candy("dumdum", 0.05m); Item testGum = new Gum("gumgum", 0.05m); Item testDrink = new Drink("pepsi", 0.05m); Item testChip = new Chip("walkers", 0.05m); Assert.AreEqual("Munch munch, yum!", testCandy.GetSound()); Assert.AreEqual("Crunch crunch, yum!", testChip.GetSound()); Assert.AreEqual("Glug glug, yum!", testDrink.GetSound()); Assert.AreEqual("Chew chew, yum!", testGum.GetSound()); }
public void Verify_MakeConsumptionSound() { Drink drink = new Drink("A1", "Compu-Tears", 1.50M, "Drink"); Gum gum = new Gum("B1", "Com-Chew-ter", 0.90M, "Gum"); Chip chip = new Chip("C1", "Computer Chips", 3.15M, "Chip"); Candy candy = new Candy("D1", "Chocolate Computer Chips", 1.00M, "Candy"); Assert.AreEqual <string>("Glug Glug, Yum", drink.MakeConsumptionSound()); Assert.AreEqual <string>("Chew Chew, Yum", gum.MakeConsumptionSound()); Assert.AreEqual <string>("Crunch Crunch, Yum", chip.MakeConsumptionSound()); Assert.AreEqual <string>("Munch Munch, Yum", candy.MakeConsumptionSound()); }
public void Initialize() { vendingMachine = new VendingMachine(true); Candy someCandy = new Candy("Candy", 1); Drink someDrink = new Drink("Drink", 1); Chips someChips = new Chips("Chips", 1); Gum someGum = new Gum("Gum", 1); vendingMachine.AddNewItem("A1", someCandy); vendingMachine.AddNewItem("B1", someDrink); vendingMachine.AddNewItem("C1", someChips); vendingMachine.AddNewItem("D1", someGum); }
public void VendingMachineRestockGumCheck(string expectedSlot, string expectedName, double expectedPrice, string expectedType) { //Arrange VendingMachine vm = new VendingMachine(); //Act Gum gumObject = new Gum(expectedName, expectedSlot, (decimal)expectedPrice); //Assert Assert.AreEqual(vm.Inventory[expectedSlot].Name, expectedName); Assert.AreEqual((double)(vm.Inventory[expectedSlot].Price), expectedPrice); Assert.AreEqual(vm.Inventory[expectedSlot].SlotLocation, expectedSlot); }
public void MakeSoundMethod_Exceptions() { Gum gum = new Gum("", -15M); string sound = gum.MakeSound(); Assert.AreEqual("Chew Chew, Yum!", sound); gum = new Gum(null, 0); sound = gum.MakeSound(); Assert.AreEqual("Chew Chew, Yum!", sound); }
public void CheckDispenseMessageTest() { Candy candy = new Candy("Candy", 1.80M, 5); Assert.AreEqual("Munch Munch, Yum!", candy.DispensedMessage, "Should return correct message for the type."); Drink drink = new Drink("Good Drink", 1.50M, 0); Assert.AreEqual("Glug Glug, Yum!", drink.DispensedMessage, "Should return correct message for the type."); Gum gum = new Gum("Freesh Mint", .75M, 2); Assert.AreEqual("Chew Chew, Yum!", gum.DispensedMessage, "Should return correct message for the type."); Chip chip = new Chip("Crunchie", .85M, 4); Assert.AreEqual("Crunch Crunch, Yum!", chip.DispensedMessage, "Should return correct message for the type."); }
public void CheckCountPropertyTest() { Candy candy = new Candy("Candy", 1.80M, 5); Assert.AreEqual(5, candy.Count, "Should be the count provided by the constructor."); Drink drink = new Drink("Good Drink", 1.50M, 0); Assert.AreEqual(0, drink.Count, "Should be the count provided by the constructor."); Gum gum = new Gum("Freesh Mint", .75M, 2); Assert.AreEqual(2, gum.Count, "Should be the count provided by the constructor."); Chip chip = new Chip("Crunchie", .85M, 4); Assert.AreEqual(4, chip.Count, "Should be the count provided by the constructor."); }
public void CheckPricePropertyTest() { Candy candy = new Candy("Candy", 1.80M, 0); Assert.AreEqual(1.80M, candy.Price, "Should be priced from what the constructor provided"); Drink drink = new Drink("Good Drink", 1.50M, 0); Assert.AreEqual(1.50M, drink.Price, "Should be priced from what the constructor provided"); Gum gum = new Gum("Freesh Mint", .75M, 0); Assert.AreEqual(.75M, gum.Price, "Should be priced from what the constructor provided"); Chip chip = new Chip("Crunchie", .85M, 0); Assert.AreEqual(.85M, chip.Price, "Should be priced from what the constructor provided"); }
public void CheckNamePropertyTest() { Candy candy = new Candy("Candy", 0, 0); Assert.AreEqual("Candy", candy.Name, "Should be named from what the constructor provided"); Drink drink = new Drink("Good Drink", 0, 0); Assert.AreEqual("Good Drink", drink.Name, "Should be named from what the constructor provided"); Gum gum = new Gum("Freesh Mint", 0, 0); Assert.AreEqual("Freesh Mint", gum.Name, "Should be named from what the constructor provided"); Chip chip = new Chip("Crunchie", 0, 0); Assert.AreEqual("Crunchie", chip.Name, "Should be named from what the constructor provided"); }
public void SaveGum(Gum gum) { using (var dbContext = new PieShopContext()) { if (gum.Id == 0) { dbContext.Gums.Add(gum); } else { dbContext.Gums.Update(gum); } dbContext.SaveChanges(); } }
public void GumTest_ConstructorTest() { //Arrange string itemName = "U-Chews"; decimal itemPrice = 0.85M; int itemsRemaining = 5; //Act Gum gum = new Gum(itemName, itemPrice, itemsRemaining); //Assert Assert.AreEqual(itemName, gum.ItemName); Assert.AreEqual(itemPrice, gum.ItemPrice); Assert.AreEqual(itemsRemaining, gum.ItemsRemaining); }
public void HasProperties() { // Arrange Gum testGum = new Gum("x", "y", 6.01M, "gum", 5); // Act string gumPhrase = testGum.SayPhrase(); // Assert Assert.AreEqual(testGum.SlotLocation, "x"); Assert.AreEqual(testGum.ProductName, "y"); Assert.AreEqual(testGum.Price, 6.01M); Assert.AreEqual(testGum.Type, "gum"); Assert.AreEqual("Chew Chew, Yum!", gumPhrase); }
public void TestProducts() { Product candy = new Candy("Bob", 50.00); Assert.AreEqual("Bob", candy.Name); Assert.AreEqual(50.00, candy.Price); Assert.AreEqual("Candy", candy.Type); Assert.AreEqual("Munch Munch, Yum!", candy.OutputMessageOnPurchase()); Product chip = new Chip("Bob", 5.40); Assert.AreEqual("Bob", chip.Name); Assert.AreEqual(5.40, chip.Price); Assert.AreEqual("Chip", chip.Type); Assert.AreEqual("Crunch Crunch, Yum!", chip.OutputMessageOnPurchase()); Product drink = new Drink("Bob", 10.99); Assert.AreEqual("Bob", drink.Name); Assert.AreEqual(10.99, drink.Price); Assert.AreEqual("Drink", drink.Type); Assert.AreEqual("Glug Glug, Yum!", drink.OutputMessageOnPurchase()); Product gum = new Gum("Bob", 0.05); Assert.AreEqual("Bob", gum.Name); Assert.AreEqual(0.05, gum.Price); Assert.AreEqual("Gum", gum.Type); Assert.AreEqual("Chew Chew, Yum!", gum.OutputMessageOnPurchase()); Assert.AreEqual(5, candy.Amount); Assert.IsTrue(candy.PurchaseOneItem()); Assert.AreEqual(4, candy.Amount); Assert.IsTrue(candy.PurchaseOneItem()); Assert.AreEqual(3, candy.Amount); Assert.IsTrue(candy.PurchaseOneItem()); Assert.AreEqual(2, candy.Amount); Assert.IsTrue(candy.PurchaseOneItem()); Assert.AreEqual(1, candy.Amount); Assert.IsTrue(candy.PurchaseOneItem()); Assert.AreEqual(0, candy.Amount); Assert.IsFalse(candy.PurchaseOneItem()); Assert.AreEqual(0, candy.Amount); Assert.IsFalse(candy.PurchaseOneItem()); Assert.AreEqual(0, candy.Amount); }
public void TestSound() { Chip testChip = new Chip("doritos", 1.50M); Assert.AreEqual("Crunch, Crunch, Yum!", testChip.MakeSound(), "Didn't make correct sound."); Candy testCandy = new Candy("hersheys", 2.00M); Assert.AreEqual("Munch, Munch, Yum!", testCandy.MakeSound(), "Didn't make correct sound."); Drink testDrink = new Drink("whiskey", 0.50M); Assert.AreEqual("Glug, Glug, Yum!", testDrink.MakeSound(), "Didn't make correct sound."); Gum testGum = new Gum("five", 3.00M); Assert.AreEqual("Chew, Chew, Yum!", testGum.MakeSound(), "Didn't make correct sound."); }
public void GumConstructorValueTest(string name, string slot, double price, string expectedName, string expectedSlot, double expectedPrice, string expectedMessage) { //Arrange decimal dPrice = (decimal)price; Gum thisItem; //Act thisItem = new Gum(name, slot, dPrice); //Assert Assert.AreEqual(expectedName, thisItem.Name); Assert.AreEqual((decimal)expectedPrice, thisItem.Price); Assert.AreEqual(expectedSlot, thisItem.SlotLocation); Assert.AreEqual(expectedMessage, thisItem.Message); }
public void Food_Classes_Properly_Implement_Constructor(string name, string price) { decimal newPrice = decimal.Parse(price); Candy testCandy2 = new Candy(name, newPrice); Assert.IsTrue(testCandy2.Name == name && testCandy2.Price == newPrice); Chip testChip2 = new Chip(name, newPrice); Assert.IsTrue(testChip2.Name == name && testChip2.Price == newPrice); Drink drinky = new Drink(name, newPrice); Assert.IsTrue(drinky.Name == name && drinky.Price == newPrice); Gum gummy = new Gum(name, newPrice); Assert.IsTrue(gummy.Name == name && gummy.Price == newPrice); }
public void CreateVendingItems() { Chip chip = new Chip("Potato Crisps", 3.05M); Assert.AreEqual(chip.Name, "Potato Crisps"); Assert.AreEqual(chip.Price, 3.05M); Candy candy = new Candy("Moonpie", 1.80M); Assert.AreEqual(candy.Name, "Moonpie"); Assert.AreEqual(candy.Price, 1.80M); Drink drink = new Drink("Cola", 1.25M); Assert.AreEqual(drink.Name, "Cola"); Assert.AreEqual(drink.Price, 1.25M); Gum gum = new Gum("U-Chews", .85M); Assert.AreEqual(gum.Name, "U-Chews"); Assert.AreEqual(gum.Price, .85M); }
public override bool ShutDown(Gum.Plugins.PluginShutDownReason shutDownReason) { // can't be shut down return false; }
public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateTo(Gum.DataTypes.Variables.StateSave first, Gum.DataTypes.Variables.StateSave second, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing) { FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing); tweener.Owner = this; tweener.PositionChanged = newPosition => this.InterpolateBetween(first, second, newPosition); tweener.Start(); StateInterpolationPlugin.TweenerManager.Self.Add(tweener); return tweener; }
public void InterpolateBetween(Gum.DataTypes.Variables.StateSave first, Gum.DataTypes.Variables.StateSave second, float interpolationValue) { if (index >= listOfLists.Count) { const int capacity = 20; var newList = new List<DataTypes.Variables.VariableSaveValues>(capacity); listOfLists.Add(newList); } List<Gum.DataTypes.Variables.VariableSaveValues> values = listOfLists[index]; values.Clear(); index++; Gum.DataTypes.Variables.StateSaveExtensionMethods.Merge(first, second, interpolationValue, values); this.ApplyState(values); index--; }
public static void SetVariablesRecursively(this GraphicalUiElement graphicalElement, ElementSave elementSave, Gum.DataTypes.Variables.StateSave stateSave) { if (!string.IsNullOrEmpty(elementSave.BaseType)) { var baseElementSave = Gum.Managers.ObjectFinder.Self.GetElementSave(elementSave.BaseType); if (baseElementSave != null) { graphicalElement.SetVariablesRecursively(baseElementSave); } } var variablesToSet = stateSave.Variables.Where(item => item.SetsValue && item.Value != null); foreach (var variable in variablesToSet) { // See below for explanation on why we don't set Parent here if (variable.GetRootName() != "Parent") { graphicalElement.SetProperty(variable.Name, variable.Value); } } // Now set all parents // The reason for this is // because parents need to // be assigned in the order // of the instances in the .glux. // That way they are drawn in the same // order as they are defined. variablesToSet = variablesToSet.Where(item => item.GetRootName() == "Parent") .OrderBy(item => elementSave.Instances.FindIndex(instance => instance.Name == item.SourceObject)); foreach (var variable in variablesToSet) { graphicalElement.SetProperty(variable.Name, variable.Value); } }
public static ElementAnimationsViewModel FromSave(ElementAnimationsSave save, Gum.DataTypes.ElementSave element) { ElementAnimationsViewModel toReturn = new ElementAnimationsViewModel(); foreach(var animation in save.Animations) { var vm = AnimationViewModel.FromSave(animation, element); toReturn.Animations.Add(vm); } return toReturn; }
public override bool ShutDown(Gum.Plugins.PluginShutDownReason shutDownReason) { return true; }
public static void SetVariablesTopLevel(this GraphicalUiElement graphicalElement, ElementSave elementSave, Gum.DataTypes.Variables.StateSave stateSave) { foreach (var variable in stateSave.Variables.Where(item => item.SetsValue && item.Value != null)) { graphicalElement.SetProperty(variable.Name, variable.Value); } }