Example #1
0
        public void ModifyGoodIntoOrderTest()
        {
            var os = new OrderService();

            os.AddOrder(1, "a");
            var g = new Good("a", 1);

            os.AddGoodIntoOrder(1, new OrderDetails(g, 1));
            os.ModifyGoodIntoOrder(1, new OrderDetails(g, 5));
            os.DeleteGoodIntoOrder(1, new OrderDetails(g, 5));
            try
            {
                os.ModifyGoodIntoOrder(1, new OrderDetails(g, 1));
                Assert.Fail();
            }
            catch (Exception e)
            {
                if (e.Message != "good not exists")
                {
                    Assert.Fail();
                }
            }
            try
            {
                os.AddGoodIntoOrder(2, new OrderDetails(g, 1));
                Assert.Fail();
            }
            catch (Exception e)
            {
                if (e.Message != "ID not exist")
                {
                    Assert.Fail();
                }
            }
        }