Exemplo n.º 1
0
        public void GetClientById_WhenPassedInvalidId_ShouldReturnNull()
        {
            var farm       = ClientFarm.GetTestFarm();
            var clientById = farm.GetClient("whatever");

            clientById.Should().BeNull();
        }
Exemplo n.º 2
0
        public void GetClientById_WhenPassedValidId_ShouldReturnClientWithProperConfiguration()
        {
            var farm       = ClientFarm.GetTestFarm();
            var client     = farm.GetClient();
            var clientById = farm.GetClient(client.EndPointId);

            client.EndPointId.Should().Be(clientById.EndPointId);
        }
Exemplo n.º 3
0
        public void GetClient_WhenCalled_ShouldKickUpUsageCounter()
        {
            var farm = ClientFarm.GetTestFarm();

            var calls = 10;

            for (var i = 0; i < calls; i++)
            {
                farm.GetClient();
            }

            farm.UsageCounter.Should().Be(calls);
        }
        public static ClientFarm GetTestFarm()
        {
            var cf = new ClientFarm
            {
                ClientConfigs = new List <IApiClientConfiguration>
                {
                    new ClientConfiguration {
                        Host = "host1", Port = 1234
                    },
                    new ClientConfiguration {
                        Host = "host2", Port = 1234
                    },
                    new ClientConfiguration {
                        Host = "host3", Port = 1234
                    }
                }
            };


            return(cf);
        }