public void NonHttpImposterRetrieved_ThrowsInvalidProtocolException()
        {
            const int port = 6000;

            MockRequestProxy.Setup(x => x.GetHttpImposter(port)).Returns(new RetrievedHttpImposter {
                Protocol = "Tcp"
            });

            Client.GetHttpImposter(port);
        }
        public async Task NonTcpImposterRetrieved_ThrowsInvalidProtocolException()
        {
            const int port = 6000;

            MockRequestProxy.Setup(x => x.GetTcpImposterAsync(port)).ReturnsAsync(new RetrievedTcpImposter {
                Protocol = "Http"
            });

            await Client.GetTcpImposterAsync(port).ConfigureAwait(false);
        }
        public async Task DeleteAllImposters_RemovesAllImpostersFromCollection()
        {
            MockRequestProxy.Setup(x => x.DeleteAllImpostersAsync()).Returns(Task.CompletedTask);

            Client.Imposters.Add(new HttpImposter(123, null));
            Client.Imposters.Add(new HttpImposter(456, null));

            await Client.DeleteAllImpostersAsync().ConfigureAwait(false);

            Assert.AreEqual(0, Client.Imposters.Count);
        }
        public async Task DeleteAllImposters_CallsDeleteAll()
        {
            MockRequestProxy.Setup(x => x.DeleteAllImpostersAsync()).Returns(Task.CompletedTask);

            Client.Imposters.Add(new HttpImposter(123, null));
            Client.Imposters.Add(new HttpImposter(456, null));

            await Client.DeleteAllImpostersAsync().ConfigureAwait(false);

            MockRequestProxy.Verify(x => x.DeleteAllImpostersAsync(), Times.Once);
        }
        public void DeleteAllImposters_RemovesAllImpostersFromCollection()
        {
            MockRequestProxy.Setup(x => x.DeleteAllImposters());

            Client.Imposters.Add(new HttpImposter(123, null));
            Client.Imposters.Add(new HttpImposter(456, null));

            Client.DeleteAllImposters();

            Assert.AreEqual(0, Client.Imposters.Count);
        }
        public void DeleteAllImposters_CallsDeleteAll()
        {
            MockRequestProxy.Setup(x => x.DeleteAllImposters());

            Client.Imposters.Add(new HttpImposter(123, null));
            Client.Imposters.Add(new HttpImposter(456, null));

            Client.DeleteAllImposters();

            MockRequestProxy.Verify(x => x.DeleteAllImposters(), Times.Once);
        }
        public async Task CallsDelete()
        {
            const int port = 8080;

            Client.Imposters.Add(new HttpImposter(port, null));

            MockRequestProxy.Setup(x => x.DeleteImposterAsync(port)).Returns(Task.CompletedTask);

            await Client.DeleteImposterAsync(port).ConfigureAwait(false);

            MockRequestProxy.Verify(x => x.DeleteImposterAsync(port), Times.Once);
        }
        public void CallsDelete()
        {
            const int port = 8080;

            Client.Imposters.Add(new HttpImposter(port, null));

            MockRequestProxy.Setup(x => x.DeleteImposter(port));

            Client.DeleteImposter(port);

            MockRequestProxy.Verify(x => x.DeleteImposter(port), Times.Once);
        }
        public async Task TcpImposterRetrieved_ReturnsImposter()
        {
            const int port             = 6000;
            var       expectedImposter = new RetrievedTcpImposter
            {
                Port     = port,
                Protocol = "Tcp"
            };

            MockRequestProxy.Setup(x => x.GetTcpImposterAsync(port)).ReturnsAsync(expectedImposter);

            var result = await Client.GetTcpImposterAsync(port).ConfigureAwait(false);

            Assert.AreSame(expectedImposter, result);
        }
        public void HttpImposterRetrieved_ReturnsImposter()
        {
            const int port             = 6000;
            var       expectedImposter = new RetrievedHttpImposter
            {
                Port     = port,
                Protocol = "Http"
            };

            MockRequestProxy.Setup(x => x.GetHttpImposter(port)).Returns(expectedImposter);

            var result = Client.GetHttpImposter(port);

            Assert.AreSame(expectedImposter, result);
        }