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); }
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\"}")); }
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}")); }
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\"}}")); }
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(); }
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); }
public void ResetServer() { MockServer.Reset(); }
public void BeforeEach() { mockServer.Reset(); }
protected void TearDown() { _mockServer.Reset(); }
public void Dispose() { _postsServer.Reset(); }
public void Dispose() { _usersServer.Reset(); }