Пример #1
0
        public async Task DefaultSetup(IService service, int count)
        {
            transport = transportBuilder.Construct();
            listener = (SimpleInMemListener)transport.MakeListener(address);
            listener.AddService(service);
            await listener.StartAsync();

            connections = new SimpleInMemConnection[count];

            for (int connectionIndex = 0; connectionIndex < count; connectionIndex++)
            {
                connections[connectionIndex] = (SimpleInMemConnection)await transport.ConnectToAsync(address, System.Threading.CancellationToken.None);
                Assert.IsTrue(connections[connectionIndex].IsConnected);
                Assert.IsTrue(connections[connectionIndex].IsPaired);
            }
        }
        public async Task DefaultSetup(IService service, int count)
        {
            transport = transportBuilder.Construct();
            listener  = (SimpleInMemListener)transport.MakeListener(address);
            listener.AddService(service);
            await listener.StartAsync();

            connections = new SimpleInMemConnection[count];

            for (int connectionIndex = 0; connectionIndex < count; connectionIndex++)
            {
                connections[connectionIndex] = (SimpleInMemConnection)await transport.ConnectToAsync(address, System.Threading.CancellationToken.None);

                Assert.IsTrue(connections[connectionIndex].IsConnected);
                Assert.IsTrue(connections[connectionIndex].IsPaired);
            }
        }
Пример #3
0
        public void AddRemoveService()
        {
            SimpleInMemListener listener = (SimpleInMemListener)transport.MakeListener(address);

            listener.AddService <CalculatorService>(service);

            foreach (var serviceMethod in service.Methods)
            {
                Assert.True(listener.IsRegistered($"{serviceMethod.MethodName}"));
            }

            Assert.False(listener.IsRegistered("Divide"));
            listener.RemoveService <CalculatorService>(service);

            foreach (var serviceMethod in service.Methods)
            {
                Assert.False(listener.IsRegistered($"{serviceMethod.MethodName}"));
            }
            Assert.False(listener.IsRegistered("Divide"));
        }