Skip to content

Commit

Permalink
renamed DeploymentItemEx to DeploymentItemWithLongPath
Browse files Browse the repository at this point in the history
added ZetaLongPaths 1.0.0 as a dependency to the nuget specification
  • Loading branch information
icnocop committed Mar 27, 2013
1 parent 06ec807 commit 4491386
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<description>StealFocus MSTestExtensions package.</description>
<copyright>Copyright StealFocus. All rights reserved.</copyright>
<tags>StealFocus MSTestExtensions</tags>
<dependencies />
<dependencies>
<dependency id="ZetaLongPaths" version="1.0.0" />
</dependencies>
</metadata>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace StealFocus.MSTestExtensions
using System.Security;
using ZetaLongPaths;

internal class DeploymentItemExAspect : MSTestExtensionsTestAspect<DeploymentItemExAttribute>, IMessageSink, IMSTestExtensionsTestAspect
internal class DeploymentItemWithLongPathAspect : MSTestExtensionsTestAspect<DeploymentItemWithLongPathAttribute>, IMessageSink, IMSTestExtensionsTestAspect
{
public IMessageSink NextSink
{
Expand All @@ -27,15 +27,15 @@ public IMessage SyncProcessMessage(IMessage msg)
throw new ArgumentNullException("msg");
}

DeploymentItemExAttribute deploymentItemExAttribute = GetAttribute(msg);
if (deploymentItemExAttribute != null)
DeploymentItemWithLongPathAttribute deploymentItemWithLongPathAttribute = GetAttribute(msg);
if (deploymentItemWithLongPathAttribute != null)
{
// by default, mstest sets the test results folder to format: %current directory%\TestResults\%username%_%computername% %datetime%\Out
// TODO: get the value of the RelativePathRoot property setting in the current .testsettings file
string solutionPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName;

string source = ZlpPathHelper.GetAbsolutePath(deploymentItemExAttribute.Path, solutionPath);
string destinationPath = ZlpPathHelper.GetAbsolutePath(deploymentItemExAttribute.OutputDirectory, Directory.GetCurrentDirectory());
string source = ZlpPathHelper.GetAbsolutePath(deploymentItemWithLongPathAttribute.Path, solutionPath);
string destinationPath = ZlpPathHelper.GetAbsolutePath(deploymentItemWithLongPathAttribute.OutputDirectory, Directory.GetCurrentDirectory());

bool fileExists = ZlpIOHelper.FileExists(source);
bool directoryExists = ZlpIOHelper.DirectoryExists(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,30 @@
using System.Text;

/// <summary>
/// DeploymentItemEx, much like DeploymentItem, but supports long file paths
/// DeploymentItemWithLongPath, much like DeploymentItem, but supports long file paths.
/// It allows the source and destination deployment items to have long file paths (greater than 256 characters).
/// See the unresolved Microsoft connect bug here:
/// http://connect.microsoft.com/VisualStudio/feedback/details/753341/unit-test-deploymentitem-attribute-is-limits-file-paths-with-a-maximum-file-path-length-of-about-256-characters
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class DeploymentItemExAttribute : Attribute
public sealed class DeploymentItemWithLongPathAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DeploymentItemExAttribute"/> class.
/// Initializes a new instance of the <see cref="DeploymentItemWithLongPathAttribute"/> class.
/// </summary>
/// <param name="path">The path.</param>
public DeploymentItemExAttribute(string path)
public DeploymentItemWithLongPathAttribute(string path)
{
this.Path = path;
this.OutputDirectory = string.Empty;
}

/// <summary>
/// Initializes a new instance of the <see cref="DeploymentItemExAttribute"/> class.
/// Initializes a new instance of the <see cref="DeploymentItemWithLongPathAttribute"/> class.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="outputDirectory">The output directory.</param>
public DeploymentItemExAttribute(string path, string outputDirectory)
public DeploymentItemWithLongPathAttribute(string path, string outputDirectory)
{
this.Path = path;
this.OutputDirectory = outputDirectory;
Expand Down
2 changes: 1 addition & 1 deletion Source/StealFocus.MSTestExtensions/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "StealFocus.MSTestExtensions.TestTimerAspect")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "StealFocus.MSTestExtensions.TestTransactionAspect")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "TestTimer", Scope = "member", Target = "StealFocus.MSTestExtensions.TestTimerAspect.#SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "StealFocus.MSTestExtensions.DeploymentItemExAspect")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "StealFocus.MSTestExtensions.DeploymentItemWithLongPathAspect")]
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override void GetPropertiesForNewContext(IConstructionCallMessage msg)
msg.ContextProperties.Add(new MSTestExtensionsTestProperty<TestTimerAspect>());
msg.ContextProperties.Add(new MSTestExtensionsTestProperty<TestTransactionAspect>());
msg.ContextProperties.Add(new MSTestExtensionsTestProperty<ExpectedExceptionMessageAspect>());
msg.ContextProperties.Add(new MSTestExtensionsTestProperty<DeploymentItemExAspect>());
msg.ContextProperties.Add(new MSTestExtensionsTestProperty<DeploymentItemWithLongPathAspect>());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DeploymentItemExAspect.cs" />
<Compile Include="DeploymentItemExAttribute.cs" />
<Compile Include="DeploymentItemWithLongPathAspect.cs" />
<Compile Include="DeploymentItemWithLongPathAttribute.cs" />
<Compile Include="MSTestExtensionsException.cs" />
<Compile Include="MSTestExtensionsTestAspect.cs" />
<Compile Include="MSTestExtensionsTestAttribute.cs" />
Expand Down

0 comments on commit 4491386

Please sign in to comment.