Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void SellNullProduct()
        {
            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.SellProduct(product2);
        }
Exemplo n.º 3
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);
        }