From 232d6f066cc5cfcbf912239b3f5b81994f249afe Mon Sep 17 00:00:00 2001 From: Ravi Chande Date: Thu, 6 Apr 2017 13:02:38 -0700 Subject: [PATCH] VSI test for Edit.RemoveAndSort (#18503) --- .../CSharp/CSharpOrganizing.cs | 52 +++++++++++++++++++ .../VisualBasic/BasicOrganizing.cs | 43 +++++++++++++++ .../VisualStudioIntegrationTests.csproj | 2 + 3 files changed, 97 insertions(+) create mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpOrganizing.cs create mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicOrganizing.cs diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpOrganizing.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpOrganizing.cs new file mode 100644 index 0000000000000..97ed5800ab5c0 --- /dev/null +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpOrganizing.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis; +using Microsoft.VisualStudio.IntegrationTest.Utilities; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Roslyn.VisualStudio.IntegrationTests.CSharp +{ + [Collection(nameof(SharedIntegrationHostFixture))] + public class CSharpOrganizing : AbstractEditorTest + { + protected override string LanguageName => LanguageNames.CSharp; + + public CSharpOrganizing(VisualStudioInstanceFactory instanceFactory) + : base(instanceFactory, nameof(CSharpOrganizing)) + { + } + + [Fact, Trait(Traits.Feature, Traits.Features.Organizing)] + public void RemoveAndSort() + { + SetUpEditor(@"$$ +using C; +using B; +using A; + +class Test +{ + CA a = null; + CC c = null; +} +namespace A { public class CA { } } +namespace B { public class CB { } } +namespace C { public class CC { } }"); + VisualStudio.ExecuteCommand("Edit.RemoveAndSort"); + VisualStudio.Editor.Verify.TextContains(@" +using A; +using C; + +class Test +{ + CA a = null; + CC c = null; +} +namespace A { public class CA { } } +namespace B { public class CB { } } +namespace C { public class CC { } }"); + + } + } +} \ No newline at end of file diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicOrganizing.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicOrganizing.cs new file mode 100644 index 0000000000000..f05c951c9aab6 --- /dev/null +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicOrganizing.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis; +using Microsoft.VisualStudio.IntegrationTest.Utilities; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Roslyn.VisualStudio.IntegrationTests.Basic +{ + [Collection(nameof(SharedIntegrationHostFixture))] + public class BasicOrganizing : AbstractEditorTest + { + protected override string LanguageName => LanguageNames.VisualBasic; + + public BasicOrganizing(VisualStudioInstanceFactory instanceFactory) + : base(instanceFactory, nameof(BasicOrganizing)) + { + } + + [Fact, Trait(Traits.Feature, Traits.Features.Organizing)] + public void RemoveAndSort() + { + SetUpEditor(@"Imports System.Linq$$ +Imports System +Imports System.Runtime.InteropServices +Imports System.Runtime.CompilerServices +Class Test + Sub Method( Optional str As String = Nothing) + Dim data As COMException + End Sub +End Class"); + VisualStudio.ExecuteCommand("Edit.RemoveAndSort"); + VisualStudio.Editor.Verify.TextContains(@"Imports System.Runtime.CompilerServices +Imports System.Runtime.InteropServices +Class Test + Sub Method( Optional str As String = Nothing) + Dim data As COMException + End Sub +End Class"); + + } + } +} \ No newline at end of file diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj index 203fec5040096..2126e380629c6 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj @@ -40,6 +40,7 @@ + @@ -67,6 +68,7 @@ +