예제 #1
0
        public void DeleteShopWcf()
        {
            var shop = new Shop()
            {
                Name        = "hello world",
                Address     = "Hello address",
                OpeningTime = "Never",
                Cvr         = "12121212",
                Warehouses  = new List <Warehouse>(),
                Chain       = new Chain
                {
                    Id      = 1,
                    Cvr     = "12121212",
                    Name    = "",
                    Persons = new List <Person>(),
                    Shops   = new List <Shop>()
                }
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var i = proxy.AddShop(shop);
                var j = proxy.DeleteShop(i);
                Assert.AreEqual(1, j);
            }
        }
예제 #2
0
        public void UpdateWarehouseWcf()
        {
            var prod = new Product
            {
                Id          = 1,
                Category    = "category",
                Description = "ddeskr",
                Name        = "banan",
                Price       = 10
            };
            var shop = new Shop
            {
                Name        = "ShopName",
                Address     = "new addr",
                OpeningTime = "Manday Never",
                Chain       = new DbChain().GetChain(1),
                Cvr         = "12121212",
                Warehouses  = new List <Warehouse>()
            };
            var warehouseToUpdate = new Warehouse(1, 1, prod, shop, 1);

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var shopId = proxy.AddShop(shop);
                shop.Id = shopId;
                var id = proxy.AddWarehouse(warehouseToUpdate);
                warehouseToUpdate.Id = id;
                var warehouseNew = new Warehouse(id, 100, 50, prod, shop, 1);
                proxy.UpdateWarehouse(warehouseNew);
                var updatedWarehouse = proxy.GetWarehouse(id);
                proxy.DeleteWarehouse(id);
                Assert.AreEqual(warehouseNew.Stock, updatedWarehouse.Stock);
            }
        }
예제 #3
0
        public void AddShopWcfFailBoth2()
        {
            var shop = new Shop()
            {
                Name       = "",
                Address    = "",
                Cvr        = "",
                Warehouses = new List <Warehouse>(),
                Chain      = new Chain
                {
                    Id      = 1,
                    Cvr     = "12121212",
                    Name    = "",
                    Persons = new List <Person>(),
                    Shops   = new List <Shop>()
                }
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var i = proxy.AddShop(shop);
                proxy.DeleteShop(i);
                Assert.AreEqual(0, i);
            }
        }
예제 #4
0
        public void GetWarehouseFailWcf()
        {
            var prod = new Product
            {
                Id          = 1,
                Category    = "category",
                Description = "ddeskr",
                Name        = "banan",
                Price       = 10
            };

            var shop = new Shop
            {
                Id         = 1,
                Name       = "ShopName",
                Address    = "new addr",
                Chain      = new Chain(),
                Cvr        = "12121212",
                Warehouses = new List <Warehouse>()
            };

            var warehouse1 = new Warehouse(10, 5, prod, shop, 1);
            var warehouse2 = new Warehouse(10, 5, prod, shop, 1);

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var id1 = proxy.AddWarehouse(warehouse1);
                var id2 = proxy.AddWarehouse(warehouse2);
                proxy.DeleteWarehouse(id1);
                var rw = proxy.GetWarehouse(id1);
                proxy.DeleteWarehouse(id2);
                Assert.IsNull(rw);
            }
        }
예제 #5
0
        public void AddWarehouseWcf()
        {
            var prod = new Product
            {
                Id          = 1,
                Category    = "category",
                Description = "ddeskr",
                Name        = "banan",
                Price       = 10
            };
            var shop = new Shop
            {
                Name        = "ShopName",
                Address     = "new addr",
                OpeningTime = "Manday Never",
                Chain       = new Chain(),
                Cvr         = "12121212",
                Warehouses  = new List <Warehouse>()
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var chain = proxy.GetChain(1);
                shop.Chain = chain;
                var shopId = proxy.AddShop(shop);
                shop.Id = shopId;
                var warehouse = new Warehouse(10, 5, prod, shop, 1);
                var id        = proxy.AddWarehouse(warehouse);
                proxy.DeleteWarehouse(id);
                Assert.AreNotEqual(0, id);
            }
        }
예제 #6
0
        public void GetShopWcfFailAddress()
        {
            var shop = new Shop()
            {
                Name       = "hello world",
                Address    = null,
                Cvr        = "Hello Cvr",
                Warehouses = new List <Warehouse>(),
                Chain      = new Chain
                {
                    Id      = 1,
                    Cvr     = "12121212",
                    Name    = "",
                    Persons = new List <Person>(),
                    Shops   = new List <Shop>()
                }
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var i = proxy.AddShop(shop);
                var j = proxy.GetShop(i);
                proxy.DeleteShop(i);
                Assert.IsNull(j);
            }
        }
예제 #7
0
 public void GetAllChainWcf()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         Assert.AreNotEqual(0, proxy.GetAllChains().Length);
     }
 }
예제 #8
0
 public void GetChainWcfByIdFail()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         Assert.IsNull(proxy.GetChain(150));
     }
 }
예제 #9
0
 public void GetAllWarehousesByShopIdWcf()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         var count = proxy.GetAllWarehousesByShopId(1).Count();
         Assert.AreNotEqual(0, count);
     }
 }
예제 #10
0
 public void DeleteShopWcfFailId()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         var j = proxy.DeleteShop(0);
         Assert.AreEqual(0, j);
     }
 }
예제 #11
0
 public void UpdateLoginWcfFailNull()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         var lCtr  = new LoginCtr(new DbLogin());
         var login = lCtr.Login(null);
         Assert.IsNull(login);
     }
 }
예제 #12
0
 public void DeleteProductWcf()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         var product = new Product("The product1 name", 23.45m, "The product1 description", "The product1 catagory", "Img path");
         var id      = proxy.AddProduct(product);
         var i       = proxy.DeleteProduct(id);
         Assert.AreEqual(1, i);
     }
 }
예제 #13
0
 public void AddCartWcf()
 {
     using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
     {
         proxy.Open();
         var cart = new Cart
         {
             ShopId     = 1,
             PersonId   = 1,
             TotalPrice = new decimal(5)
         };
         var id = proxy.AddCart(cart);
         Assert.AreNotEqual(0, id);
     }
 }
예제 #14
0
        public void AddShopWcfFailWarehouse()
        {
            var shop = new Shop()
            {
                Name       = null,
                Address    = null,
                Cvr        = null,
                Warehouses = null
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var i = proxy.AddShop(shop);
                proxy.DeleteShop(i);
                Assert.AreEqual(0, i);
            }
        }
예제 #15
0
        public void GetShopWcfFailAll()
        {
            var shop = new Shop()
            {
                Name       = null,
                Address    = null,
                Cvr        = null,
                Warehouses = null
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var i = proxy.AddShop(shop);
                var j = proxy.GetShop(i);
                proxy.DeleteShop(i);
                Assert.IsNull(j);
            }
        }
예제 #16
0
        public void GetShopWcfFailWarehouse()
        {
            var shop = new Shop()
            {
                Name       = "hello world",
                Address    = "Hello address",
                Cvr        = "12121212",
                Warehouses = null,
                Chain      = null
            };

            using (var proxy = new BestilNemtServiceRef.BestilNemtServiceClient())
            {
                proxy.Open();
                var i = proxy.AddShop(shop);
                var j = proxy.GetShop(i);
                proxy.DeleteShop(i);
                Assert.IsNull(j);
            }
        }
예제 #17
0
 public UnitTest2Person()
 {
     proxy = new BestilNemtServiceRef.BestilNemtServiceClient();
 }