Skip to content
Snippets Groups Projects
Commit ebfe80f2 authored by Stanley Goldman's avatar Stanley Goldman
Browse files

Making IOTestsRepo.zip a folder nested

parent e8fd2f1e
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ namespace IntegrationTests
[Test]
public void CommonParentTest()
{
var filesystem = new FileSystem(TestBasePath);
var filesystem = new FileSystem(TestRepoPath);
NPathFileSystemProvider.Current = filesystem;
var environment = new DefaultEnvironment();
......@@ -75,7 +75,7 @@ namespace IntegrationTests
);
}
environment.GitExecutablePath = gitSetup.GitExecutablePath;
environment.UnityProjectPath = TestBasePath;
environment.UnityProjectPath = TestRepoPath;
IPlatform platform = null;
platform = new Platform(environment, filesystem, new TestUIDispatcher(() =>
{
......@@ -86,7 +86,7 @@ namespace IntegrationTests
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
await platform.Initialize(processManager);
using (var repoManager = new RepositoryManager(TestBasePath, platform, CancellationToken.None))
using (var repoManager = new RepositoryManager(TestRepoPath, platform, CancellationToken.None))
{
var repository = repoManager.Repository;
environment.Repository = repoManager.Repository;
......
......@@ -13,11 +13,14 @@ namespace IntegrationTests
{
base.OnSetup();
TestRepoPath = TestBasePath.Combine("IOTestsRepo");
FileSystem.SetCurrentDirectory(TestRepoPath);
Platform = new Platform(Environment, FileSystem, new TestUIDispatcher());
GitEnvironment = Platform.GitEnvironment;
ProcessManager = new ProcessManager(Environment, GitEnvironment);
Environment.UnityProjectPath = TestBasePath;
Environment.UnityProjectPath = TestRepoPath;
Environment.GitExecutablePath = GitEnvironment.FindGitInstallationPath(ProcessManager).Result;
using (var zipFile = new ZipFile(TestZipFilePath))
......@@ -25,11 +28,13 @@ namespace IntegrationTests
zipFile.ExtractAll(TestBasePath.ToString(), ExtractExistingFileAction.OverwriteSilently);
}
var repositoryManager = new RepositoryManager(TestBasePath, Platform, CancellationToken.None);
var repositoryManager = new RepositoryManager(TestRepoPath, Platform, CancellationToken.None);
Environment.Repository = repositoryManager.Repository;
}
public Platform Platform { get; set; }
protected NPath TestRepoPath { get; private set; }
protected Platform Platform { get; private set; }
private static string SolutionDirectory => TestContext.CurrentContext.TestDirectory;
......
......@@ -8,13 +8,11 @@ namespace IntegrationTests.Events
{
class RepositoryWatcherTests : BaseGitIntegrationTest
{
protected override void OnSetup()
{
base.OnSetup();
DotGitPath = TestBasePath.Combine(".git");
DotGitPath = TestRepoPath.Combine(".git");
if (DotGitPath.FileExists())
{
......@@ -34,7 +32,7 @@ namespace IntegrationTests.Events
private RepositoryWatcher CreateRepositoryWatcher()
{
return new RepositoryWatcher(Platform, TestBasePath, DotGitPath, DotGitIndex, DotGitHead, BranchesPath, RemotesPath, DotGitConfig);
return new RepositoryWatcher(Platform, TestRepoPath, DotGitPath, DotGitIndex, DotGitHead, BranchesPath, RemotesPath, DotGitConfig);
}
protected NPath DotGitConfig { get; private set; }
......@@ -59,13 +57,14 @@ namespace IntegrationTests.Events
repositoryWatcher.Start();
var foobarTxt = TestBasePath.Combine("foobar.txt");
var foobarTxt = TestRepoPath.Combine("foobar.txt");
foobarTxt.WriteAllText("foobar");
Thread.Sleep(100);
//http://stackoverflow.com/questions/1764809/filesystemwatcher-changed-event-is-raised-twice
repositoryChanged.Should().Be(2);
repositoryChanged.Should().BeInRange(1, 2);
repositoryChanged.Should().BeGreaterOrEqualTo(1);
}
[Test]
......
......@@ -15,11 +15,11 @@ namespace IntegrationTests
public void FindRepoRootTest()
{
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestBasePath;
environment.UnityProjectPath = TestRepoPath;
var repositoryLocator = new RepositoryLocator(environment.UnityProjectPath);
repositoryLocator.FindRepositoryRoot().ToString().Should().Be(new NPath(TestBasePath).ToString());
repositoryLocator.FindRepositoryRoot().ToString().Should().Be(new NPath(TestRepoPath).ToString());
}
[Test]
......@@ -29,7 +29,7 @@ namespace IntegrationTests
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(Environment, gitEnvironment);
var gitBranches = processManager.GetGitBranches(TestBasePath, Environment.GitExecutablePath);
var gitBranches = processManager.GetGitBranches(TestRepoPath, Environment.GitExecutablePath);
gitBranches.Should().BeEquivalentTo(
new GitBranch("master", string.Empty, true),
......
No preview for this file type
......@@ -14,7 +14,7 @@ namespace IntegrationTests
[Test]
public void BranchListTest()
{
var gitBranches = ProcessManager.GetGitBranches(TestBasePath);
var gitBranches = ProcessManager.GetGitBranches(TestRepoPath);
gitBranches.Should().BeEquivalentTo(
new GitBranch("master", string.Empty, true),
......@@ -25,7 +25,7 @@ namespace IntegrationTests
public void LogEntriesTest()
{
var logEntries =
ProcessManager.GetGitLogEntries(TestBasePath, Environment, FileSystem, GitEnvironment, 2)
ProcessManager.GetGitLogEntries(TestRepoPath, Environment, FileSystem, GitEnvironment, 2)
.ToArray();
logEntries.AssertEqual(new[]
......@@ -39,7 +39,7 @@ namespace IntegrationTests
Changes = new List<GitStatusEntry>
{
new GitStatusEntry("Assets/TestDocument.txt".ToNPath(),
TestBasePath + "/Assets/TestDocument.txt".ToNPath(), "Assets/TestDocument.txt".ToNPath(),
TestRepoPath + "/Assets/TestDocument.txt".ToNPath(), "Assets/TestDocument.txt".ToNPath(),
GitFileStatus.Renamed, "TestDocument.txt")
},
CommitID = "018997938335742f8be694240a7c2b352ec0835f",
......@@ -57,7 +57,7 @@ namespace IntegrationTests
Changes = new List<GitStatusEntry>
{
new GitStatusEntry("TestDocument.txt".ToNPath(),
TestBasePath + "/TestDocument.txt".ToNPath(), "TestDocument.txt".ToNPath(),
TestRepoPath + "/TestDocument.txt".ToNPath(), "TestDocument.txt".ToNPath(),
GitFileStatus.Added),
},
CommitID = "03939ffb3eb8486dba0259b43db00842bbe6eca1",
......@@ -72,7 +72,7 @@ namespace IntegrationTests
[Test]
public void RemoteListTest()
{
var gitRemotes = ProcessManager.GetGitRemoteEntries(TestBasePath);
var gitRemotes = ProcessManager.GetGitRemoteEntries(TestRepoPath);
gitRemotes.Should().BeEquivalentTo(new GitRemote()
{
......@@ -86,7 +86,7 @@ namespace IntegrationTests
[Test]
public void StatusTest()
{
var gitStatus = ProcessManager.GetGitStatus(TestBasePath, Environment, FileSystem, GitEnvironment);
var gitStatus = ProcessManager.GetGitStatus(TestRepoPath, Environment, FileSystem, GitEnvironment);
gitStatus.AssertEqual(new GitStatus()
{
......@@ -94,17 +94,17 @@ namespace IntegrationTests
Entries = new List<GitStatusEntry>
{
new GitStatusEntry("Assets/Added Document.txt".ToNPath(),
TestBasePath.Combine("Assets/Added Document.txt"),
TestRepoPath.Combine("Assets/Added Document.txt"),
"Assets/Added Document.txt".ToNPath(),
GitFileStatus.Added, staged: true),
new GitStatusEntry("Assets/Renamed TestDocument.txt".ToNPath(),
TestBasePath.Combine("Assets/Renamed TestDocument.txt"),
TestRepoPath.Combine("Assets/Renamed TestDocument.txt"),
"Assets/Renamed TestDocument.txt".ToNPath(),
GitFileStatus.Renamed, "Assets/TestDocument.txt".ToNPath(), true),
new GitStatusEntry("Assets/Untracked Document.txt".ToNPath(),
TestBasePath.Combine("Assets/Untracked Document.txt"),
TestRepoPath.Combine("Assets/Untracked Document.txt"),
"Assets/Untracked Document.txt".ToNPath(),
GitFileStatus.Untracked),
}
......@@ -114,7 +114,7 @@ namespace IntegrationTests
[Test]
public void CredentialHelperGetTest()
{
var s = ProcessManager.GetGitCreds(TestBasePath, Environment, FileSystem, GitEnvironment);
var s = ProcessManager.GetGitCreds(TestRepoPath, Environment, FileSystem, GitEnvironment);
s.Should().NotBeNull();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment