예제 #1
0
        public async void Task_update_Return_notfound()
        {
            var controller = new FeedBackController(context);
            var id         = 12;
            var user       = new FeedBack()
            {
                FeedBackId = 2,
                Message    = "Awesome Blosoom",
                CustomerId = 1
            };
            var data = await controller.Put(id, user);

            Assert.IsType <NotFoundResult>(data);
        }
예제 #2
0
        public async void Task_update_Return_ok()
        {
            var id         = 2;
            var controller = new FeedBackController(context);
            var user       = new FeedBack()
            {
                FeedBackId = 2,
                Message    = "Awesome Blosoom",
                CustomerId = 1
            };
            var data1 = await controller.Put(id, user);

            Assert.IsType <OkObjectResult>(data1);
        }
예제 #3
0
        public async void Task_update_Return_Badreq()
        {
            var controller = new FeedBackController(context);
            int?id         = null;
            var user       = new FeedBack()
            {
                FeedBackId = 2,
                Message    = "Awesome Blosoom",
                CustomerId = 1
            };
            var data1 = await controller.Put(id, user);

            Assert.IsType <BadRequestResult>(data1);
        }
예제 #4
0
        public void PutTest()
        {
            var target = new FeedBackController();

            var targetResponse = target.Put(putTestValue);

            Assert.IsInstanceOfType(targetResponse, typeof(OkNegotiatedContentResult <BaseResponse <FeedBack> >));
            var targetResponseData = targetResponse as OkNegotiatedContentResult <BaseResponse <FeedBack> >;

            //var actual = new FeedBackController();
            //var actualResponse = target.Put(putTestValue);
            //Assert.IsInstanceOfType(targetResponse, typeof(OkNegotiatedContentResult<BaseResponse<FeedBack>>));
            //var actualResponseData = actualResponse as OkNegotiatedContentResult<BaseResponse<FeedBack>>;
            Assert.IsNotNull(targetResponseData);
            Assert.IsNotNull(targetResponseData.Content);
            Assert.IsTrue(targetResponseData.Content.Success);

            //Assert.Inconclusive("驗證正確性!!!");
        }