-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give Insert and Remove EndOfFile integration tests unique names since…
… the test files are copied to the same folder. Also add a try/catch block around an outlining synchronization section that was failing in the integration test context.
- Loading branch information
1 parent
64c976c
commit d4629c3
Showing
8 changed files
with
131 additions
and
123 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...g/Insert/Data/EndOfFileTrailingNewLine.cs → ...rt/Data/InsertEndOfFileTrailingNewLine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Insert.Data | ||
{ | ||
public class EndOfFileTrailingNewLine | ||
public class InsertEndOfFileTrailingNewLine | ||
{ | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../Data/EndOfFileTrailingNewLine_Cleaned.cs → ...InsertEndOfFileTrailingNewLine_Cleaned.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Insert.Data | ||
{ | ||
public class EndOfFileTrailingNewLine | ||
public class InsertEndOfFileTrailingNewLine | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...g/Remove/Data/EndOfFileTrailingNewLine.cs → ...ve/Data/RemoveEndOfFileTrailingNewLine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Remove.Data | ||
{ | ||
public class EndOfFileTrailingNewLine | ||
{ | ||
} | ||
} | ||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Remove.Data | ||
{ | ||
public class RemoveEndOfFileTrailingNewLine | ||
{ | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
.../Data/EndOfFileTrailingNewLine_Cleaned.cs → ...RemoveEndOfFileTrailingNewLine_Cleaned.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Remove.Data | ||
{ | ||
public class EndOfFileTrailingNewLine | ||
{ | ||
} | ||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Remove.Data | ||
{ | ||
public class RemoveEndOfFileTrailingNewLine | ||
{ | ||
} | ||
} |
186 changes: 93 additions & 93 deletions
186
...g/Remove/EndOfFileTrailingNewLineTests.cs → ...ve/RemoveEndOfFileTrailingNewLineTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,94 @@ | ||
#region CodeMaid is Copyright 2007-2014 Steve Cadwallader. | ||
|
||
// CodeMaid is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
// Lesser General Public License version 3 as published by the Free Software Foundation. | ||
// | ||
// CodeMaid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | ||
// even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details <http://www.gnu.org/licenses/>. | ||
|
||
#endregion CodeMaid is Copyright 2007-2014 Steve Cadwallader. | ||
|
||
using EnvDTE; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using SteveCadwallader.CodeMaid.IntegrationTests.Helpers; | ||
using SteveCadwallader.CodeMaid.Logic.Cleaning; | ||
using SteveCadwallader.CodeMaid.Properties; | ||
|
||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Remove | ||
{ | ||
[TestClass] | ||
[DeploymentItem(@"Cleaning\Remove\Data\EndOfFileTrailingNewLine.cs", "Data")] | ||
[DeploymentItem(@"Cleaning\Remove\Data\EndOfFileTrailingNewLine_Cleaned.cs", "Data")] | ||
public class EndOfFileTrailingNewLineTests | ||
{ | ||
#region Setup | ||
|
||
private static RemoveWhitespaceLogic _removeWhitespaceLogic; | ||
private ProjectItem _projectItem; | ||
|
||
[ClassInitialize] | ||
public static void ClassInitialize(TestContext testContext) | ||
{ | ||
_removeWhitespaceLogic = RemoveWhitespaceLogic.GetInstance(TestEnvironment.Package); | ||
Assert.IsNotNull(_removeWhitespaceLogic); | ||
} | ||
|
||
[TestInitialize] | ||
public void TestInitialize() | ||
{ | ||
TestEnvironment.CommonTestInitialize(); | ||
_projectItem = TestEnvironment.LoadFileIntoProject(@"Data\EndOfFileTrailingNewLine.cs"); | ||
} | ||
|
||
[TestCleanup] | ||
public void TestCleanup() | ||
{ | ||
TestEnvironment.RemoveFromProject(_projectItem); | ||
} | ||
|
||
#endregion Setup | ||
|
||
#region Tests | ||
|
||
[TestMethod] | ||
[HostType("VS IDE")] | ||
public void CleaningRemoveEndOfFileTrailingNewLine_CleansAsExpected() | ||
{ | ||
Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine = true; | ||
|
||
TestOperations.ExecuteCommandAndVerifyResults(RunRemoveEndOfFileTrailingNewLine, _projectItem, @"Data\EndOfFileTrailingNewLine_Cleaned.cs"); | ||
} | ||
|
||
[TestMethod] | ||
[HostType("VS IDE")] | ||
public void CleaningRemoveEndOfFileTrailingNewLine_DoesNothingOnSecondPass() | ||
{ | ||
Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine = true; | ||
|
||
TestOperations.ExecuteCommandTwiceAndVerifyNoChangesOnSecondPass(RunRemoveEndOfFileTrailingNewLine, _projectItem); | ||
} | ||
|
||
[TestMethod] | ||
[HostType("VS IDE")] | ||
public void CleaningRemoveEndOfFileTrailingNewLine_DoesNothingWhenSettingIsDisabled() | ||
{ | ||
Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine = false; | ||
|
||
TestOperations.ExecuteCommandAndVerifyNoChanges(RunRemoveEndOfFileTrailingNewLine, _projectItem); | ||
} | ||
|
||
#endregion Tests | ||
|
||
#region Helpers | ||
|
||
private static void RunRemoveEndOfFileTrailingNewLine(Document document) | ||
{ | ||
var textDocument = TestUtils.GetTextDocument(document); | ||
|
||
_removeWhitespaceLogic.RemoveEOFTrailingNewLine(textDocument); | ||
} | ||
|
||
#endregion Helpers | ||
} | ||
#region CodeMaid is Copyright 2007-2014 Steve Cadwallader. | ||
|
||
// CodeMaid is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
// Lesser General Public License version 3 as published by the Free Software Foundation. | ||
// | ||
// CodeMaid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | ||
// even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details <http://www.gnu.org/licenses/>. | ||
|
||
#endregion CodeMaid is Copyright 2007-2014 Steve Cadwallader. | ||
|
||
using EnvDTE; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using SteveCadwallader.CodeMaid.IntegrationTests.Helpers; | ||
using SteveCadwallader.CodeMaid.Logic.Cleaning; | ||
using SteveCadwallader.CodeMaid.Properties; | ||
|
||
namespace SteveCadwallader.CodeMaid.IntegrationTests.Cleaning.Remove | ||
{ | ||
[TestClass] | ||
[DeploymentItem(@"Cleaning\Remove\Data\RemoveEndOfFileTrailingNewLine.cs", "Data")] | ||
[DeploymentItem(@"Cleaning\Remove\Data\RemoveEndOfFileTrailingNewLine_Cleaned.cs", "Data")] | ||
public class RemoveEndOfFileTrailingNewLineTests | ||
{ | ||
#region Setup | ||
|
||
private static RemoveWhitespaceLogic _removeWhitespaceLogic; | ||
private ProjectItem _projectItem; | ||
|
||
[ClassInitialize] | ||
public static void ClassInitialize(TestContext testContext) | ||
{ | ||
_removeWhitespaceLogic = RemoveWhitespaceLogic.GetInstance(TestEnvironment.Package); | ||
Assert.IsNotNull(_removeWhitespaceLogic); | ||
} | ||
|
||
[TestInitialize] | ||
public void TestInitialize() | ||
{ | ||
TestEnvironment.CommonTestInitialize(); | ||
_projectItem = TestEnvironment.LoadFileIntoProject(@"Data\RemoveEndOfFileTrailingNewLine.cs"); | ||
} | ||
|
||
[TestCleanup] | ||
public void TestCleanup() | ||
{ | ||
TestEnvironment.RemoveFromProject(_projectItem); | ||
} | ||
|
||
#endregion Setup | ||
|
||
#region Tests | ||
|
||
[TestMethod] | ||
[HostType("VS IDE")] | ||
public void CleaningRemoveEndOfFileTrailingNewLine_CleansAsExpected() | ||
{ | ||
Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine = true; | ||
|
||
TestOperations.ExecuteCommandAndVerifyResults(RunRemoveEndOfFileTrailingNewLine, _projectItem, @"Data\RemoveEndOfFileTrailingNewLine_Cleaned.cs"); | ||
} | ||
|
||
[TestMethod] | ||
[HostType("VS IDE")] | ||
public void CleaningRemoveEndOfFileTrailingNewLine_DoesNothingOnSecondPass() | ||
{ | ||
Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine = true; | ||
|
||
TestOperations.ExecuteCommandTwiceAndVerifyNoChangesOnSecondPass(RunRemoveEndOfFileTrailingNewLine, _projectItem); | ||
} | ||
|
||
[TestMethod] | ||
[HostType("VS IDE")] | ||
public void CleaningRemoveEndOfFileTrailingNewLine_DoesNothingWhenSettingIsDisabled() | ||
{ | ||
Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine = false; | ||
|
||
TestOperations.ExecuteCommandAndVerifyNoChanges(RunRemoveEndOfFileTrailingNewLine, _projectItem); | ||
} | ||
|
||
#endregion Tests | ||
|
||
#region Helpers | ||
|
||
private static void RunRemoveEndOfFileTrailingNewLine(Document document) | ||
{ | ||
var textDocument = TestUtils.GetTextDocument(document); | ||
|
||
_removeWhitespaceLogic.RemoveEOFTrailingNewLine(textDocument); | ||
} | ||
|
||
#endregion Helpers | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters