Skip to content

Commit 029ea9a

Browse files
committed
Initial intargation tests
1 parent 4077df8 commit 029ea9a

File tree

9 files changed

+201
-0
lines changed

9 files changed

+201
-0
lines changed

IntegrationTests/Assets/file.txt

Whitespace-only changes.
150 Bytes
Binary file not shown.
150 Bytes
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.IO;
2+
using WebDriverManager.Helpers;
3+
using WebDriverManager.Services.Impl;
4+
using Xunit;
5+
6+
namespace IntegrationTests
7+
{
8+
public class BinaryServiceTests : BinaryService
9+
{
10+
[Fact]
11+
public void DownloadZipResultNotEmpty()
12+
{
13+
var url = "https://chromedriver.storage.googleapis.com/2.25/chromedriver_win32.zip";
14+
var destination = FileHelper.GetZipDestination(url);
15+
var result = DownloadZip(url, destination);
16+
Assert.NotEmpty(result);
17+
Assert.True(File.Exists(result));
18+
}
19+
20+
[Fact]
21+
public void UnZipResultNotEmpty()
22+
{
23+
var zipPath = Path.Combine(Directory.GetCurrentDirectory(), @"Assets\unzipable.zip");
24+
var destination = FileHelper.GetBinDestination("Files", "2.0.0", Architecture.X32, "file.txt");
25+
FileHelper.CreateDestinationDirectory(destination);
26+
var result = UnZip(zipPath, destination, "file.txt");
27+
Assert.NotEmpty(result);
28+
Assert.True(File.Exists(result));
29+
}
30+
31+
[Fact]
32+
public void RemoveZipTargetMissing()
33+
{
34+
var zipPath = Path.Combine(Directory.GetCurrentDirectory(), @"Assets\removable.zip");
35+
RemoveZip(zipPath);
36+
Assert.False(File.Exists(zipPath));
37+
}
38+
}
39+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{511CE4F3-DC62-41F9-8700-CA798302C4E7}</ProjectGuid>
8+
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>IntegrationTests</RootNamespace>
12+
<AssemblyName>IntegrationTests</AssemblyName>
13+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Data" />
39+
<Reference Include="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
40+
<HintPath>..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll</HintPath>
41+
</Reference>
42+
<Reference Include="System.Xml" />
43+
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
44+
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
45+
</Reference>
46+
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
47+
<HintPath>..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
48+
</Reference>
49+
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
50+
<HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
51+
</Reference>
52+
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
53+
<HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
54+
</Reference>
55+
</ItemGroup>
56+
<ItemGroup>
57+
<Compile Include="BinaryServiceTests.cs" />
58+
<Compile Include="Properties\AssemblyInfo.cs" />
59+
<Compile Include="VariableServiceTests.cs" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<ProjectReference Include="..\WebDriverManager\WebDriverManager.csproj">
63+
<Project>{DDF73921-D0CD-4B7F-BAFB-021CEAC5FF73}</Project>
64+
<Name>WebDriverManager</Name>
65+
</ProjectReference>
66+
</ItemGroup>
67+
<ItemGroup>
68+
<Content Include="Assets\file.txt">
69+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
70+
</Content>
71+
<Content Include="Assets\removable.zip">
72+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
73+
</Content>
74+
<Content Include="Assets\unzipable.zip">
75+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
76+
</Content>
77+
</ItemGroup>
78+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
79+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
80+
Other similar extension points exist, see Microsoft.Common.targets.
81+
<Target Name="BeforeBuild">
82+
</Target>
83+
<Target Name="AfterBuild">
84+
</Target>
85+
-->
86+
</Project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
9+
[assembly: AssemblyTitle("IntegrationTests")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("IntegrationTests")]
14+
[assembly: AssemblyCopyright("Copyright © 2016")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
18+
// Setting ComVisible to false makes the types in this assembly not visible
19+
// to COM components. If you need to access a type in this assembly from
20+
// COM, set the ComVisible attribute to true on that type.
21+
22+
[assembly: ComVisible(false)]
23+
24+
// The following GUID is for the ID of the typelib if this project is exposed to COM
25+
26+
[assembly: Guid("511CE4F3-DC62-41F9-8700-CA798302C4E7")]
27+
28+
// Version information for an assembly consists of the following four values:
29+
//
30+
// Major Version
31+
// Minor Version
32+
// Build Number
33+
// Revision
34+
//
35+
// You can specify all the values or you can default the Build and Revision Numbers
36+
// by using the '*' as shown below:
37+
// [assembly: AssemblyVersion("1.0.*")]
38+
39+
[assembly: AssemblyVersion("1.0.0.0")]
40+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.IO;
3+
using WebDriverManager.Services.Impl;
4+
using Xunit;
5+
6+
namespace IntegrationTests
7+
{
8+
public class VariableServiceTests : VariableService
9+
{
10+
[Fact]
11+
public void UpdatePathResultValid()
12+
{
13+
var filePath = Path.Combine(Directory.GetCurrentDirectory(), @"Assets\file.txt");
14+
UpdatePath(filePath);
15+
var pathVariable = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
16+
var variable = Path.GetDirectoryName(filePath);
17+
Assert.NotNull(pathVariable);
18+
Assert.Contains(variable, pathVariable);
19+
}
20+
}
21+
}

IntegrationTests/packages.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="xunit" version="2.1.0" targetFramework="net45" />
4+
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
5+
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
6+
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
7+
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
8+
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
9+
</packages>

WebDriverManager.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.25123.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDriverManager", "WebDriverManager\WebDriverManager.csproj", "{DDF73921-D0CD-4B7F-BAFB-021CEAC5FF73}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests", "IntegrationTests\IntegrationTests.csproj", "{511CE4F3-DC62-41F9-8700-CA798302C4E7}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{DDF73921-D0CD-4B7F-BAFB-021CEAC5FF73}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{DDF73921-D0CD-4B7F-BAFB-021CEAC5FF73}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{DDF73921-D0CD-4B7F-BAFB-021CEAC5FF73}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{511CE4F3-DC62-41F9-8700-CA798302C4E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{511CE4F3-DC62-41F9-8700-CA798302C4E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{511CE4F3-DC62-41F9-8700-CA798302C4E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{511CE4F3-DC62-41F9-8700-CA798302C4E7}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)