-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
271 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
namespace CoreRemoting.Tests.Tools | ||
namespace CoreRemoting.Tests.Tools; | ||
|
||
public class FactoryService : IFactoryService | ||
{ | ||
public class FactoryService : IFactoryService | ||
public ITestService GetTestService() | ||
{ | ||
public ITestService GetTestService() | ||
{ | ||
return new TestService(); | ||
} | ||
return new TestService(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
using System; | ||
using CoreRemoting.Authentication; | ||
|
||
namespace CoreRemoting.Tests.Tools | ||
namespace CoreRemoting.Tests.Tools; | ||
|
||
public class FakeAuthProvider : IAuthenticationProvider | ||
{ | ||
public class FakeAuthProvider : IAuthenticationProvider | ||
public Func<Credential[], bool> AuthenticateFake { get; set; } | ||
|
||
public bool Authenticate(Credential[] credentials, out RemotingIdentity authenticatedIdentity) | ||
{ | ||
public Func<Credential[], bool> AuthenticateFake { get; set; } | ||
|
||
public bool Authenticate(Credential[] credentials, out RemotingIdentity authenticatedIdentity) | ||
{ | ||
var success = AuthenticateFake?.Invoke(credentials) ?? true; | ||
var success = AuthenticateFake?.Invoke(credentials) ?? true; | ||
|
||
authenticatedIdentity = | ||
new RemotingIdentity() | ||
{ | ||
AuthenticationType = "Fake", | ||
Domain = "domain", | ||
IsAuthenticated = success, | ||
Name = credentials[0].Value, | ||
Roles = ["Test"], | ||
}; | ||
authenticatedIdentity = | ||
new RemotingIdentity() | ||
{ | ||
AuthenticationType = "Fake", | ||
Domain = "domain", | ||
IsAuthenticated = success, | ||
Name = credentials[0].Value, | ||
Roles = ["Test"], | ||
}; | ||
|
||
return success; | ||
} | ||
return success; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
namespace CoreRemoting.Tests.Tools | ||
namespace CoreRemoting.Tests.Tools; | ||
|
||
public interface IFactoryService | ||
{ | ||
public interface IFactoryService | ||
{ | ||
ITestService GetTestService(); | ||
} | ||
ITestService GetTestService(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
using System.Threading.Tasks; | ||
using System; | ||
|
||
namespace CoreRemoting.Tests.Tools | ||
namespace CoreRemoting.Tests.Tools; | ||
|
||
public interface ISessionAwareService | ||
{ | ||
public interface ISessionAwareService | ||
{ | ||
bool HasSameSessionInstance { get; } | ||
bool HasSameSessionInstance { get; } | ||
|
||
string ClientAddress { get; } | ||
string ClientAddress { get; } | ||
|
||
Task Wait(double seconds); | ||
Task Wait(double seconds); | ||
|
||
Task CloseSession(double seconds); | ||
} | ||
Task CloseSession(double seconds); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace CoreRemoting.Tests.Tools | ||
namespace CoreRemoting.Tests.Tools; | ||
|
||
internal class SessionAwareService : ISessionAwareService | ||
{ | ||
internal class SessionAwareService : ISessionAwareService | ||
public SessionAwareService() | ||
{ | ||
public SessionAwareService() | ||
{ | ||
CurrentSession = RemotingSession.Current; | ||
if (CurrentSession == null) | ||
throw new ArgumentNullException(nameof(CurrentSession)); | ||
CurrentSession = RemotingSession.Current; | ||
if (CurrentSession == null) | ||
throw new ArgumentNullException(nameof(CurrentSession)); | ||
|
||
if (CurrentSession.ClientAddress == null) | ||
throw new ArgumentNullException(nameof(CurrentSession.ClientAddress)); | ||
Console.WriteLine(CurrentSession.ClientAddress); | ||
} | ||
if (CurrentSession.ClientAddress == null) | ||
throw new ArgumentNullException(nameof(CurrentSession.ClientAddress)); | ||
Console.WriteLine(CurrentSession.ClientAddress); | ||
} | ||
|
||
public RemotingSession CurrentSession { get; } | ||
public RemotingSession CurrentSession { get; } | ||
|
||
public bool HasSameSessionInstance => | ||
ReferenceEquals(CurrentSession, RemotingSession.Current); | ||
public bool HasSameSessionInstance => | ||
ReferenceEquals(CurrentSession, RemotingSession.Current); | ||
|
||
public string ClientAddress => | ||
CurrentSession.ClientAddress; | ||
public string ClientAddress => | ||
CurrentSession.ClientAddress; | ||
|
||
public async Task Wait(double seconds) => | ||
await Task.Delay(TimeSpan.FromSeconds(seconds)); | ||
public async Task Wait(double seconds) => | ||
await Task.Delay(TimeSpan.FromSeconds(seconds)); | ||
|
||
public async Task CloseSession(double seconds) | ||
{ | ||
RemotingSession.Current.Close(); | ||
await Wait(seconds); | ||
} | ||
public async Task CloseSession(double seconds) | ||
{ | ||
RemotingSession.Current.Close(); | ||
await Wait(seconds); | ||
} | ||
} |
Oops, something went wrong.