From be220e8bc2e702bedda29da6b288d137c0dbce06 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 8 Nov 2018 15:22:56 -0800 Subject: [PATCH] Remove test verifying orders --- .../DefaultOrderTest.cs | 51 ------------------- .../Controllers/OrderController.cs | 37 -------------- 2 files changed, 88 deletions(-) delete mode 100644 test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs delete mode 100644 test/WebSites/BasicWebSite/Controllers/OrderController.cs diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs deleted file mode 100644 index 9ad42e0ee4..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/DefaultOrderTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.AspNetCore.Mvc.ActionConstraints; -using Microsoft.AspNetCore.Mvc.ApiExplorer; -using Microsoft.AspNetCore.Mvc.Filters; -using Xunit; - -namespace Microsoft.AspNetCore.Mvc.FunctionalTests -{ - // Tests that various MVC services have the correct order. - public class DefaultOrderTest : IClassFixture> - { - public DefaultOrderTest(MvcTestFixture fixture) - { - Client = fixture.CreateDefaultClient(); - } - - public HttpClient Client { get; } - - [Theory] - [InlineData(typeof(IActionDescriptorProvider), "Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider", -1000)] - [InlineData(typeof(IActionInvokerProvider), null, -1000)] - [InlineData(typeof(IApiDescriptionProvider), null, -1000)] - [InlineData(typeof(IFilterProvider), null, -1000)] - [InlineData(typeof(IActionConstraintProvider), null, -1000)] - public async Task ServiceOrder_GetOrder(Type serviceType, string actualType, int order) - { - // Arrange - var url = "http://localhost/Order/GetServiceOrder?serviceType=" + serviceType.AssemblyQualifiedName; - - if (actualType != null) - { - url += "&actualType=" + actualType; - } - - // Act - var response = await Client.GetAsync(url); - var content = await response.Content.ReadAsStringAsync(); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal(order, int.Parse(content)); - } - } -} \ No newline at end of file diff --git a/test/WebSites/BasicWebSite/Controllers/OrderController.cs b/test/WebSites/BasicWebSite/Controllers/OrderController.cs deleted file mode 100644 index d196bbdd3e..0000000000 --- a/test/WebSites/BasicWebSite/Controllers/OrderController.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.AspNetCore.Mvc; - -namespace BasicWebSite -{ - public class OrderController : Controller - { - public int GetServiceOrder(string serviceType, string actualType) - { - var elementType = Type.GetType(serviceType); - - var queryType = typeof(IEnumerable<>).MakeGenericType(elementType); - - var services = (IEnumerable)HttpContext?.RequestServices.GetService(queryType); - foreach (var service in services) - { - if (actualType != null && service.GetType().FullName == actualType) - { - var orderProperty = elementType.GetTypeInfo().GetDeclaredProperty("Order"); - return (int)orderProperty.GetValue(service); - } - else if (actualType == null) - { - var orderProperty = elementType.GetProperty("Order"); - return (int)orderProperty.GetValue(service); - } - } - - throw new InvalidOperationException(); - } - } -} \ No newline at end of file