Пример #1
0
        public void DeleteProductStorageControllerTest()
        {
            int old_id = Product.GetNextID();
            ConcurrentDictionary <int, int> StorageWithAmount = new ConcurrentDictionary <int, int>();
            Random Rng = new Random();

            StorageWithAmount.TryAdd(Rng.Next() % 5, Rng.Next() % 10);
            SC.CreateProduct(old_id, "TestProd", "TestBrand", 20m, 1, false, 0m, 10m, StorageWithAmount);
            int  new_id    = Product.GetNextID();
            bool Identical = (SC.ProductDictionary[old_id] == SC.AllProductsDictionary[old_id]);
            bool Rest      = (new_id > old_id) && SC.ProductDictionary.ContainsKey(old_id) && SC.AllProductsDictionary.ContainsKey(old_id);
            bool FirstStep = Identical && Rest;

            if (FirstStep)
            {
                SC.DeleteProduct(old_id);
                Assert.IsTrue(!(SC.ProductDictionary.ContainsKey(old_id) || SC.AllProductsDictionary.ContainsKey(old_id)));
            }
            else
            {
                Assert.Fail();
            }
        }