Esempio n. 1
0
        public async Task WebHost_Batching_WithSpecialCharactersInUrl()
        {
            // Arrange
            var handler = new SuccessMessageHandler();

            var routeCollection = new HostedHttpRouteCollection(new RouteCollection(), "/");

            routeCollection.Add("default", routeCollection.CreateRoute(
                                    "values/  space",
                                    defaults: null,
                                    constraints: null,
                                    dataTokens: null,
                                    handler: handler));

            var configuration = new HttpConfiguration(routeCollection);

            var server = new HttpServer(configuration);

            var batchHandler = new DefaultHttpBatchHandler(server);
            var request      = new HttpRequestMessage
            {
                Content = new MultipartContent("mixed")
                {
                    new HttpMessageContent(new HttpRequestMessage(HttpMethod.Post, "http://contoso.com/values/  space"))
                }
            };

            // Arrange
            var response = await batchHandler.ProcessBatchAsync(request, CancellationToken.None);

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.True(handler.IsCalled);
        }
Esempio n. 2
0
        private static GenericResponseResult <List <SchedulerSetupModel> > GetResponse(JobCommandEnum jobCommand)
        {
            var response = new GenericResponseResult <List <SchedulerSetupModel> > {
                ResultObject   = GetMocketList(),
                SuccessMessage = SuccessMessageHandler.FillSuccessMessage(jobCommand)
            };

            return(response);
        }
Esempio n. 3
0
        public async Task <IActionResult> InsertCategoryAsync([FromBody] CategoryRegisterDTO dTO)
        {
            await _categoryService.RegisterAsync(dTO);

            if (dTO.Id != 0)
            {
                return(SuccessMessageHandler.EditCategory());
            }
            else
            {
                return(SuccessMessageHandler.InsertCategory());
            }
        }
Esempio n. 4
0
        public async Task <IActionResult> DeleteCategoryAsync(int CategoryId)
        {
            await _categoryService.RemoveAsync(CategoryId);

            return(SuccessMessageHandler.DeleteCategory());
        }
Esempio n. 5
-1
        public async Task WebHost_Batching_WithSpecialCharactersInUrl()
        {
            // Arrange
            var handler = new SuccessMessageHandler();

            var routeCollection = new HostedHttpRouteCollection(new RouteCollection(), "/");
            routeCollection.Add("default", routeCollection.CreateRoute(
                "values/  space",
                defaults: null,
                constraints: null,
                dataTokens: null,
                handler: handler));

            var configuration = new HttpConfiguration(routeCollection);

            var server = new HttpServer(configuration);

            var batchHandler = new DefaultHttpBatchHandler(server);
            var request = new HttpRequestMessage
            {
                Content = new MultipartContent("mixed")
                {
                    new HttpMessageContent(new HttpRequestMessage(HttpMethod.Post, "http://contoso.com/values/  space"))
                }
            };

            // Arrange
            var response = await batchHandler.ProcessBatchAsync(request, CancellationToken.None);

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.True(handler.IsCalled);
        }