Skip to content
Snippets Groups Projects
Commit 2dce98f9 authored by Andreia Gaita's avatar Andreia Gaita
Browse files

Fix test builds

parent 90c32ff5
No related branches found
No related tags found
No related merge requests found
......@@ -66,9 +66,11 @@ Global
{44257C81-EE4A-4817-9AF4-A26C02AA6DD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44257C81-EE4A-4817-9AF4-A26C02AA6DD4}.Release|Any CPU.Build.0 = Release|Any CPU
{69F13D9D-AD56-4EEC-AE10-D528EE23E1A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69F13D9D-AD56-4EEC-AE10-D528EE23E1A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69F13D9D-AD56-4EEC-AE10-D528EE23E1A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69F13D9D-AD56-4EEC-AE10-D528EE23E1A9}.Release|Any CPU.Build.0 = Release|Any CPU
{1AC3F82E-AEAE-4C84-825C-207BB264FCFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1AC3F82E-AEAE-4C84-825C-207BB264FCFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1AC3F82E-AEAE-4C84-825C-207BB264FCFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1AC3F82E-AEAE-4C84-825C-207BB264FCFA}.Release|Any CPU.Build.0 = Release|Any CPU
{7DEF4226-7740-457F-9199-34174C49A978}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
......
......@@ -53,26 +53,26 @@ namespace GitHub.Unity.IntegrationTests
}
environment.GitExecutablePath = gitSetup.GitExecutablePath;
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
var gitClient = new RepositoryLocator(TestGitRepoPath);
environment.Repository = gitClient.GetRepository();
var credentialManager = new WindowsCredentialManager(environment, processManager);
using (var repoManager = new RepositoryManager(TestGitRepoPath, platform, CancellationToken.None))
{
environment.Repository = repoManager.Repository;
string credHelper = null;
var task = new GitConfigGetTask(environment, processManager, null,
"credential.helper", GitConfigSource.NonSpecified,
x =>
{
credHelper = x;
},
null);
var credentialManager = new WindowsCredentialManager(environment, processManager);
await task.RunAsync(CancellationToken.None);
Assert.NotNull(credHelper);
string credHelper = null;
var task = new GitConfigGetTask(environment, processManager,
new TaskResultDispatcher<string>(x =>
{
credHelper = x;
}),
"credential.helper", GitConfigSource.NonSpecified);
await task.RunAsync(CancellationToken.None);
Assert.NotNull(credHelper);
}
//string remoteUrl = null;
//var ret = await GitTask.Run(environment, processManager, "remote get-url origin-http", x => remoteUrl = x);
......
......@@ -22,13 +22,11 @@ namespace GitHub.Unity.IntegrationTests
NPathFileSystemProvider.Current = filesystem;
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
using (var gitclient = new RepositoryLocator(environment.UnityProjectPath))
{
Assert.AreEqual(new NPath(TestGitRepoPath).ToString(), gitclient.RepositoryPath);
}
var repositoryLocator = new RepositoryLocator(environment.UnityProjectPath);
Assert.AreEqual(new NPath(TestGitRepoPath).ToString(), repositoryLocator.RepositoryPath);
}
[Test]
......@@ -56,7 +54,7 @@ namespace GitHub.Unity.IntegrationTests
}
environment.GitExecutablePath = gitSetup.GitExecutablePath;
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
......
......@@ -5,6 +5,7 @@ using FluentAssertions;
using NSubstitute;
using NUnit.Framework;
using GitHub.Unity;
using System.Threading;
namespace IntegrationTests
{
......@@ -18,7 +19,7 @@ namespace IntegrationTests
NPathFileSystemProvider.Current = filesystem;
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
environment.GitExecutablePath = await gitEnvironment.FindGitInstallationPath(processManager);
......@@ -37,7 +38,7 @@ namespace IntegrationTests
NPathFileSystemProvider.Current = filesystem;
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
environment.GitExecutablePath = await gitEnvironment.FindGitInstallationPath(processManager);
......@@ -94,7 +95,7 @@ namespace IntegrationTests
NPathFileSystemProvider.Current = filesystem;
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
environment.GitExecutablePath = await gitEnvironment.FindGitInstallationPath(processManager);
......@@ -119,20 +120,21 @@ namespace IntegrationTests
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
var gitClient = new RepositoryLocator(TestGitRepoPath);
environment.Repository = gitClient.GetRepository();
using (var repoManager = new RepositoryManager(TestGitRepoPath, platform, CancellationToken.None))
{
environment.GitExecutablePath = await gitEnvironment.FindGitInstallationPath(processManager);
environment.GitExecutablePath = await gitEnvironment.FindGitInstallationPath(processManager);
var gitStatus = processManager.GetGitStatus(TestGitRepoPath, environment, filesystem, gitEnvironment);
var gitStatus = processManager.GetGitStatus(TestGitRepoPath, environment, filesystem, gitEnvironment);
gitStatus.AssertEqual(new GitStatus()
{
LocalBranch = "master",
Entries = new List<GitStatusEntry>
gitStatus.AssertEqual(new GitStatus()
{
LocalBranch = "master",
Entries = new List<GitStatusEntry>
{
new GitStatusEntry("Assets/Added Document.txt".ToNPath(),
testRepo.Combine("Assets/Added Document.txt"),
......@@ -149,7 +151,8 @@ namespace IntegrationTests
"Assets/Untracked Document.txt".ToNPath(),
GitFileStatus.Untracked),
}
});
});
}
}
//[Test]
......@@ -159,7 +162,7 @@ namespace IntegrationTests
NPathFileSystemProvider.Current = filesystem;
var environment = new DefaultEnvironment();
environment.UnityProjectPath = TestGitRepoPath;
var platform = new Platform(environment, filesystem);
var platform = new Platform(environment, filesystem, new TestUIDispatcher());
var gitEnvironment = platform.GitEnvironment;
var processManager = new ProcessManager(environment, gitEnvironment);
environment.GitExecutablePath = await gitEnvironment.FindGitInstallationPath(processManager);
......
......@@ -11,6 +11,14 @@ using System.Threading.Tasks;
namespace IntegrationTests
{
class TestUIDispatcher : BaseUIDispatcher
{
protected override void Run(Action<bool> onClose)
{
base.Run(onClose);
}
}
[TestFixture]
class FileSystemWatcherTests : BaseIntegrationTest
{
......@@ -19,7 +27,7 @@ namespace IntegrationTests
{
int expected = 9;
int count = 0;
var platform = new Platform(Environment, FileSystem);
var platform = new Platform(Environment, FileSystem, new TestUIDispatcher());
var watcher = platform.FileSystemWatchFactory.GetOrCreate(TestBasePath, true);
watcher.Created += f =>
......@@ -52,7 +60,7 @@ namespace IntegrationTests
{
int expected = 9;
int count = 0;
var platform = new Platform(Environment, FileSystem);
var platform = new Platform(Environment, FileSystem, new TestUIDispatcher());
var file = TestBasePath.Combine("file.txt").CreateFile();
var watcher = platform.FileSystemWatchFactory.GetOrCreate(file);
......@@ -64,7 +72,7 @@ namespace IntegrationTests
watcher.Changed += f =>
{
Logger.Debug("Changed {0} {1}", f, f.ToNPath().ReadAllText());
Logger.Debug("Changed {0} {1}", f, f.ReadAllText());
count++;
};
......
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