-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding /InIsolation flag for backward compatibility #414
Merged
mayankbansal018
merged 2 commits into
microsoft:master
from
mayankbansal018:#389-InIsolation
Feb 1, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
src/vstest.console/Processors/InIsolationArgumentProcessor.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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors | ||
{ | ||
using System; | ||
using System.Globalization; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities; | ||
using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; | ||
|
||
/// <summary> | ||
/// An argument processor that allows the user to specify whether the execution | ||
/// should happen in the current vstest.console.exe process or a new different process. | ||
/// </summary> | ||
internal class InIsolationArgumentProcessor : IArgumentProcessor | ||
{ | ||
#region Constants | ||
|
||
public const string CommandName = "/InIsolation"; | ||
|
||
#endregion | ||
|
||
private Lazy<IArgumentProcessorCapabilities> metadata; | ||
|
||
private Lazy<IArgumentExecutor> executor; | ||
|
||
/// <summary> | ||
/// Gets the metadata. | ||
/// </summary> | ||
public Lazy<IArgumentProcessorCapabilities> Metadata | ||
{ | ||
get | ||
{ | ||
if (this.metadata == null) | ||
{ | ||
this.metadata = new Lazy<IArgumentProcessorCapabilities>(() => new InIsolationArgumentProcessorCapabilities()); | ||
} | ||
|
||
return this.metadata; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the executor. | ||
/// </summary> | ||
public Lazy<IArgumentExecutor> Executor | ||
{ | ||
get | ||
{ | ||
if (this.executor == null) | ||
{ | ||
this.executor = | ||
new Lazy<IArgumentExecutor>( | ||
() => | ||
new InIsolationArgumentExecutor()); | ||
} | ||
|
||
return this.executor; | ||
} | ||
|
||
set | ||
{ | ||
this.executor = value; | ||
} | ||
} | ||
} | ||
|
||
internal class InIsolationArgumentProcessorCapabilities : BaseArgumentProcessorCapabilities | ||
{ | ||
public override string CommandName => InIsolationArgumentProcessor.CommandName; | ||
|
||
public override bool AllowMultiple => false; | ||
|
||
public override bool IsAction => false; | ||
|
||
public override ArgumentProcessorPriority Priority => ArgumentProcessorPriority.Normal; | ||
|
||
public override HelpContentPriority HelpPriority => HelpContentPriority.InIsolationArgumentProcessorHelpPriority; | ||
} | ||
|
||
internal class InIsolationArgumentExecutor : IArgumentExecutor | ||
{ | ||
#region Constructors | ||
public InIsolationArgumentExecutor() | ||
{ | ||
} | ||
#endregion | ||
|
||
#region IArgumentProcessor | ||
|
||
/// <summary> | ||
/// Initializes with the argument that was provided with the command. | ||
/// </summary> | ||
/// <param name="argument">Argument that was provided with the command.</param> | ||
public void Initialize(string argument) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(argument)) | ||
{ | ||
throw new CommandLineException( | ||
string.Format(CultureInfo.CurrentCulture, CommandLineResources.InvalidInIsolationCommand, argument)); | ||
} | ||
|
||
ConsoleOutput.Instance.WriteLine(CommandLineResources.InIsolationDeprecated, OutputLevel.Information); | ||
} | ||
|
||
/// <summary> | ||
/// Execute. | ||
/// </summary> | ||
public ArgumentProcessorResult Execute() | ||
{ | ||
// Nothing to do since we updated the parameter during initialize parameter | ||
return ArgumentProcessorResult.Success; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
test/vstest.console.UnitTests/Processors/InIsolationArgumentProcessorTests.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors | ||
{ | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
||
using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using Moq; | ||
|
||
using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; | ||
|
||
[TestClass] | ||
public class InIsolationArgumentProcessorTests | ||
{ | ||
private readonly InIsolationArgumentProcessor isolationProcessor; | ||
|
||
public InIsolationArgumentProcessorTests() | ||
{ | ||
this.isolationProcessor = new InIsolationArgumentProcessor(); | ||
} | ||
|
||
[TestMethod] | ||
public void InIsolationArgumentProcessorMetadataShouldProvideAppropriateCapabilities() | ||
{ | ||
Assert.IsFalse(this.isolationProcessor.Metadata.Value.AllowMultiple); | ||
Assert.IsFalse(this.isolationProcessor.Metadata.Value.AlwaysExecute); | ||
Assert.IsFalse(this.isolationProcessor.Metadata.Value.IsAction); | ||
Assert.IsFalse(this.isolationProcessor.Metadata.Value.IsSpecialCommand); | ||
Assert.AreEqual(InIsolationArgumentProcessor.CommandName, this.isolationProcessor.Metadata.Value.CommandName); | ||
Assert.AreEqual(null, this.isolationProcessor.Metadata.Value.ShortCommandName); | ||
Assert.AreEqual(ArgumentProcessorPriority.Normal, this.isolationProcessor.Metadata.Value.Priority); | ||
Assert.AreEqual(HelpContentPriority.InIsolationArgumentProcessorHelpPriority, this.isolationProcessor.Metadata.Value.HelpPriority); | ||
} | ||
|
||
|
||
[TestMethod] | ||
public void InIsolationArgumentProcessorExecutorShouldThrowIfArgumentIsProvided() | ||
{ | ||
Assert.ThrowsException<CommandLineException>(() => this.isolationProcessor.Executor.Value.Initialize("foo")); | ||
} | ||
|
||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvlakshm can you please review the string? We'll show this message to user if she calls
vstest.console /inisolation
.