-
Notifications
You must be signed in to change notification settings - Fork 264
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
Fixing issues with deployment item from VS IDE #95
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
ae12ea9
Fixing issues with deployment item from VS IDE. Moved the deployment …
AbhitejJohn 30d8f53
Adding this to the core platform service as well to prevent any build…
AbhitejJohn 5311ae2
Removing the obsolete tag to prevent any false flags from Resharper o…
AbhitejJohn 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
56 changes: 56 additions & 0 deletions
56
src/TestFramework/Extension.Core/Attributes/DeploymentItemAttribute.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,56 @@ | ||
// 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.TestTools.UnitTesting | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// Used to specify deployment item (file or directory) for per-test deployment. | ||
/// Can be specified on test class or test method. | ||
/// Can have multiple instances of the attribute to specify more than one item. | ||
/// The item path can be absolute or relative, if relative, it is relative to RunConfig.RelativePathRoot. | ||
/// </summary> | ||
/// <example> | ||
/// [DeploymentItem("file1.xml")] | ||
/// [DeploymentItem("file2.xml", "DataFiles")] | ||
/// [DeploymentItem("bin\Debug")] | ||
/// </example> | ||
/// <remarks> | ||
/// DeploymentItemAttribute is currently not supported in .Net Core. This is just a placehodler for support in the future. | ||
/// </remarks> | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] | ||
public sealed class DeploymentItemAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DeploymentItemAttribute"/> class. | ||
/// </summary> | ||
/// <param name="path">The file or directory to deploy. The path is relative to the build output directory. The item will be copied to the same directory as the deployed test assemblies.</param> | ||
public DeploymentItemAttribute(string path) | ||
{ | ||
this.Path = path; | ||
this.OutputDirectory = string.Empty; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DeploymentItemAttribute"/> class | ||
/// </summary> | ||
/// <param name="path">The relative or absolute path to the file or directory to deploy. The path is relative to the build output directory. The item will be copied to the same directory as the deployed test assemblies.</param> | ||
/// <param name="outputDirectory">The path of the directory to which the items are to be copied. It can be either absolute or relative to the deployment directory. All files and directories identified by <paramref name="path"/> will be copied to this directory.</param> | ||
public DeploymentItemAttribute(string path, string outputDirectory) | ||
{ | ||
this.Path = path; | ||
this.OutputDirectory = outputDirectory; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the path of the source file or folder to be copied. | ||
/// </summary> | ||
public string Path { get; } | ||
|
||
/// <summary> | ||
/// Gets the path of the directory to which the item is copied. | ||
/// </summary> | ||
public string OutputDirectory { get; } | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
src/TestFramework/Extension.Desktop/Attributes/DeploymentItemAttribute.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,53 @@ | ||
// 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.TestTools.UnitTesting | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// Used to specify deployment item (file or directory) for per-test deployment. | ||
/// Can be specified on test class or test method. | ||
/// Can have multiple instances of the attribute to specify more than one item. | ||
/// The item path can be absolute or relative, if relative, it is relative to RunConfig.RelativePathRoot. | ||
/// </summary> | ||
/// <example> | ||
/// [DeploymentItem("file1.xml")] | ||
/// [DeploymentItem("file2.xml", "DataFiles")] | ||
/// [DeploymentItem("bin\Debug")] | ||
/// </example> | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] | ||
public sealed class DeploymentItemAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DeploymentItemAttribute"/> class. | ||
/// </summary> | ||
/// <param name="path">The file or directory to deploy. The path is relative to the build output directory. The item will be copied to the same directory as the deployed test assemblies.</param> | ||
public DeploymentItemAttribute(string path) | ||
{ | ||
this.Path = path; | ||
this.OutputDirectory = string.Empty; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DeploymentItemAttribute"/> class | ||
/// </summary> | ||
/// <param name="path">The relative or absolute path to the file or directory to deploy. The path is relative to the build output directory. The item will be copied to the same directory as the deployed test assemblies.</param> | ||
/// <param name="outputDirectory">The path of the directory to which the items are to be copied. It can be either absolute or relative to the deployment directory. All files and directories identified by <paramref name="path"/> will be copied to this directory.</param> | ||
public DeploymentItemAttribute(string path, string outputDirectory) | ||
{ | ||
this.Path = path; | ||
this.OutputDirectory = outputDirectory; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the path of the source file or folder to be copied. | ||
/// </summary> | ||
public string Path { get; } | ||
|
||
/// <summary> | ||
/// Gets the path of the directory to which the item is copied. | ||
/// </summary> | ||
public string OutputDirectory { get; } | ||
} | ||
} |
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
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.
Should we not support it for .NETCore?
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.
Added the attribute in .Net Core as well. This would however not be visible in UWP since it does not even make sense there.