예제 #1
0
        public async Task Can_get_all_GoodsReceipts_in_database()
        {
            using (var context = new ProcurementDbContext(ContextOptions))
            {
                GoodsReceiptsController receiptsController = new GoodsReceiptsController(context);

                var result = await receiptsController.GetGoodsReceipt();

                var viewResult    = Assert.IsType <ActionResult <IEnumerable <GoodsReceipt> > >(result);
                var goodsReceipts = Assert.IsType <List <GoodsReceipt> >(viewResult.Value);
                Assert.Single(goodsReceipts);
            }
        }
예제 #2
0
        public async Task Should_not_return_GoodsReceipt_when_not_existing()
        {
            const int RECEIPT_ID = 11;

            using (var context = new ProcurementDbContext(ContextOptions))
            {
                GoodsReceiptsController receiptsController = new GoodsReceiptsController(context);

                var result = await receiptsController.GetGoodsReceipt(RECEIPT_ID);

                var viewResult = Assert.IsType <ActionResult <GoodsReceipt> >(result);
                Assert.IsNotType <GoodsReceipt>(viewResult.Value);
                var response = Assert.IsType <NotFoundResult>(viewResult.Result);
                Assert.Equal(404, response.StatusCode);
            }
        }
예제 #3
0
        public async Task Can_get_GoodsReceipt_details_by_ReceiptId()
        {
            const int RECEIPT_ID = 1;

            using (var context = new ProcurementDbContext(ContextOptions))
            {
                GoodsReceiptsController receiptsController = new GoodsReceiptsController(context);

                var result = await receiptsController.GetGoodsReceipt(RECEIPT_ID);

                var viewResult   = Assert.IsType <ActionResult <GoodsReceipt> >(result);
                var goodsReceipt = Assert.IsType <GoodsReceipt>(viewResult.Value);
                Assert.NotNull(goodsReceipt);
                Assert.Equal(RECEIPT_ID, goodsReceipt.ReceiptId);
            }
        }
예제 #4
0
        public async Task Returned_GoodsReceipt_should_include_relavant_PurchaseOrder()
        {
            const int RECEIPT_ID = 1;
            const int PURCHASE_ORDER_REFERENCE = 1;

            using (var context = new ProcurementDbContext(ContextOptions))
            {
                GoodsReceiptsController receiptsController = new GoodsReceiptsController(context);

                var result = await receiptsController.GetGoodsReceipt(RECEIPT_ID);

                var viewResult   = Assert.IsType <ActionResult <GoodsReceipt> >(result);
                var goodsReceipt = Assert.IsType <GoodsReceipt>(viewResult.Value);
                Assert.NotNull(goodsReceipt);
                Assert.Equal(RECEIPT_ID, goodsReceipt.ReceiptId);

                var purchaseOrder = Assert.IsType <PurchaseOrder>(goodsReceipt.PurchaseOrder);
                Assert.NotNull(purchaseOrder);
                Assert.Equal(PURCHASE_ORDER_REFERENCE, purchaseOrder.OrderReference);
            }
        }