Beispiel #1
0
        public void TestMethod_LinkToServiceAssembly()
        {
            TrackingController _testController = new TrackingController();
            var result = _testController.Post(null);

            Assert.IsNotNull(result);
        }
Beispiel #2
0
        public async Task RegularPostShoudReturn200()
        {
            TrackingController controller = new TrackingController();

            var input = new OrderTrackingInformation()
            {
                Order_id = 12,
                Event    = new OrderTrackingEvent()
                {
                    Date      = DateTime.Now,
                    Status_id = 1
                }
            };

            var resultapi = await controller.Post(input);

            OkResult result = Assert.IsType <OkResult>(resultapi);

            Assert.Equal <int>(200, result.StatusCode);
        }
Beispiel #3
0
        public async void MissingFieldShouldReturn400()
        {
            TrackingController controller = new TrackingController();

            var input = new OrderTrackingInformation()
            {
                Order_id = null,
                Event    = new OrderTrackingEvent()
                {
                    Date      = DateTime.Now,
                    Status_id = 1
                }
            };

            var result = await controller.Post(input);

            BadRequestObjectResult viewResult = Assert.IsType <BadRequestObjectResult>(result);

            Assert.Equal <int>(400, viewResult.StatusCode.Value);
        }