-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add path expansion for files capability
`files` capability now support sending contents of directories, not only files Usage examples: "D:\\preinstalled\\": "", "D:\\preinstalled\\": "downloads", "D:\\preinstalled\\settings.xml": "data\\", "D:\\preinstalled\\settings.xml": "data"
- Loading branch information
Nick Abalov
authored and
Nick Abalov
committed
Dec 29, 2015
1 parent
954eae8
commit 8a8446d
Showing
11 changed files
with
372 additions
and
11 deletions.
There are no files selected for viewing
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
88 changes: 88 additions & 0 deletions
88
Winium/Winium.StoreApps.Driver.Tests/FileListExpanderTests.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,88 @@ | ||
namespace Winium.StoreApps.Driver.Tests | ||
{ | ||
#region | ||
|
||
using System.Collections.Generic; | ||
using System.IO.Abstractions.TestingHelpers; | ||
using System.Linq; | ||
|
||
using NUnit.Framework; | ||
|
||
using Winium.StoreApps.Driver.CommandHelpers; | ||
|
||
#endregion | ||
|
||
[TestFixture] | ||
public class FileExpanderTests | ||
{ | ||
#region Fields | ||
|
||
private FilesCapabilityExpander expander; | ||
|
||
#endregion | ||
|
||
#region Public Methods and Operators | ||
|
||
[SetUp] | ||
public void BeforeTest() | ||
{ | ||
var fileSystem = | ||
new MockFileSystem( | ||
new Dictionary<string, MockFileData> | ||
{ | ||
{ @"c:\root.txt", new MockFileData(string.Empty) }, | ||
{ @"c:\demo\nested1.txt", new MockFileData(string.Empty) }, | ||
{ @"c:\demo\nested2.txt", new MockFileData(string.Empty) }, | ||
{ @"c:\demo\subfolder\file.txt", new MockFileData(string.Empty) }, | ||
}); | ||
|
||
this.expander = new FilesCapabilityExpander(fileSystem); | ||
} | ||
|
||
[Test] | ||
public void TestFileExpanderFileToDirectory() | ||
{ | ||
var d = new Dictionary<string, string> { { @"c:\root.txt", "downloads/" } }; | ||
var rv = this.expander.ExpandFiles(d); | ||
Assert.AreEqual("downloads\\root.txt", rv.First().Value); | ||
} | ||
|
||
[Test] | ||
public void TestFileExpanderFileToFile() | ||
{ | ||
var d = new Dictionary<string, string> { { @"c:\root.txt", "downloads/new.txt" } }; | ||
var rv = this.expander.ExpandFiles(d); | ||
Assert.AreEqual("downloads\\new.txt", rv.First().Value); | ||
} | ||
|
||
[Test] | ||
public void TestFileExpanderDirectoryToDirectory() | ||
{ | ||
var d = new Dictionary<string, string> { { @"c:\demo/", "downloads" } }; | ||
var rv = this.expander.ExpandFiles(d); | ||
var expected = new List<string> | ||
{ | ||
@"downloads\nested1.txt", | ||
@"downloads\nested2.txt", | ||
@"downloads\subfolder\file.txt", | ||
}; | ||
CollectionAssert.AreEqual(expected, rv.Select(x => x.Value)); | ||
} | ||
|
||
[Test] | ||
public void TestFileExpanderDirectoryToRootDirectory() | ||
{ | ||
var d = new Dictionary<string, string> { { @"c:\demo/", string.Empty } }; | ||
var rv = this.expander.ExpandFiles(d); | ||
var expected = new List<string> | ||
{ | ||
@"nested1.txt", | ||
@"nested2.txt", | ||
@"subfolder\file.txt", | ||
}; | ||
CollectionAssert.AreEqual(expected, rv.Select(x => x.Value)); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Winium/Winium.StoreApps.Driver.Tests/Properties/AssemblyInfo.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,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Winium.StoreApps.Driver.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Winium.StoreApps.Driver.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © 2015")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("0c036ea5-8c76-4638-832d-9ced3a0ed57c")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
111 changes: 111 additions & 0 deletions
111
Winium/Winium.StoreApps.Driver.Tests/Winium.StoreApps.Driver.Tests.csproj
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,111 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{07168ED9-C12A-43F5-898F-84AB113A9441}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Winium.StoreApps.Driver.Tests</RootNamespace> | ||
<AssemblyName>Winium.StoreApps.Driver.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> | ||
<RestorePackages>true</RestorePackages> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x86\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<ErrorReport>prompt</ErrorReport> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | ||
<OutputPath>bin\x86\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<ErrorReport>prompt</ErrorReport> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.IO.Abstractions"> | ||
<HintPath>..\packages\System.IO.Abstractions.2.0.0.120\lib\net40\System.IO.Abstractions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.IO.Abstractions.TestingHelpers"> | ||
<HintPath>..\packages\System.IO.Abstractions.TestingHelpers.2.0.0.120\lib\net40\System.IO.Abstractions.TestingHelpers.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
</ItemGroup> | ||
</When> | ||
<Otherwise> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" /> | ||
</ItemGroup> | ||
</Otherwise> | ||
</Choose> | ||
<ItemGroup> | ||
<Compile Include="FileListExpanderTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Winium.StoreApps.Driver\Winium.StoreApps.Driver.csproj"> | ||
<Project>{B6BE579B-B008-45B2-9740-12F0E6223661}</Project> | ||
<Name>Winium.StoreApps.Driver</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> | ||
</Target> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit" version="2.6.4" targetFramework="net451" /> | ||
<package id="System.IO.Abstractions" version="2.0.0.120" targetFramework="net451" /> | ||
<package id="System.IO.Abstractions.TestingHelpers" version="2.0.0.120" targetFramework="net451" /> | ||
</packages> |
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
Oops, something went wrong.