Exemplo n.º 1
0
        public void AddProductToOrder()
        {
            // arrange
            OrderController   oCtrl = new OrderController();
            ProductController pCtrl = new ProductController();

            int     amount      = 1;
            Product testProduct = new Product
            {
                _description = "Testprodukt",
                _name        = "Testprodukt",
                _price       = 13,
                _categoryId  = 2,
                _supplierId  = 2
            };

            // act
            int productId = pCtrl.Create(testProduct);

            testProduct._id = productId;

            UniqueProduct testUniqueProduct = new UniqueProduct
            {
                _product  = testProduct,
                _serialNo = RandomString(9),
                _warranty = "forever"
            };

            pCtrl.CreateUniqueProduct(testUniqueProduct);

            int orderId = oCtrl.CreateOrder();

            oCtrl.AddProduct(orderId, productId, amount);

            // assert
            Assert.IsTrue(orderId != 0);
        }