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

Commit 043d1dc

Browse files
Adding BaseTaskManager test
1 parent e691a65 commit 043d1dc

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

src/tests/IntegrationTests/BasePlatformIntegrationTest.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
using System.IO;
2-
using System.Threading;
32
using System.Threading.Tasks;
43
using GitHub.Unity;
54
using NSubstitute;
65

76
namespace IntegrationTests
87
{
9-
class BasePlatformIntegrationTest : BaseIntegrationTest
8+
class BasePlatformIntegrationTest : BaseTaskManagerTest
109
{
1110
protected IPlatform Platform { get; private set; }
1211
protected IProcessManager ProcessManager { get; private set; }
13-
protected ITaskManager TaskManager { get; private set; }
1412
protected IProcessEnvironment GitEnvironment { get; private set; }
1513
protected IGitClient GitClient { get; set; }
16-
protected SynchronizationContext SyncContext { get; set; }
1714
public ICacheContainer CacheContainer { get; set; }
1815

1916
protected async Task InitializePlatform(NPath repoPath, NPath environmentPath, bool enableEnvironmentTrace)
2017
{
21-
TaskManager = new TaskManager();
22-
SyncContext = new ThreadSynchronizationContext(TaskManager.Token);
23-
TaskManager.UIScheduler = new SynchronizationContextTaskScheduler(SyncContext);
18+
InitializeTaskManager();
2419

2520
CacheContainer = Substitute.For<ICacheContainer>();
2621
Environment = new IntegrationTestEnvironment(CacheContainer, repoPath, SolutionDirectory, environmentPath,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Threading;
2+
using GitHub.Unity;
3+
4+
namespace IntegrationTests
5+
{
6+
class BaseTaskManagerTest : BaseIntegrationTest
7+
{
8+
protected ITaskManager TaskManager { get; private set; }
9+
protected SynchronizationContext SyncContext { get; set; }
10+
11+
protected void InitializeTaskManager()
12+
{
13+
TaskManager = new TaskManager();
14+
SyncContext = new ThreadSynchronizationContext(TaskManager.Token);
15+
TaskManager.UIScheduler = new SynchronizationContextTaskScheduler(SyncContext);
16+
}
17+
}
18+
}

src/tests/IntegrationTests/IntegrationTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
</ItemGroup>
7474
<ItemGroup>
7575
<Compile Include="Auth\LoginTests.cs" />
76+
<Compile Include="BaseTaskManagerTest.cs" />
7677
<Compile Include="Events\RepositoryManagerTests.cs" />
7778
<Compile Include="Events\RepositoryWatcherTests.cs" />
7879
<Compile Include="BaseGitEnvironmentTest.cs" />

src/tests/IntegrationTests/SetUpFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void Setup()
1414

1515
Logging.LogAdapter = new MultipleLogAdapter(
1616
new FileLogAdapter($"..\\{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}-integration-tests.log")
17-
//, new ConsoleLogAdapter()
17+
, new ConsoleLogAdapter()
1818
);
1919
}
2020
}

0 commit comments

Comments
 (0)