static void Main(string[] args) { Bike bike = new Bike(2, "TestBike", "TestFirma", "Gul", 19999.99M, "En test cykel!"); BikeShop bs = new BikeShop("TestShop", "TestArea", 0000); bs.AddBike(bike); bs.UpdateBike(bike, "Ny description!", 5.0M); Bike updatedBike = new Bike(2, "TestBike", "TestFirma", "Gul", 5.0M, "Ny description!"); if (bs.BikeDict.ContainsKey(bike)) { Console.WriteLine("no"); } else { Console.WriteLine("yes"); } bs.OrderBikesFromStorage(bike, 10); Console.Read(); }
public void CreateBikeTest() { Bike bike = new Bike(2, "HurtigDrengen", "Lynet", "Gul", 19999.99M, "En meget hurtig cykel!"); BikeShop bs = new BikeShop("TestShop", "TestArea", 0000); bs.AddBike(bike); Assert.That(bs.BikeDict.ContainsKey(bike)); }
public void ReadBikeTest() { Bike bike = new Bike(2, "TestBike", "TestFirma", "Gul", 19999.99M, "En test cykel!"); BikeShop bs = new BikeShop("TestShop", "TestArea", 0000); bs.AddBike(bike); Assert.That(bs.BikeDict.ContainsKey(bike)); Assert.NotNull(bs.LookAtBike(bike)); }
public void SellBikeTest() { Bike bike = new Bike(2, "TestBike", "TestFirma", "Gul", 19999.99M, "En test cykel!"); BikeShop bs = new BikeShop("TestShop", "TestArea", 0000); bs.AddBike(bike); Assert.That(bs.BikeDict.ContainsKey(bike)); bs.SellBike(bike); Assert.AreEqual(0, bs.BikeDict[bike]); Assert.AreEqual(bike.Price, bs.Earnings); int quantity = 100; bs.AddBike(bike, quantity); bs.SellBike(bike); Assert.AreEqual(quantity - 1, bs.BikeDict[bike]); Assert.AreEqual(bike.Price * 2, bs.Earnings); }
public void DeleteBikeTest() { Bike bike = new Bike(2, "TestBike", "TestFirma", "Gul", 19999.99M, "En test cykel!"); BikeShop bs = new BikeShop("TestShop", "TestArea", 0000); bs.AddBike(bike); Assert.That(bs.BikeDict.ContainsKey(bike)); bs.RemoveBikeFromInventory(bike); Assert.False(bs.BikeDict.ContainsKey(bike)); }
public void UpdateBikeTest() { Bike bike = new Bike(2, "TestBike", "TestFirma", "Gul", 19999.99M, "En test cykel!"); Bike originalBike = new Bike(2, "TestBike", "TestFirma", "Gul", 19999.99M, "En test cykel!"); BikeShop bs = new BikeShop("TestShop", "TestArea", 0000); bs.AddBike(bike); Assert.That(bs.BikeDict.ContainsKey(bike)); bs.UpdateBike(bike, "Ny description!", 5.0M); Assert.That(bs.BikeDict.ContainsKey(bike)); Assert.False(bs.BikeDict.ContainsKey(originalBike)); }