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

Commit ca3957f

Browse files
Fixing unit tests
1 parent bb2d7f2 commit ca3957f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/tests/UnitTests/Authentication/KeychainTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public void Should_Initialize_When_Cache_Does_Not_Exist()
2323
const string connectionsCachePath = @"c:\UserCachePath\";
2424

2525
var fileSystem = SubstituteFactory.CreateFileSystem();
26+
27+
NPath.FileSystem = fileSystem;
28+
2629
var credentialManager = Substitute.For<ICredentialManager>();
2730

2831
var environment = SubstituteFactory.CreateEnvironment();
@@ -61,6 +64,8 @@ public void Should_Initialize_When_Cache_Invalid()
6164
}
6265
});
6366

67+
NPath.FileSystem = fileSystem;
68+
6469
var environment = SubstituteFactory.CreateEnvironment();
6570
environment.UserCachePath.Returns(info => connectionsCachePath.ToNPath());
6671
environment.FileSystem.Returns(fileSystem);
@@ -101,6 +106,8 @@ public void Should_Initialize_When_Cache_Exists()
101106
}
102107
});
103108

109+
NPath.FileSystem = fileSystem;
110+
104111
var environment = SubstituteFactory.CreateEnvironment();
105112
environment.UserCachePath.Returns(info => connectionsCachePath.ToNPath());
106113
environment.FileSystem.Returns(fileSystem);
@@ -141,6 +148,8 @@ public void Should_Load_From_ConnectionManager()
141148
}
142149
});
143150

151+
NPath.FileSystem = fileSystem;
152+
144153
var environment = SubstituteFactory.CreateEnvironment();
145154
environment.UserCachePath.Returns(info => connectionsCachePath.ToNPath());
146155
environment.FileSystem.Returns(fileSystem);
@@ -199,6 +208,8 @@ public void Should_Delete_From_Cache_When_Load_Returns_Null_From_ConnectionManag
199208
}
200209
});
201210

211+
NPath.FileSystem = fileSystem;
212+
202213
var environment = SubstituteFactory.CreateEnvironment();
203214
environment.UserCachePath.Returns(info => connectionsCachePath.ToNPath());
204215
environment.FileSystem.Returns(fileSystem);
@@ -250,6 +261,8 @@ public void Should_Connect_Set_Credentials_Token_And_Save()
250261

251262
var fileSystem = SubstituteFactory.CreateFileSystem();
252263

264+
NPath.FileSystem = fileSystem;
265+
253266
var environment = SubstituteFactory.CreateEnvironment();
254267
environment.UserCachePath.Returns(info => connectionsCachePath.ToNPath());
255268
environment.FileSystem.Returns(fileSystem);
@@ -334,6 +347,8 @@ public void Should_Connect_Set_Credentials_And_Clear()
334347

335348
var fileSystem = SubstituteFactory.CreateFileSystem();
336349

350+
NPath.FileSystem = fileSystem;
351+
337352
var environment = SubstituteFactory.CreateEnvironment();
338353
environment.UserCachePath.Returns(info => connectionsCachePath.ToNPath());
339354
environment.FileSystem.Returns(fileSystem);

src/tests/UnitTests/SetUpFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void SetUp()
1212
{
1313
//Logging.TracingEnabled = true;
1414

15-
Logging.LogAdapter = new MultipleLogAdapter(new FileLogAdapter($"{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}-unit-tests.log"));
15+
Logging.LogAdapter = new MultipleLogAdapter(new FileLogAdapter($"{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}-unit-tests.log"), new ConsoleLogAdapter());
1616
}
1717
}
1818
}

0 commit comments

Comments
 (0)