public void SetUp()
 {
     var services = new DelegateServiceFactory();
     services.Register<IEchoService>(() => new EchoService());
     tentacle = new HalibutRuntime(services, Certificates.TentacleListening);
     var tentaclePort = tentacle.Listen();
     tentacle.Trust(Certificates.OctopusPublicThumbprint);
     endpoint = new ServiceEndPoint("https://localhost:" + tentaclePort, Certificates.TentacleListeningPublicThumbprint);
     log = new InMemoryConnectionLog(endpoint.ToString());
     HalibutLimits.ConnectionErrorRetryTimeout = TimeSpan.MaxValue;
 }
        public void DisconnectDisposesActiveConnections()
        {
            var serviceEndpoint   = new ServiceEndPoint("https://localhost:42", Certificates.TentacleListeningPublicThumbprint);
            var connectionManager = new ConnectionManager();

            var activeConnection = connectionManager.AcquireConnection(connectionFactory, serviceEndpoint, new InMemoryConnectionLog(serviceEndpoint.ToString()));

            connectionManager.GetActiveConnections(serviceEndpoint).Should().OnlyContain(c => c == activeConnection);

            connectionManager.Disconnect(serviceEndpoint, new InMemoryConnectionLog(serviceEndpoint.ToString()));
            connectionManager.GetActiveConnections(serviceEndpoint).Should().BeNullOrEmpty();
        }
        public SecureClientFixture()
        {
            var services = new DelegateServiceFactory();

            services.Register <IEchoService>(() => new EchoService());
            tentacle = new HalibutRuntime(services, Certificates.TentacleListening);
            var tentaclePort = tentacle.Listen();

            tentacle.Trust(Certificates.OctopusPublicThumbprint);
            endpoint = new ServiceEndPoint("https://localhost:" + tentaclePort, Certificates.TentacleListeningPublicThumbprint);
            log      = new InMemoryConnectionLog(endpoint.ToString());
            HalibutLimits.ConnectionErrorRetryTimeout = TimeSpan.MaxValue;
        }
        public void DisposedConnectionsAreRemovedFromActive_WhenMultipleConnectionsAreActive()
        {
            var serviceEndpoint   = new ServiceEndPoint("https://localhost:42", Certificates.TentacleListeningPublicThumbprint);
            var connectionManager = new ConnectionManager();

            //do it twice because this bug only triggers on multiple enumeration, having 1 in the collection doesn't trigger the bug
            connectionManager.AcquireConnection(connectionFactory, serviceEndpoint, new InMemoryConnectionLog(serviceEndpoint.ToString()));
            connectionManager.AcquireConnection(connectionFactory, serviceEndpoint, new InMemoryConnectionLog(serviceEndpoint.ToString()));

            connectionManager.Disconnect(serviceEndpoint, null);
            connectionManager.GetActiveConnections(serviceEndpoint).Should().BeNullOrEmpty();
        }