Exemplo n.º 1
0
        public GetUserMock StartServer()
        {
            Server = FluentMockServer.Start(new FluentMockServerSettings {
                Urls = new[] { this._host }, StartAdminInterface = true
            });
            Server.Reset();

            ExpectedResponse = new GetUser.Response
            {
                UserId    = "06e4e0c9-f244-4526-b3fb-01301b9cc4bb",
                FirstName = "John",
                LastName  = "Smith",
                Email     = "*****@*****.**",
                SSN       = 123121234,
                Address   = "123 Main Street",
                City      = "Atlanta",
                StateId   = 10,
                Zip       = 90024
            };

            Server.Given(Request.Create().UsingPost().WithPath(this._getUrl()).WithBody(new JsonMatcher(
                                                                                            new
            {
                UserId    = _userId,
                AccountId = _accountId
            }))).RespondWith(Response.Create().WithBodyAsJson(ExpectedResponse));
            return(this);
        }
Exemplo n.º 2
0
 public async void Should_reset_requestlogs()
 {
     // given
     _server = FluentMockServer.Start();
     // when
     await new HttpClient().GetAsync("http://localhost:" + _server.Port + "/foo");
     _server.Reset();
     // then
     Check.That(_server.RequestLogs).IsEmpty();
 }
        public void BeforeEach()
        {
            mockServer.Reset();

            mockServer
            .Given(Request.Create().WithPath("/PCCIS/V1/WorkFile").UsingPost())
            .RespondWith(Response.Create()
                         .WithSuccess()
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"fileId\":\"fake-file-id\"}"));
        }
Exemplo n.º 4
0
        public async Task GetAllReturnsNullIfNotModified()
        {
            var etag = @"""abc123"""; // note that etag strings must be quoted

            _server.Given(Request.Create().UsingGet())
            .RespondWith(Response.Create().WithStatusCode(200).WithHeader("Etag", etag).WithBody(AllDataJson));
            var result1 = await _requestor.GetAllDataAsync();

            _server.Reset();
            _server.Given(Request.Create().UsingGet().WithHeader("If-None-Match", etag))
            .RespondWith(Response.Create().WithStatusCode(304));
            var result2 = await _requestor.GetAllDataAsync();

            Assert.NotNull(result1);
            Assert.Null(result2);
        }
        public void BeforeEach()
        {
            mockServer.Reset();

            mockServer
            .Given(Request.Create().WithPath("/PCCIS/V1/WorkFile").UsingPost())
            .RespondWith(Response.Create()
                         .WithSuccess()
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"fileId\":\"fake-file-id\"}"));

            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(200)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"processId\":\"fake-process-id\",\"expirationDateTime\":\"2020-01-06T16:50:45.637Z\",\"state\":\"processing\",\"percentComplete\":0}"));
        }
Exemplo n.º 6
0
        public void BeforeEach()
        {
            mockServer.Reset();

            mockServer
            .Given(Request.Create().WithPath("/PCCIS/V1/WorkFile").UsingPost())
            .RespondWith(Response.Create()
                         .WithSuccess()
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"fileId\":\"fake-file-id\"}"));

            mockServer
            .Given(Request.Create().WithPath("/v2/contentConverters").UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(480)
                         .WithHeader("Content-Type", "application/json")
                         .WithBody("{\"errorCode\":\"MultipleSourcesAreNotSupportedForThisDestinationFormat\",\"errorDetails\":{\"in\":\"body\",\"at\":\"input.sources\"}}"));
        }
Exemplo n.º 7
0
        public async void Should_reset_routes()
        {
            // given
            _server = FluentMockServer.Start();

            _server
            .Given(
                Requests
                .WithUrl("/foo")
                .UsingGet())
            .RespondWith(
                Responses
                .WithStatusCode(200)
                .WithBody(@"{ msg: ""Hello world!""}")
                );

            // when
            _server.Reset();

            // then
            Check.ThatAsyncCode(() => new HttpClient().GetStringAsync("http://localhost:" + _server.Port + "/foo"))
            .ThrowsAny();
        }
Exemplo n.º 8
0
        public BeginDecisionMock StartServer()
        {
            Server = FluentMockServer.Start(new FluentMockServerSettings {
                Urls = new[] { this._host }, StartAdminInterface = true
            });
            Server.Reset();

            ExpectedResponse = new BeginDecision.Response
            {
                Message      = "Message from response",
                NoticeType   = "ACCEPTED",
                UserId       = "06e4e0c9-f244-4526-b3fb-01301b9cc4bb",
                AccountId    = 321,
                DecisionMade = "Declined"
            };

            Server.Given(Request.Create().UsingPost().WithPath(this._getUrl()).WithBody(new JsonMatcher(
                                                                                            new
            {
                DecisionId = _decisionId,
                Decision   = _decision
            }))).RespondWith(Response.Create().WithBodyAsJson(ExpectedResponse));
            return(this);
        }
Exemplo n.º 9
0
 public void ResetServer()
 {
     MockServer.Reset();
 }
Exemplo n.º 10
0
 public void BeforeEach()
 {
     mockServer.Reset();
 }
Exemplo n.º 11
0
        public async void Should_reset_requestlogs()
        {
            // given
            _server = FluentMockServer.Start();
            // when
            await new HttpClient().GetAsync("http://localhost:" + _server.Port + "/foo");
            _server.Reset();
            // then
            Check.That(_server.RequestLogs).IsEmpty();

        }
Exemplo n.º 12
0
        public async void Should_reset_routes()
        {
            // given
            _server = FluentMockServer.Start();

            _server
                .Given(
                    Requests
                        .WithUrl("/foo")
                        .UsingGet())
                .RespondWith(
                    Responses
                        .WithStatusCode(200)
                        .WithBody(@"{ msg: ""Hello world!""}")
                    );

            // when
            _server.Reset();

            // then
            Check.ThatAsyncCode(() => new HttpClient().GetStringAsync("http://localhost:" + _server.Port + "/foo"))
                .ThrowsAny();
        }
 protected void TearDown()
 {
     _mockServer.Reset();
 }
 public void Dispose()
 {
     _postsServer.Reset();
 }
Exemplo n.º 15
0
 public void Dispose()
 {
     _usersServer.Reset();
 }