コード例 #1
0
        public void PageControllerProcessChecked()
        {
            var config    = new HttpConfiguration();
            var request   = new HttpRequestMessage(HttpMethod.Post, "http://localhost/be/api");
            var route     = config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}");
            var routeData = new HttpRouteData(route, new HttpRouteValueDictionary {
                { "id", "delete" }
            });

            _ctrl.ControllerContext = new HttpControllerContext(config, routeData, request);
            _ctrl.Request           = request;
            _ctrl.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;

            var items = new List <PageDetail>();

            items.Add(new PageDetail()
            {
                IsChecked = true,
                Id        = Guid.NewGuid()
            });

            var result = _ctrl.ProcessChecked(items);

            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
        }