Exemplo n.º 1
0
        public void UpdateNormalProduct()
        {
            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,
                Id          = 0
            };

            SellService sellService = new SellService(this._repository);

            sellService.AddProduct(product);
            sellService.UpdateProduct(product2);

            Assert.AreEqual(product2, this._repository.Get(0));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public void UpdateNormalProductEventsCheck()
        {
            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,
                Id          = 0
            };

            SellService sellService = new SellService(this._repository);

            bool isUpdateChecked  = false;
            bool isUpdatedChecked = false;

            sellService.OnUpdateProduct  += (sender, args) => { isUpdateChecked = true; };
            sellService.OnUpdatedProduct += (sender, args) => { isUpdatedChecked = true; };

            sellService.AddProduct(product);
            sellService.UpdateProduct(product2);

            Assert.IsTrue(isUpdatedChecked);
            Assert.IsTrue(isUpdateChecked);
            Assert.AreEqual(product2, this._repository.Get(0));
        }