Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 076e69f

Browse files
Adding a unit test to check the Git LFS bundle explicitly
1 parent 3737ada commit 076e69f

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

src/IntegrationTests/Git/GitSetupTests.cs

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Threading;
22
using FluentAssertions;
33
using GitHub.Unity;
4+
using ICSharpCode.SharpZipLib.Zip;
45
using NUnit.Framework;
56
using Rackspace.Threading;
67
using TestUtils;
@@ -27,28 +28,28 @@ public void InstallGit()
2728
{
2829
environment.GitExecutablePath = gitSetup.GitExecutablePath;
2930

30-
setupDone.Should().BeTrue ();
31-
percent.Should().Be (1);
31+
setupDone.Should().BeTrue();
32+
percent.Should().Be(1);
3233

33-
Logger.Trace ("Expected GitExecutablePath: {0}", gitSetup.GitExecutablePath);
34-
gitSetup.GitExecutablePath.FileExists ().Should ().BeTrue ();
34+
Logger.Trace("Expected GitExecutablePath: {0}", gitSetup.GitExecutablePath);
35+
gitSetup.GitExecutablePath.FileExists().Should().BeTrue();
3536

36-
var gitLfsDestinationPath = gitSetup.GitInstallationPath;
37+
var gitLfsDestinationPath = gitSetup.GitInstallationPath;
3738
gitLfsDestinationPath = gitLfsDestinationPath.Combine("mingw32");
3839

39-
gitLfsDestinationPath = gitLfsDestinationPath.Combine("libexec", "git-core", "git-lfs.exe");
40-
gitLfsDestinationPath.FileExists().Should().BeTrue();
40+
gitLfsDestinationPath = gitLfsDestinationPath.Combine("libexec", "git-core", "git-lfs.exe");
41+
gitLfsDestinationPath.FileExists().Should().BeTrue();
4142

42-
var calculateMd5 = NPathFileSystemProvider.Current.CalculateMD5(gitLfsDestinationPath);
43-
GitInstaller.GitLfsExecutableMD5.Should ().Be (calculateMd5);
43+
var calculateMd5 = NPathFileSystemProvider.Current.CalculateMD5(gitLfsDestinationPath);
44+
GitInstaller.GitLfsExecutableMD5.Should().Be(calculateMd5);
4445

45-
setupDone = gitSetup.SetupIfNeeded (percentage: new Progress<float> (x => percent = x)).Result;
46-
setupDone.Should ().BeFalse ();
46+
setupDone = gitSetup.SetupIfNeeded(percentage: new Progress<float>(x => percent = x)).Result;
47+
setupDone.Should().BeFalse();
4748
}
4849
else
4950
{
5051
environment.GitExecutablePath = "/usr/local/bin/git";
51-
setupDone.Should().BeFalse ();
52+
setupDone.Should().BeFalse();
5253
}
5354

5455
var platform = new Platform(environment, FileSystem, new TestUIDispatcher());
@@ -61,5 +62,25 @@ public void InstallGit()
6162
new GitBranch("master", "origin/master: behind 1", true),
6263
new GitBranch("feature/document", "origin/feature/document", false));
6364
}
65+
66+
67+
[Test]
68+
public void VerifyGitLfsBundle()
69+
{
70+
var environmentPath = NPath.CreateTempDirectory("integration-test-environment");
71+
72+
var gitLfsPath = environmentPath.Combine("git-lfs.exe");
73+
gitLfsPath.Exists().Should().BeFalse();
74+
75+
var inputZipFile = SolutionDirectory.ToNPath().Combine("PlatformResources", "windows", "git-lfs.zip");
76+
77+
var fastZip = new FastZip();
78+
fastZip.ExtractZip(inputZipFile, environmentPath, null);
79+
80+
gitLfsPath.Exists().Should().BeTrue();
81+
82+
var calculateMd5 = NPathFileSystemProvider.Current.CalculateMD5(gitLfsPath);
83+
GitInstaller.GitLfsExecutableMD5.Should().Be(calculateMd5);
84+
}
6485
}
6586
}

src/IntegrationTests/IntegrationTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
<HintPath>$(SolutionDir)packages\FluentAssertions.2.2.0.0\lib\net35\FluentAssertions.dll</HintPath>
4444
<Private>True</Private>
4545
</Reference>
46+
<Reference Include="ICSharpCode.SharpZipLib, Version=2.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>..\..\lib\5.5\ICSharpCode.SharpZipLib.dll</HintPath>
49+
</Reference>
4650
<Reference Include="NCrunch.Framework, Version=3.3.0.6, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea, processorArchitecture=MSIL">
4751
<HintPath>..\..\packages\NCrunch.Framework.3.3.0.6\lib\NCrunch.Framework.dll</HintPath>
4852
<Private>True</Private>

0 commit comments

Comments
 (0)