コード例 #1
0
        public async Task GetDeliveries_Should_Get_List_Of_Deliveries()
        {
            var deliveries = SampleData.GetDeliveryView();

            deliveryService.Setup(x => x.GetDeliveries()).ReturnsAsync(deliveries);

            var result = await deliveryController.GetDeliveries();

            Assert.IsNotNull(result);
        }
コード例 #2
0
        public void GetDeliverys()
        {
            var deliveryService = new Mock <IDeliveryBusinessLayer>();

            deliveryService.Setup(x => x.GetDeliveries()).Returns(new List <Delivery>());

            var controller = new DeliveryController(deliveryService.Object);

            IHttpActionResult actionResult = controller.GetDeliveries();
            var contentResult = actionResult as OkNegotiatedContentResult <List <Delivery> >;

            Assert.IsNotNull(contentResult.Content);
        }