Ejemplo n.º 1
0
        public void TagsControllerProcessChecked()
        {
            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 <TagItem>();

            items.Add(new TagItem()
            {
                IsChecked = true,
                TagName   = "test"
            });

            var result = _ctrl.ProcessChecked(items);

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