Example #1
0
        public async Task <IActionResult> OrderById(string OrderId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var getorder = await _groceryServices.GetOrderById(OrderId);

            if (getorder == null)
            {
                return(NotFound());
            }
            return(CreatedAtAction("AllOrder", new { OrderId = getorder.OrderId }, getorder));
        }
        public async Task <bool> Testfor_Validate_GetOrderById()
        {
            //Arrange
            bool res = false;

            //Act
            groceryservice.Setup(repo => repo.GetOrderById(_productOrder.OrderId)).ReturnsAsync(_productOrder);
            var result = await _groceryS.GetOrderById(_productOrder.OrderId);

            if (result != null)
            {
                res = true;
            }
            //Asert
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_revised.txt", "Testfor_Validate_GetOrderById=" + res + "\n");

            return(res);
        }