From 682d630fa2069f20214c90d7e86cded464cbdab1 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 12 May 2017 15:41:44 -0700 Subject: [PATCH] Upgrade test framework versions and fix issues with tests --- build/dependencies.props | 4 ++-- ...oft.AspNetCore.Mvc.Razor.Extensions.Test.csproj | 6 ++---- .../ViewComponentTagHelperPassTest.cs | 6 +++--- .../DefaultDirectiveIRPassTest.cs | 4 ++-- .../Legacy/CodeWriterTest.cs | 6 +++--- .../Legacy/HtmlTagsTest.cs | 8 ++++---- ...Microsoft.AspNetCore.Razor.Language.Test.csproj | 11 ++++++++--- .../Microsoft.AspNetCore.Razor.Runtime.Test.csproj | 11 ++++++++--- .../TagHelpers/TagHelperExecutionContextTest.cs | 8 ++++---- .../Microsoft.AspNetCore.Razor.Test.Common.csproj | 6 ++++-- .../Microsoft.CodeAnalysis.Razor.Test.csproj | 4 ---- ...VisualStudio.LanguageServices.Razor.Test.csproj | 12 +++++++++--- .../RazorPageGenerator.Test.csproj | 14 +++++++++----- 13 files changed, 58 insertions(+), 42 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index b1982a085c..19ec12f9bc 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -11,7 +11,7 @@ 2.0.0 2.3.0-beta1-61624-03 1.0.2-rc - 15.0.0 - 2.2.0 + 15.3.0-* + 2.3.0-beta2-* diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj index a8e7d6ab48..9251bd7fee 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj @@ -21,7 +21,9 @@ + + @@ -30,8 +32,4 @@ - - - - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs index 9a31502648..78d7a29d6a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs @@ -122,7 +122,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore. ", tokenNode.Content, ignoreLineEndingDifferences: true); - Assert.Equal(tokenNode.Kind, RazorIRToken.TokenKind.CSharp); + Assert.Equal(RazorIRToken.TokenKind.CSharp, tokenNode.Kind); } [Fact] @@ -195,7 +195,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore. ", tokenNode.Content, ignoreLineEndingDifferences: true); - Assert.Equal(tokenNode.Kind, RazorIRToken.TokenKind.CSharp); + Assert.Equal(RazorIRToken.TokenKind.CSharp, tokenNode.Kind); } [Fact] @@ -280,7 +280,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore. ", tokenNode.Content, ignoreLineEndingDifferences: true); - Assert.Equal(tokenNode.Kind, RazorIRToken.TokenKind.CSharp); + Assert.Equal(RazorIRToken.TokenKind.CSharp, tokenNode.Kind); } private RazorCodeDocument CreateDocument(string content) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultDirectiveIRPassTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultDirectiveIRPassTest.cs index 1f12986ffd..375b7b94f9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultDirectiveIRPassTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/DefaultDirectiveIRPassTest.cs @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Razor.Language node => Assert.IsType(node), node => Assert.IsType(node)); var @class = (ClassDeclarationIRNode)@namespace.Children[2]; - Assert.Equal(@class.BaseType, "Hello"); + Assert.Equal("Hello", @class.BaseType); } [Fact] @@ -168,4 +168,4 @@ namespace Microsoft.AspNetCore.Razor.Language return irDocument; } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeWriterTest.cs index a04820bc42..8bc5188a4d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeWriterTest.cs @@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } [Theory] - [MemberData("NewLines")] + [MemberData(nameof(NewLines))] public void CodeWriter_TracksPosition_WithWriteLine_WithNewLineInContent(string newLine) { // Arrange @@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } [Theory] - [MemberData("NewLines")] + [MemberData(nameof(NewLines))] public void CodeWriter_TracksPosition_WithWrite_WithNewlineInContent(string newLine) { // Arrange @@ -262,4 +262,4 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Assert.Equal(expected2, location2); } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs index d9b5e42669..9629cdc9f7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs @@ -167,7 +167,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } [Theory] - [MemberData("VoidElementNames")] + [MemberData(nameof(VoidElementNames))] public void VoidElementFollowedByContent(string tagName) { ParseBlockTest("<" + tagName + ">foo", @@ -176,7 +176,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } [Theory] - [MemberData("VoidElementNames")] + [MemberData(nameof(VoidElementNames))] public void VoidElementFollowedByOtherTag(string tagName) { ParseBlockTest("<" + tagName + ">foo", @@ -185,7 +185,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } [Theory] - [MemberData("VoidElementNames")] + [MemberData(nameof(VoidElementNames))] public void VoidElementFollowedByCloseTag(string tagName) { ParseBlockTest("<" + tagName + "> foo", @@ -196,7 +196,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } [Theory] - [MemberData("VoidElementNames")] + [MemberData(nameof(VoidElementNames))] public void IncompleteVoidElementEndTag(string tagName) { ParseBlockTest("<" + tagName + "> + + netcoreapp2.0;net46 netcoreapp2.0 $(DefaultItemExcludes);TestFiles\**\* + + + + + @@ -18,7 +25,5 @@ - - - + diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Microsoft.AspNetCore.Razor.Runtime.Test.csproj b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Microsoft.AspNetCore.Razor.Runtime.Test.csproj index ad2d83a3dc..de12a11fd3 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Microsoft.AspNetCore.Razor.Runtime.Test.csproj +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Microsoft.AspNetCore.Razor.Runtime.Test.csproj @@ -1,15 +1,22 @@  + + netcoreapp2.0;net46 netcoreapp2.0 $(DefaultItemExcludes);TestFiles\**\* + + + + + @@ -17,7 +24,5 @@ - - - + diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs index e96be1ddb6..a071832ba2 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs @@ -94,8 +94,8 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers await output.GetChildContentAsync(); // Assert - 2 - Assert.Equal(callCount, 0); - Assert.Equal(updatedCallCount, 1); + Assert.Equal(0, callCount); + Assert.Equal(1, updatedCallCount); } [Fact] @@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers var context = executionContext.Context; var attribute = Assert.Single(context.AllAttributes); Assert.Equal(tagName, context.TagName); - Assert.Equal(attribute.Name, "Another attribute"); + Assert.Equal("Another attribute", attribute.Name); Assert.Equal(updatedUniqueId, context.UniqueId); Assert.Same(updatedItems, context.Items); } @@ -543,4 +543,4 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers { } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj b/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj index fdbb117ea5..7beacd4065 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj @@ -11,8 +11,10 @@ - + + + - \ No newline at end of file + diff --git a/test/Microsoft.CodeAnalysis.Razor.Test/Microsoft.CodeAnalysis.Razor.Test.csproj b/test/Microsoft.CodeAnalysis.Razor.Test/Microsoft.CodeAnalysis.Razor.Test.csproj index 0081d0e039..9568a57f7f 100644 --- a/test/Microsoft.CodeAnalysis.Razor.Test/Microsoft.CodeAnalysis.Razor.Test.csproj +++ b/test/Microsoft.CodeAnalysis.Razor.Test/Microsoft.CodeAnalysis.Razor.Test.csproj @@ -35,8 +35,4 @@ - - - - diff --git a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj index 8ac755713c..4868fb2da1 100644 --- a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj +++ b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj @@ -1,5 +1,7 @@  + + net46 $(DefaultItemExcludes);TestFiles\**\* @@ -12,13 +14,16 @@ true true + $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; + + @@ -26,6 +31,9 @@ + + + @@ -34,7 +42,5 @@ - - - + diff --git a/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj b/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj index 16a3e3071e..556273908c 100644 --- a/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj +++ b/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj @@ -1,5 +1,7 @@  + + netcoreapp2.0 @@ -11,17 +13,19 @@ - - + + + + + - - - + +