Ejemplo n.º 1
0
        public void Submit_AllowsNullPort()
        {
            var imposter = new HttpImposter(null, null);

            Client.Submit(imposter);

            MockRequestProxy.Verify(x => x.CreateImposter(It.Is <Imposter>(imp => imp.Port == default(int))), Times.Once);
        }
Ejemplo n.º 2
0
        public async Task Submit_AllowsNullPort()
        {
            var imposter = new HttpImposter(null, null);

            await Client.SubmitAsync(imposter).ConfigureAwait(false);

            MockRequestProxy.Verify(x => x.CreateImposterAsync(It.Is <Imposter>(imp => imp.Port == default(int))), Times.Once);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public void SubmitCollection_ShouldSubmitImpostersUsingProxy()
        {
            const int firstPortNumber  = 123;
            const int secondPortNumber = 456;

            var imposter1 = Client.CreateHttpImposter(firstPortNumber);
            var imposter2 = Client.CreateHttpImposter(secondPortNumber);

            Client.Submit(new[] { imposter1, imposter2 });

            MockRequestProxy.Verify(x => x.CreateImposter(It.Is <Imposter>(imp => imp.Port == firstPortNumber)), Times.Once);
            MockRequestProxy.Verify(x => x.CreateImposter(It.Is <Imposter>(imp => imp.Port == secondPortNumber)), Times.Once);
        }
Ejemplo n.º 8
0
        public void Submit_CallsSubmitOnAllPendingImposters()
        {
            const int firstPortNumber  = 123;
            const int secondPortNumber = 456;

            var imposter1 = new HttpImposter(firstPortNumber, null);
            var imposter2 = new HttpImposter(secondPortNumber, null);

            Client.Submit(new[] { imposter1, imposter2 });

            MockRequestProxy.Verify(x => x.CreateImposter(It.Is <Imposter>(imp => imp.Port == firstPortNumber)), Times.Once);
            MockRequestProxy.Verify(x => x.CreateImposter(It.Is <Imposter>(imp => imp.Port == secondPortNumber)), Times.Once);
        }
Ejemplo n.º 9
0
        public async Task SubmitCollection_ShouldSubmitImpostersUsingProxy()
        {
            const int firstPortNumber  = 123;
            const int secondPortNumber = 456;

            var imposter1 = Client.CreateHttpImposter(firstPortNumber);
            var imposter2 = Client.CreateHttpImposter(secondPortNumber);

            await Client.SubmitAsync(new[] { imposter1, imposter2 }).ConfigureAwait(false);

            MockRequestProxy.Verify(x => x.CreateImposterAsync(It.Is <Imposter>(imp => imp.Port == firstPortNumber)), Times.Once);
            MockRequestProxy.Verify(x => x.CreateImposterAsync(It.Is <Imposter>(imp => imp.Port == secondPortNumber)), Times.Once);
        }
Ejemplo n.º 10
0
        public async Task Submit_CallsSubmitOnAllPendingImposters()
        {
            const int firstPortNumber  = 123;
            const int secondPortNumber = 456;

            var imposter1 = new HttpImposter(firstPortNumber, null);
            var imposter2 = new HttpImposter(secondPortNumber, null);

            await Client.SubmitAsync(new[] { imposter1, imposter2 }).ConfigureAwait(false);

            MockRequestProxy.Verify(x => x.CreateImposterAsync(It.Is <Imposter>(imp => imp.Port == firstPortNumber)), Times.Once);
            MockRequestProxy.Verify(x => x.CreateImposterAsync(It.Is <Imposter>(imp => imp.Port == secondPortNumber)), Times.Once);
        }