diff --git a/src/TestFramework/Extension.Core/Attributes/DeploymentItemAttribute.cs b/src/TestFramework/Extension.Core/Attributes/DeploymentItemAttribute.cs
new file mode 100644
index 0000000000..c84260967f
--- /dev/null
+++ b/src/TestFramework/Extension.Core/Attributes/DeploymentItemAttribute.cs
@@ -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;
+
+ ///
+ /// 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.
+ ///
+ ///
+ /// [DeploymentItem("file1.xml")]
+ /// [DeploymentItem("file2.xml", "DataFiles")]
+ /// [DeploymentItem("bin\Debug")]
+ ///
+ ///
+ /// DeploymentItemAttribute is currently not supported in .Net Core. This is just a placehodler for support in the future.
+ ///
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
+ public sealed class DeploymentItemAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// 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.
+ public DeploymentItemAttribute(string path)
+ {
+ this.Path = path;
+ this.OutputDirectory = string.Empty;
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ /// 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.
+ /// 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 will be copied to this directory.
+ public DeploymentItemAttribute(string path, string outputDirectory)
+ {
+ this.Path = path;
+ this.OutputDirectory = outputDirectory;
+ }
+
+ ///
+ /// Gets the path of the source file or folder to be copied.
+ ///
+ public string Path { get; }
+
+ ///
+ /// Gets the path of the directory to which the item is copied.
+ ///
+ public string OutputDirectory { get; }
+ }
+}
diff --git a/src/TestFramework/Extension.Core/Extension.Core.csproj b/src/TestFramework/Extension.Core/Extension.Core.csproj
index 16e70af165..a71634a810 100644
--- a/src/TestFramework/Extension.Core/Extension.Core.csproj
+++ b/src/TestFramework/Extension.Core/Extension.Core.csproj
@@ -35,6 +35,7 @@
Extensions\Core
+
diff --git a/src/TestFramework/Extension.Desktop/Attributes/DeploymentItemAttribute.cs b/src/TestFramework/Extension.Desktop/Attributes/DeploymentItemAttribute.cs
new file mode 100644
index 0000000000..b028d84bf7
--- /dev/null
+++ b/src/TestFramework/Extension.Desktop/Attributes/DeploymentItemAttribute.cs
@@ -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;
+
+ ///
+ /// 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.
+ ///
+ ///
+ /// [DeploymentItem("file1.xml")]
+ /// [DeploymentItem("file2.xml", "DataFiles")]
+ /// [DeploymentItem("bin\Debug")]
+ ///
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
+ public sealed class DeploymentItemAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// 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.
+ public DeploymentItemAttribute(string path)
+ {
+ this.Path = path;
+ this.OutputDirectory = string.Empty;
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ /// 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.
+ /// 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 will be copied to this directory.
+ public DeploymentItemAttribute(string path, string outputDirectory)
+ {
+ this.Path = path;
+ this.OutputDirectory = outputDirectory;
+ }
+
+ ///
+ /// Gets the path of the source file or folder to be copied.
+ ///
+ public string Path { get; }
+
+ ///
+ /// Gets the path of the directory to which the item is copied.
+ ///
+ public string OutputDirectory { get; }
+ }
+}
diff --git a/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj b/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj
index bc8d91eae0..57aa0f5048 100644
--- a/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj
+++ b/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj
@@ -54,6 +54,7 @@
+
diff --git a/src/TestFramework/MSTest.Core/Attributes/VSTestAttributes.cs b/src/TestFramework/MSTest.Core/Attributes/VSTestAttributes.cs
index 0be7154a3d..a757f7571d 100644
--- a/src/TestFramework/MSTest.Core/Attributes/VSTestAttributes.cs
+++ b/src/TestFramework/MSTest.Core/Attributes/VSTestAttributes.cs
@@ -405,52 +405,6 @@ public TestResult()
public IList ResultFiles { get; set; }
}
- ///
- /// 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.
- ///
- ///
- /// [DeploymentItem("file1.xml")]
- /// [DeploymentItem("file2.xml", "DataFiles")]
- /// [DeploymentItem("bin\Debug")]
- ///
- [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
- public sealed class DeploymentItemAttribute : Attribute
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// 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.
- public DeploymentItemAttribute(string path)
- {
- this.Path = path;
- this.OutputDirectory = string.Empty;
- }
-
- ///
- /// Initializes a new instance of the class
- ///
- /// 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.
- /// 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 will be copied to this directory.
- public DeploymentItemAttribute(string path, string outputDirectory)
- {
- this.Path = path;
- this.OutputDirectory = outputDirectory;
- }
-
- ///
- /// Gets the path of the source file or folder to be copied.
- ///
- public string Path { get; }
-
- ///
- /// Gets the path of the directory to which the item is copied.
- ///
- public string OutputDirectory { get; }
- }
-
///
/// Specifies connection string, table name and row access method for data driven testing.
///
diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Discovery/TypeEnumeratorTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Discovery/TypeEnumeratorTests.cs
index e43df51d44..fd44e8baf8 100644
--- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Discovery/TypeEnumeratorTests.cs
+++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Discovery/TypeEnumeratorTests.cs
@@ -313,7 +313,6 @@ public void GetTestFromMethodShouldSetDeploymentItemsToNullIfNotPresent()
var methodInfo = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");
// Setup mocks
- this.mockReflectHelper.Setup(rh => rh.GetCustomAttributes(It.IsAny(), typeof(UTF.DeploymentItemAttribute))).Returns(new Attribute[] { });
this.testablePlatformServiceProvider.MockTestDeployment.Setup(
td => td.GetDeploymentItems(It.IsAny(), It.IsAny(), this.warnings))
.Returns((KeyValuePair[])null);
@@ -333,8 +332,6 @@ public void GetTestFromMethodShouldSetDeploymentItems()
var deploymentItems = new[] { new KeyValuePair("C:\\temp", string.Empty) };
// Setup mocks
- this.mockReflectHelper.Setup(rh => rh.GetCustomAttributes(typeof(DummyTestClass).GetTypeInfo(), typeof(UTF.DeploymentItemAttribute))).Returns(new Attribute[] { new UTF.DeploymentItemAttribute("C:\\temp") });
- this.mockReflectHelper.Setup(rh => rh.GetCustomAttributes(methodInfo, typeof(UTF.DeploymentItemAttribute))).Returns(new Attribute[] { });
this.testablePlatformServiceProvider.MockTestDeployment.Setup(
td => td.GetDeploymentItems(methodInfo, typeof(DummyTestClass), this.warnings)).Returns(deploymentItems);
diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestDeploymentTests.cs b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestDeploymentTests.cs
index bb88f1c24c..4449b5568c 100644
--- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestDeploymentTests.cs
+++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestDeploymentTests.cs
@@ -5,6 +5,7 @@ namespace MSTestAdapter.PlatformServices.Desktop.UnitTests.Services
{
extern alias FrameworkV1;
extern alias FrameworkV2;
+ extern alias FrameworkV2DesktopExtension;
using System.Collections.Generic;
using System.IO;
@@ -25,7 +26,7 @@ namespace MSTestAdapter.PlatformServices.Desktop.UnitTests.Services
using CollectionAssert = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.CollectionAssert;
using Ignore = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.IgnoreAttribute;
using TestClass = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
- using TestFrameworkV2 = FrameworkV2::Microsoft.VisualStudio.TestTools.UnitTesting;
+ using TestFrameworkV2Extension = FrameworkV2DesktopExtension::Microsoft.VisualStudio.TestTools.UnitTesting;
using TestInitialize = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute;
using TestMethod = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
@@ -563,18 +564,18 @@ public void GetDeploymentInformationShouldReturnRunDirectoryInformationIfSourceI
private void SetupDeploymentItems(MemberInfo memberInfo, KeyValuePair[] deploymentItems)
{
- var deploymentItemAttributes = new List();
+ var deploymentItemAttributes = new List();
foreach (var deploymentItem in deploymentItems)
{
- deploymentItemAttributes.Add(new TestFrameworkV2.DeploymentItemAttribute(deploymentItem.Key, deploymentItem.Value));
+ deploymentItemAttributes.Add(new TestFrameworkV2Extension.DeploymentItemAttribute(deploymentItem.Key, deploymentItem.Value));
}
this.mockReflectionUtility.Setup(
ru =>
ru.GetCustomAttributes(
memberInfo,
- typeof(TestFrameworkV2.DeploymentItemAttribute))).Returns((object[])deploymentItemAttributes.ToArray());
+ typeof(TestFrameworkV2Extension.DeploymentItemAttribute))).Returns((object[])deploymentItemAttributes.ToArray());
}
private TestCase GetTestCase(string source)
diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Utilities/DeploymentItemUtilityTests.cs b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Utilities/DeploymentItemUtilityTests.cs
index cae6a6d872..d388ba771c 100644
--- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Utilities/DeploymentItemUtilityTests.cs
+++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Utilities/DeploymentItemUtilityTests.cs
@@ -5,6 +5,7 @@ namespace MSTestAdapter.PlatformServices.Desktop.UnitTests.Utilities
{
extern alias FrameworkV1;
extern alias FrameworkV2;
+ extern alias FrameworkV2DesktopExtension;
using System.Collections.Generic;
using System.Linq;
@@ -22,6 +23,7 @@ namespace MSTestAdapter.PlatformServices.Desktop.UnitTests.Utilities
using StringAssert = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert;
using TestClass = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
using TestFrameworkV2 = FrameworkV2::Microsoft.VisualStudio.TestTools.UnitTesting;
+ using TestFrameworkV2Extension = FrameworkV2DesktopExtension::Microsoft.VisualStudio.TestTools.UnitTesting;
using TestInitialize = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute;
using TestMethod = FrameworkV1::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
@@ -451,18 +453,18 @@ public void HasDeployItemsShouldReturnTrueWhenDeploymentItemsArePresent()
private void SetupDeploymentItems(MemberInfo memberInfo, KeyValuePair[] deploymentItems)
{
- var deploymentItemAttributes = new List();
+ var deploymentItemAttributes = new List();
foreach (var deploymentItem in deploymentItems)
{
- deploymentItemAttributes.Add(new TestFrameworkV2.DeploymentItemAttribute(deploymentItem.Key, deploymentItem.Value));
+ deploymentItemAttributes.Add(new TestFrameworkV2Extension.DeploymentItemAttribute(deploymentItem.Key, deploymentItem.Value));
}
this.mockReflectionUtility.Setup(
ru =>
ru.GetCustomAttributes(
memberInfo,
- typeof(TestFrameworkV2.DeploymentItemAttribute))).Returns((object[])deploymentItemAttributes.ToArray());
+ typeof(TestFrameworkV2Extension.DeploymentItemAttribute))).Returns((object[])deploymentItemAttributes.ToArray());
}
#endregion