public void AddTwoNormalProducts() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; ConcreteProduct product2 = new ConcreteProduct() { Name = "My Super Product 2", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; SellService sellService = new SellService(this._repository); sellService.AddProduct(product); sellService.AddProduct(product2); Assert.AreEqual(product, this._repository.Get(0)); Assert.AreEqual(product2, this._repository.Get(1)); }
public void AddNormalProductEventsAddCheck() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100, }; SellService sellService = new SellService(this._repository); bool isAddCalled = false; bool isAddedCalled = false; sellService.OnAddProduct += (sender, args) => { isAddCalled = true; }; sellService.OnAddedProduct += (sender, args) => { isAddedCalled = true; }; sellService.AddProduct(product); Assert.IsTrue(isAddCalled); Assert.IsTrue(isAddedCalled); Assert.AreEqual(product, this._repository.Get(0)); }
public void SellNormalProductEventCheck() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; SellService sellService = new SellService(this._repository); bool isSellChecked = false; bool isSoldChecked = false; sellService.OnSellProduct += (sender, args) => { isSellChecked = true; }; sellService.OnSoldProduct += (sender, args) => { isSoldChecked = true; }; sellService.AddProduct(product); sellService.SellProduct(product); Assert.IsTrue(isSellChecked); Assert.IsTrue(isSoldChecked); Assert.AreEqual((uint)49, this._repository.Get(0).Count); }
public void AddInvalidProductNull() { ConcreteProduct product = null; SellService sellService = new SellService(this._repository); sellService.AddProduct(product); }
public void DeleteUnExcitedProduct() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; SellService sellService = new SellService(this._repository); sellService.AddProduct(product); sellService.DeleteProduct(510); }
public void UpdateNullProduct() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; ConcreteProduct product2 = null; SellService sellService = new SellService(this._repository); sellService.AddProduct(product); sellService.UpdateProduct(product2); }
public void DeleteNormalProduct() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; SellService sellService = new SellService(this._repository); sellService.AddProduct(product); sellService.DeleteProduct(0); Assert.IsNull(this._repository.Get(0)); }
public void SellNormalProduct() { ConcreteProduct product = new ConcreteProduct() { Name = "My Super Product", Description = "Description of my super product", Weight = 100, Price = 100, Count = 50, Height = 100, Width = 100 }; SellService sellService = new SellService(this._repository); sellService.AddProduct(product); sellService.SellProduct(product); Assert.AreEqual((uint)49, this._repository.Get(0).Count); }