diff --git a/CoreRemoting.Tests/RpcTests.cs b/CoreRemoting.Tests/RpcTests.cs index d20c412..cbe9c42 100644 --- a/CoreRemoting.Tests/RpcTests.cs +++ b/CoreRemoting.Tests/RpcTests.cs @@ -679,5 +679,35 @@ void Roundtrip(T payload, int maxSize) where T : class } } } + + [Fact] + public void Authentication_is_taken_into_account() + { + _serverFixture.Server.Config.AuthenticationRequired = true; + try + { + using var client = new RemotingClient(new ClientConfig() + { + ConnectionTimeout = 0, + InvocationTimeout = 0, + SendTimeout = 0, + Channel = ClientChannel, + MessageEncryption = false, + ServerPort = _serverFixture.Server.Config.NetworkPort, + }); + + client.Connect(); + + var proxy = client.CreateProxy(); + var ex = Assert.Throws(() => proxy.Hello()); + + // Session is not authenticated + Assert.Contains("authenticated", ex.Message); + } + finally + { + _serverFixture.Server.Config.AuthenticationRequired = false; + } + } } } \ No newline at end of file diff --git a/CoreRemoting.Tests/Tools/FailingService.cs b/CoreRemoting.Tests/Tools/FailingService.cs index 08e68a2..82aee79 100644 --- a/CoreRemoting.Tests/Tools/FailingService.cs +++ b/CoreRemoting.Tests/Tools/FailingService.cs @@ -4,12 +4,13 @@ namespace CoreRemoting.Tests.Tools; public class FailingService : IFailingService { - public FailingService() - { - throw new NotImplementedException(); - } + public FailingService() + { + Console.WriteLine("FailingService constructor was called!"); + throw new NotImplementedException(); + } - public void Hello() - { - } + public void Hello() + { + } }