示例#1
0
        public void Unresolved_FillOrders_CanBe_Retrieved()
        {
            List <FillOrder> orders = new List <FillOrder>()
            {
                new FillOrder()
                {
                    ProcessDate = null,
                    Id          = 1,
                    Processed   = false,
                    ProductId   = 1,
                    Stock       = 1,
                    CreatedDate = DateTime.Now
                },
                new FillOrder()
                {
                    ProcessDate = null,
                    Id          = 2,
                    Processed   = false,
                    ProductId   = 1,
                    Stock       = 1,
                    CreatedDate = DateTime.Now
                },
                new FillOrder()
                {
                    ProcessDate = null,
                    Id          = 3,
                    Processed   = false,
                    ProductId   = 1,
                    Stock       = 1,
                    CreatedDate = DateTime.Now
                }
            };
            var mockFillOrderRepo = Substitute.For <IFillOrderRepo>();

            mockFillOrderRepo.GetUnProcessedFillOrders().Returns(orders);
            FillOrderService fillOrderService = new FillOrderService(mockFillOrderRepo);

            IEnumerable <FillOrder> result;

            try
            {
                result = fillOrderService.GetUnProcessedFillOrders();
            }
            catch (Exception exception)
            {
                Assert.Fail(exception.Message);
                return;
            }

            foreach (FillOrder fillOrder in result)
            {
                Assert.AreEqual(fillOrder.Processed, false, "Returned a processed order!");
            }
        }
示例#2
0
 public IActionResult GetUnprocessedFillOrders()
 {
     return(Ok(_fillOrderService.GetUnProcessedFillOrders()));
 }