From a602d548e26e393e8d1d19e2fd6ab785af33edb6 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 5 Oct 2015 18:23:31 -0700 Subject: [PATCH] Allow ViewFeature tests to run in dnxcore50 --- .../ControllerTest.cs | 6 ++--- .../ControllerUnitTestabilityTests.cs | 22 +++++++++++-------- .../HtmlAttributePropertyHelperTest.cs | 9 ++++---- .../PartialViewResultTest.cs | 4 +++- .../RemoteAttributeTest.cs | 2 ++ .../Rendering/DefaultTemplatesUtilities.cs | 4 +++- .../Rendering/HtmlHelperCheckboxTest.cs | 4 +++- .../HtmlHelperDisplayNameExtensionsTest.cs | 4 +++- .../Rendering/HtmlHelperDisplayTextTest.cs | 5 +++-- .../Rendering/HtmlHelperFormExtensionsTest.cs | 4 +++- .../Rendering/HtmlHelperFormTest.cs | 4 +++- .../Rendering/HtmlHelperHiddenTest.cs | 5 +++-- .../HtmlHelperLabelExtensionsTest.cs | 4 +++- .../Rendering/HtmlHelperLinkGenerationTest.cs | 4 +++- .../Rendering/HtmlHelperNameExtensionsTest.cs | 4 +++- .../HtmlHelperPartialExtensionsTest.cs | 4 +++- .../Rendering/HtmlHelperPasswordTest.cs | 5 +++-- .../Rendering/HtmlHelperSelectTest.cs | 4 +++- .../Rendering/HtmlHelperTest.cs | 2 ++ .../HtmlHelperValidationSummaryTest.cs | 4 +++- .../Rendering/HtmlHelperValueTest.cs | 4 +++- .../Rendering/ViewContextTests.cs | 2 ++ .../ContentViewComponentResultTest.cs | 4 +++- ...aultViewComponentDescriptorProviderTest.cs | 5 ++++- .../DefaultViewComponentSelectorTest.cs | 5 ++++- .../JsonViewComponentResultTest.cs | 4 +++- .../ViewViewComponentResultTest.cs | 4 +++- .../ViewEngines/CompositeViewEngineTest.cs | 4 +++- .../DefaultDisplayTemplatesTest.cs | 4 +++- .../DefaultEditorTemplatesTest.cs | 4 +++- .../ViewFeatures/DefaultHtmlGeneratorTest.cs | 5 +++-- .../PartialViewResultExecutorTest.cs | 2 ++ .../ViewFeatures/SaveTempDataFilterTest.cs | 2 ++ .../SessionStateTempDataProviderTest.cs | 1 - .../ViewFeatures/TempDataDictionaryTest.cs | 1 - .../ViewFeatures/ViewDataDictionaryTest.cs | 4 +++- .../ViewFeatures/ViewExecutorTest.cs | 4 +++- .../ViewFeatures/ViewResultExecutorTest.cs | 2 ++ .../ViewResultTest.cs | 4 +++- .../project.json | 9 +++++--- 40 files changed, 125 insertions(+), 53 deletions(-) diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs index d2ecea8e10..3a5209547a 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.IO; @@ -8,7 +9,6 @@ using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; @@ -19,9 +19,7 @@ using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.AspNet.Mvc.ViewFeatures; using Microsoft.AspNet.Routing; using Microsoft.AspNet.Testing; -#if DNX451 using Moq; -#endif using Newtonsoft.Json; using Xunit; @@ -1833,3 +1831,5 @@ namespace Microsoft.AspNet.Mvc.Test } } } + +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerUnitTestabilityTests.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerUnitTestabilityTests.cs index 8e8a3c1ba8..a45e89a737 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerUnitTestabilityTests.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ControllerUnitTestabilityTests.cs @@ -9,7 +9,9 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; using Microsoft.AspNet.Routing; +#if MOCK_SUPPORT using Moq; +#endif using Newtonsoft.Json; using Xunit; @@ -142,6 +144,7 @@ namespace Microsoft.AspNet.Mvc } } +#if MOCK_SUPPORT [Fact] public void ControllerFileStream_InvokedInUnitTests() { @@ -178,6 +181,7 @@ namespace Microsoft.AspNet.Mvc } } } +#endif [Fact] public void ControllerJson_InvokedInUnitTests() @@ -511,15 +515,15 @@ namespace Microsoft.AspNet.Mvc public void ActionContextSetters_CanBeUsedWithControllerActionContext() { // Arrange - var actionDescriptor = new Mock(); - var httpContext = new Mock(); - var routeData = new Mock(); + var actionDescriptor = new ActionDescriptor(); + var httpContext = new DefaultHttpContext(); + var routeData = new RouteData(); var actionContext = new ActionContext() { - ActionDescriptor = actionDescriptor.Object, - HttpContext = httpContext.Object, - RouteData = routeData.Object, + ActionDescriptor = actionDescriptor, + HttpContext = httpContext, + RouteData = routeData, }; var controller = new TestabilityController(); @@ -528,10 +532,10 @@ namespace Microsoft.AspNet.Mvc controller.ActionContext = actionContext; // Assert - Assert.Equal(httpContext.Object, controller.HttpContext); - Assert.Equal(routeData.Object, controller.RouteData); + Assert.Same(httpContext, controller.HttpContext); + Assert.Same(routeData, controller.RouteData); Assert.Equal(actionContext.ModelState, controller.ModelState); - Assert.Equal(actionDescriptor.Object, actionContext.ActionDescriptor); + Assert.Same(actionDescriptor, actionContext.ActionDescriptor); } [Fact] diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Internal/HtmlAttributePropertyHelperTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Internal/HtmlAttributePropertyHelperTest.cs index d511a0ae50..588676569d 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Internal/HtmlAttributePropertyHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Internal/HtmlAttributePropertyHelperTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; +using System.Reflection; using Microsoft.Extensions.Internal; using Xunit; @@ -14,7 +15,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal { // Arrange var anonymous = new { bar_baz = "foo" }; - var property = anonymous.GetType().GetProperties().First(); + var property = anonymous.GetType().GetTypeInfo().DeclaredProperties.First(); // Act var helper = new HtmlAttributePropertyHelper(property); @@ -29,7 +30,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal { // Arrange var anonymous = new { foo = "bar" }; - var property = anonymous.GetType().GetProperties().First(); + var property = anonymous.GetType().GetTypeInfo().DeclaredProperties.First(); // Act var helper = new HtmlAttributePropertyHelper(property); @@ -44,7 +45,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal { // Arrange var anonymous = new { bar = "baz" }; - var property = anonymous.GetType().GetProperties().First(); + var property = anonymous.GetType().GetTypeInfo().DeclaredProperties.First(); // Act var helper = new HtmlAttributePropertyHelper(property); @@ -59,7 +60,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal { // Arrange var anonymous = new { foo = 32 }; - var property = anonymous.GetType().GetProperties().First(); + var property = anonymous.GetType().GetTypeInfo().DeclaredProperties.First(); // Act var helper = new HtmlAttributePropertyHelper(property); diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/PartialViewResultTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/PartialViewResultTest.cs index 46429eec1b..4bd57960fc 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/PartialViewResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/PartialViewResultTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Diagnostics.Tracing; using System.Threading.Tasks; @@ -119,4 +120,5 @@ namespace Microsoft.AspNet.Mvc return httpContext; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs index 31da6b99f4..87caedff3e 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http.Internal; @@ -668,3 +669,4 @@ namespace Microsoft.AspNet.Mvc } } } +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs index 3ff28f797a..f0d945b47d 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/DefaultTemplatesUtilities.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -339,4 +340,5 @@ namespace Microsoft.AspNet.Mvc.Rendering return Mock.Of(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs index a72a0b8f63..79aa75c029 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperCheckboxTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -663,4 +664,5 @@ namespace Microsoft.AspNet.Mvc.Rendering public TestModel ComplexProperty { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs index 1f233581bb..0e48a7cced 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using Microsoft.AspNet.Mvc.ModelBinding; @@ -227,4 +228,5 @@ namespace Microsoft.AspNet.Mvc.Rendering public InnerClass Inner { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayTextTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayTextTest.cs index 73033de6fa..5ecb1fb507 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayTextTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperDisplayTextTest.cs @@ -1,7 +1,7 @@ // 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.Globalization; +#if MOCK_SUPPORT using Microsoft.AspNet.Mvc.ModelBinding; using Xunit; @@ -317,4 +317,5 @@ namespace Microsoft.AspNet.Mvc.Rendering } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs index 38ddf818df..243aeb9c6d 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormExtensionsTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.Collections.Generic; using System.IO; using Microsoft.AspNet.Mvc.ViewFeatures; @@ -803,4 +804,5 @@ namespace Microsoft.AspNet.Mvc.Rendering htmlGenerator.Verify(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs index 4950a2879e..be3449887f 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperFormTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.Collections.Generic; using System.IO; using System.Linq; @@ -325,4 +326,5 @@ namespace Microsoft.AspNet.Mvc.Rendering dictionary.Select(keyValue => string.Format(" {0}=\"HtmlEncode[[{1}]]\"", keyValue.Key, keyValue.Value))); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs index ed16cdf1ec..3455c16074 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperHiddenTest.cs @@ -1,10 +1,10 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Globalization; using System.Linq.Expressions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.TestCommon; @@ -901,4 +901,5 @@ namespace Microsoft.AspNet.Mvc.Rendering public List Property6 { get; } = new List(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs index 6ede8bfc1d..4a89eb8a41 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLabelExtensionsTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering; @@ -262,4 +263,5 @@ namespace Microsoft.AspNet.Mvc.Core public InnerClass Inner { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs index eda34f53ab..817dc0fd08 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperLinkGenerationTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.Collections.Generic; using System.Linq; using Microsoft.AspNet.Mvc.Routing; @@ -161,4 +162,5 @@ namespace Microsoft.AspNet.Mvc.Rendering return string.Join(string.Empty, dict.Select(kvp => string.Format(" {0}=\"HtmlEncode[[{1}]]\"", kvp.Key, kvp.Value.ToString()))); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperNameExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperNameExtensionsTest.cs index d3189337f2..160905d1b8 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperNameExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperNameExtensionsTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.Linq.Expressions; @@ -351,4 +352,5 @@ namespace Microsoft.AspNet.Mvc.Core public InnerClass Inner { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs index 2c83eea6c3..35fdf58775 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPartialExtensionsTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Threading.Tasks; using Microsoft.AspNet.Html.Abstractions; @@ -195,4 +196,5 @@ namespace Microsoft.AspNet.Mvc.Rendering } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs index eee37f862f..fba8f5efdf 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperPasswordTest.cs @@ -1,10 +1,10 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Globalization; using System.Linq.Expressions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.TestCommon; @@ -399,4 +399,5 @@ namespace Microsoft.AspNet.Mvc.Rendering public List Property6 { get; } = new List(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs index 1e6c6421e9..81b9b0baae 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperSelectTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -1709,4 +1710,5 @@ namespace Microsoft.AspNet.Mvc.Rendering public List Property1 { get; } = new List(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTest.cs index 023f1dd41f..aa30704f0d 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.Collections.Generic; using Microsoft.AspNet.Mvc.ViewFeatures; using Xunit; @@ -296,3 +297,4 @@ namespace Microsoft.AspNet.Mvc.Rendering } } } +#endif diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs index 386af6f225..5e79d59e70 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValidationSummaryTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -403,4 +404,5 @@ namespace Microsoft.AspNet.Mvc.Rendering public string OrderedProperty1 { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValueTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValueTest.cs index 3cc3b3273f..34b3c085bc 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValueTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/HtmlHelperValueTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering; @@ -260,4 +261,5 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures return helper; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/ViewContextTests.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/ViewContextTests.cs index 3640ef6e45..40c37b12eb 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/ViewContextTests.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/ViewContextTests.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.IO; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; @@ -43,3 +44,4 @@ namespace Microsoft.AspNet.Mvc.Rendering } } } +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ContentViewComponentResultTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ContentViewComponentResultTest.cs index 3bbae8bde8..c6ed6613f8 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ContentViewComponentResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ContentViewComponentResultTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.IO; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; @@ -76,4 +77,5 @@ namespace Microsoft.AspNet.Mvc return viewComponentContext; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs index 48893c7049..8487a967f1 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs @@ -81,7 +81,10 @@ namespace Microsoft.AspNet.Mvc.ViewComponents GetAssemblyProvider() .CandidateAssemblies .SelectMany(a => a.DefinedTypes) - .Select(t => t.GetTypeInfo()); +#if DNX451 + .Select(t => t.GetTypeInfo()) +#endif + ; } private static IAssemblyProvider GetAssemblyProvider() diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentSelectorTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentSelectorTest.cs index 889499c292..4154a4207e 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentSelectorTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/DefaultViewComponentSelectorTest.cs @@ -198,7 +198,10 @@ namespace Microsoft.AspNet.Mvc.ViewComponents GetAssemblyProvider() .CandidateAssemblies .SelectMany(a => a.DefinedTypes) - .Select(t => t.GetTypeInfo()); +#if DNX451 + .Select(t => t.GetTypeInfo()) +#endif + ; } private static IAssemblyProvider GetAssemblyProvider() diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/JsonViewComponentResultTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/JsonViewComponentResultTest.cs index 3694b7ecf0..9ac6436613 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/JsonViewComponentResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/JsonViewComponentResultTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.IO; using System.Text; @@ -96,4 +97,5 @@ namespace Microsoft.AspNet.Mvc return httpContext; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs index 833806f12a..7d65c4e319 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.IO; using System.Threading.Tasks; @@ -369,4 +370,5 @@ namespace Microsoft.AspNet.Mvc return viewComponentContext; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewEngines/CompositeViewEngineTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewEngines/CompositeViewEngineTest.cs index 1350542e16..11fa3bc52a 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewEngines/CompositeViewEngineTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewEngines/CompositeViewEngineTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Linq; using Microsoft.AspNet.Http; @@ -299,4 +300,5 @@ namespace Microsoft.AspNet.Mvc.ViewEngines { } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultDisplayTemplatesTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultDisplayTemplatesTest.cs index 58fe3177d1..56152026af 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultDisplayTemplatesTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultDisplayTemplatesTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -390,4 +391,5 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures public string OrderedProperty1 { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultEditorTemplatesTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultEditorTemplatesTest.cs index 2f6c2927f8..de94dc89dd 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultEditorTemplatesTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultEditorTemplatesTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -1164,4 +1165,5 @@ Environment.NewLine; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs index 9ecf48d116..3b804faaba 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections.Generic; using System.IO; @@ -10,7 +11,6 @@ using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.Routing; using Microsoft.AspNet.Mvc.ViewEngines; using Microsoft.AspNet.Routing; using Microsoft.Extensions.OptionsModel; @@ -712,4 +712,5 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures public List Collection { get; } = new List(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/PartialViewResultExecutorTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/PartialViewResultExecutorTest.cs index 8279f5b6b7..81bc6aaf7a 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/PartialViewResultExecutorTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/PartialViewResultExecutorTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.Diagnostics.Tracing; using System.Threading.Tasks; using Microsoft.AspNet.Http.Internal; @@ -225,3 +226,4 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures } } } +#endif diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SaveTempDataFilterTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SaveTempDataFilterTest.cs index 47619fbc45..94f98f0f03 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SaveTempDataFilterTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SaveTempDataFilterTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; using Microsoft.AspNet.Mvc.Filters; @@ -78,3 +79,4 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures } } } +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SessionStateTempDataProviderTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SessionStateTempDataProviderTest.cs index 3f2010a252..e59c2c3244 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SessionStateTempDataProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/SessionStateTempDataProviderTest.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Internal; -using Moq; using Xunit; namespace Microsoft.AspNet.Mvc.ViewFeatures diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/TempDataDictionaryTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/TempDataDictionaryTest.cs index cbcbb1bfcc..062a06112d 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/TempDataDictionaryTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/TempDataDictionaryTest.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Internal; -using Moq; using Xunit; namespace Microsoft.AspNet.Mvc.ViewFeatures diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewDataDictionaryTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewDataDictionaryTest.cs index fcf35b4315..41cf274ee8 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewDataDictionaryTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewDataDictionaryTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Collections; using System.Collections.Generic; @@ -817,4 +818,5 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures public string Model { get; set; } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs index 14a802b69d..20476efbd3 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewExecutorTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Diagnostics.Tracing; using System.IO; @@ -291,4 +292,5 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures listener); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewResultExecutorTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewResultExecutorTest.cs index f87aca3b69..f07aa3676e 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewResultExecutorTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewFeatures/ViewResultExecutorTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System.Diagnostics.Tracing; using System.Threading.Tasks; using Microsoft.AspNet.Http.Internal; @@ -225,3 +226,4 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures } } } +#endif diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewResultTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewResultTest.cs index 55508ce994..fb0a3ccb09 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/ViewResultTest.cs @@ -1,6 +1,7 @@ // 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. +#if MOCK_SUPPORT using System; using System.Diagnostics.Tracing; using System.Threading.Tasks; @@ -119,4 +120,5 @@ namespace Microsoft.AspNet.Mvc return httpContext; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/project.json b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/project.json index c83290cfe3..c446932dbd 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/project.json +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/project.json @@ -19,7 +19,6 @@ "Microsoft.Extensions.Logging.Testing": "1.0.0-*", "Microsoft.Extensions.TelemetryAdapter": "1.0.0-*", "Microsoft.Extensions.WebEncoders.Testing": "1.0.0-*", - "Moq": "4.2.1312.1622", "xunit.runner.aspnet": "2.0.0-aspnet-*" }, "commands": { @@ -27,7 +26,11 @@ }, "frameworks": { "dnx451": { - "compilationOptions": { "define": [ "MOCK_SUPPORT" ] } - } + "compilationOptions": { "define": [ "MOCK_SUPPORT" ] }, + "dependencies": { + "Moq": "4.2.1312.1622" + } + }, + "dnxcore50": { } } }