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

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

            Client.GetHttpImposter(port);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }