From 0c3fff31374d8cfbcaa53cdbd0cf5aa492e8762c Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 23 Aug 2017 12:56:31 -0700 Subject: [PATCH] Upgrade to xunit 2.3.0-beta4 (#1640) Includes a few changes required by xunit.analyzers, such as removing unused theory parameters. --- build/dependencies.props | 11 +- .../Legacy/HtmlTagsTest.cs | 2 +- .../SourceChangeTest.cs | 9 +- ...rosoft.AspNetCore.Razor.Test.Common.csproj | 1 + .../RazorSyntaxTreePartialParserTest.cs | 152 ++---------------- .../Legacy/RazorEditorParserTest.cs | 152 ++---------------- ...lStudio.LanguageServices.Razor.Test.csproj | 2 + 7 files changed, 30 insertions(+), 299 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index aabdda911a..91e0035544 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -11,20 +11,21 @@ 2.0.0-* 2.0.0-* 2.0.0-* - + 2.3.1 2.3.0-beta4-* - + 1.1.92 - 15.3.0-* + 15.3.0 15.0.26606 - - 2.3.0-beta2-* + + 0.6.1 + 2.3.0-beta4-build3742 diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs index de689a4eb2..c1b3b1a688 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTagsTest.cs @@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { public class HtmlTagsTest : CsHtmlMarkupParserTestBase { - public static IEnumerable VoidElementNames + public static IEnumerable VoidElementNames { get { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs index 5b4c1a14bd..f3f1b9320e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs @@ -137,13 +137,8 @@ namespace Microsoft.AspNetCore.Razor.Language Assert.Equal(2, result); } - [Theory] - [InlineData(12, 2)] - [InlineData(12, 14)] - [InlineData(13, 13)] - [InlineData(20, 1)] - [InlineData(21, 0)] - public void GetOffSet_SpanIsNotOwnerOfChange_ThrowsException(int absoluteIndex, int length) + [Fact] + public void GetOffSet_SpanIsNotOwnerOfChange_ThrowsException() { // Arrange var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); 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 9a218a059d..51aa42ec8d 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 @@ -13,6 +13,7 @@ + diff --git a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Editor/RazorSyntaxTreePartialParserTest.cs b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Editor/RazorSyntaxTreePartialParserTest.cs index aa11e1dbf2..a3f98ea6ac 100644 --- a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Editor/RazorSyntaxTreePartialParserTest.cs +++ b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Editor/RazorSyntaxTreePartialParserTest.cs @@ -17,69 +17,20 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor { get { - // change, (Block)expectedDocument - return new TheoryData + return new TheoryData { - { - CreateInsertionChange("

", 2, " "), - new MarkupBlock( - new MarkupTagHelperBlock("p")) - }, - { - CreateInsertionChange("

", 6, " "), - new MarkupBlock( - new MarkupTagHelperBlock("p")) - }, - { - CreateInsertionChange("

", 12, " "), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "some-attr", - value: null, - attributeStructure: AttributeStructure.Minimized) - })) - }, - { - CreateInsertionChange("

", 12, "ibute"), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "some-attribute", - value: null, - attributeStructure: AttributeStructure.Minimized) - })) - }, - { - CreateInsertionChange("

", 2, " before"), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "before", - value: null, - attributeStructure: AttributeStructure.Minimized), - new TagHelperAttributeNode( - "some-attr", - value: null, - attributeStructure: AttributeStructure.Minimized) - })) - }, + CreateInsertionChange("

", 2, " "), + CreateInsertionChange("

", 6, " "), + CreateInsertionChange("

", 12, " "), + CreateInsertionChange("

", 12, "ibute"), + CreateInsertionChange("

", 2, " before"), }; } } [Theory] [MemberData(nameof(TagHelperPartialParseRejectData))] - public void TagHelperTagBodiesRejectPartialChanges(object objectEdit, object expectedDocument) + public void TagHelperTagBodiesRejectPartialChanges(object objectEdit) { // Arrange var edit = (TestEdit)objectEdit; @@ -112,108 +63,26 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor var factory = new SpanFactory(); // change, (Block)expectedDocument, partialParseResult - return new TheoryData + return new TheoryData { { CreateInsertionChange("

", 22, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "str-attr", - new MarkupBlock( - new MarkupBlock( - new ExpressionBlock( - factory.CodeTransition(), - factory - .Code("DateTime.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)))), - AttributeStructure.SingleQuotes) - })), PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional }, { CreateInsertionChange("

", 21, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "obj-attr", - factory.CodeMarkup("DateTime."), - AttributeStructure.SingleQuotes) - })), PartialParseResultInternal.Accepted }, { CreateInsertionChange("

", 25, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "obj-attr", - factory.CodeMarkup("1 + DateTime."), - AttributeStructure.SingleQuotes) - })), PartialParseResultInternal.Accepted }, { CreateInsertionChange("

", 34, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "before-attr", - value: null, - attributeStructure: AttributeStructure.Minimized), - new TagHelperAttributeNode( - "str-attr", - new MarkupBlock( - new MarkupBlock( - new ExpressionBlock( - factory.CodeTransition(), - factory - .Code("DateTime.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)))), - AttributeStructure.SingleQuotes), - new TagHelperAttributeNode( - "after-attr", - value: null, - attributeStructure: AttributeStructure.Minimized), - })), PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional }, { CreateInsertionChange("

", 29, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "str-attr", - new MarkupBlock( - factory.Markup("before"), - new MarkupBlock( - factory.Markup(" "), - new ExpressionBlock( - factory.CodeTransition(), - factory - .Code("DateTime.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace))), - factory.Markup(" after")), - AttributeStructure.SingleQuotes) - })), PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional }, }; @@ -222,10 +91,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor [Theory] [MemberData(nameof(TagHelperAttributeAcceptData))] - public void TagHelperAttributesAreLocatedAndAcceptChangesCorrectly( - object editObject, - object expectedDocument, - object partialParseResultObject) + public void TagHelperAttributesAreLocatedAndAcceptChangesCorrectly(object editObject, object partialParseResultObject) { // Arrange var edit = (TestEdit)editObject; diff --git a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Legacy/RazorEditorParserTest.cs b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Legacy/RazorEditorParserTest.cs index d78d8b6807..0f6e3e32e9 100644 --- a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Legacy/RazorEditorParserTest.cs +++ b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Legacy/RazorEditorParserTest.cs @@ -23,69 +23,20 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor { get { - // change, (Block)expectedDocument - return new TheoryData + return new TheoryData { - { - CreateInsertionChange("

", 2, " "), - new MarkupBlock( - new MarkupTagHelperBlock("p")) - }, - { - CreateInsertionChange("

", 6, " "), - new MarkupBlock( - new MarkupTagHelperBlock("p")) - }, - { - CreateInsertionChange("

", 12, " "), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "some-attr", - value: null, - attributeStructure: AttributeStructure.Minimized) - })) - }, - { - CreateInsertionChange("

", 12, "ibute"), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "some-attribute", - value: null, - attributeStructure: AttributeStructure.Minimized) - })) - }, - { - CreateInsertionChange("

", 2, " before"), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "before", - value: null, - attributeStructure: AttributeStructure.Minimized), - new TagHelperAttributeNode( - "some-attr", - value: null, - attributeStructure: AttributeStructure.Minimized) - })) - }, + CreateInsertionChange("

", 2, " "), + CreateInsertionChange("

", 6, " "), + CreateInsertionChange("

", 12, " "), + CreateInsertionChange("

", 12, "ibute"), + CreateInsertionChange("

", 2, " before"), }; } } [Theory] [MemberData(nameof(TagHelperPartialParseRejectData))] - public void TagHelperTagBodiesRejectPartialChanges(object editObject, object expectedDocument) + public void TagHelperTagBodiesRejectPartialChanges(object editObject) { // Arrange var edit = (TestEdit)editObject; @@ -119,108 +70,26 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor var factory = new SpanFactory(); // change, (Block)expectedDocument, partialParseResult - return new TheoryData + return new TheoryData { { CreateInsertionChange("

", 22, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "str-attr", - new MarkupBlock( - new MarkupBlock( - new ExpressionBlock( - factory.CodeTransition(), - factory - .Code("DateTime.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)))), - AttributeStructure.SingleQuotes) - })), PartialParseResult.Accepted | PartialParseResult.Provisional }, { CreateInsertionChange("

", 21, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "obj-attr", - factory.CodeMarkup("DateTime."), - AttributeStructure.SingleQuotes) - })), PartialParseResult.Accepted }, { CreateInsertionChange("

", 25, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "obj-attr", - factory.CodeMarkup("1 + DateTime."), - AttributeStructure.SingleQuotes) - })), PartialParseResult.Accepted }, { CreateInsertionChange("

", 34, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "before-attr", - value: null, - attributeStructure: AttributeStructure.Minimized), - new TagHelperAttributeNode( - "str-attr", - new MarkupBlock( - new MarkupBlock( - new ExpressionBlock( - factory.CodeTransition(), - factory - .Code("DateTime.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)))), - AttributeStructure.SingleQuotes), - new TagHelperAttributeNode( - "after-attr", - value: null, - attributeStructure: AttributeStructure.Minimized), - })), PartialParseResult.Accepted | PartialParseResult.Provisional }, { CreateInsertionChange("

", 29, "."), - new MarkupBlock( - new MarkupTagHelperBlock( - "p", - attributes: new List - { - new TagHelperAttributeNode( - "str-attr", - new MarkupBlock( - factory.Markup("before"), - new MarkupBlock( - factory.Markup(" "), - new ExpressionBlock( - factory.CodeTransition(), - factory - .Code("DateTime.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace))), - factory.Markup(" after")), - AttributeStructure.SingleQuotes) - })), PartialParseResult.Accepted | PartialParseResult.Provisional }, }; @@ -229,10 +98,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor [Theory] [MemberData(nameof(TagHelperAttributeAcceptData))] - public void TagHelperAttributesAreLocatedAndAcceptChangesCorrectly( - object editObject, - object expectedDocument, - PartialParseResult partialParseResult) + public void TagHelperAttributesAreLocatedAndAcceptChangesCorrectly(object editObject, PartialParseResult partialParseResult) { // Arrange var edit = (TestEdit)editObject; 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 8cb0d62822..b980d10aed 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 @@ -22,7 +22,9 @@ + +