protected void any_IFakeServer_should_stop_without_exception() { IFakeServer fakeserver = BuildTestingServer(); fakeserver.ShouldReceived().Post(REQUEST_SAMPLE_BODY).Response(RESPONSE_SEMPLE_BODY); var response = HttpSender.SendPost(ListenedFakeServerURL, REQUEST_SAMPLE_BODY); Assert.AreEqual(RESPONSE_SEMPLE_BODY, response); fakeserver.CheckAllReceiverConditional(); fakeserver.StopServer(); }
protected void any_IFakeServer_should_return_deffault_message_for_no_mathced_requests() { IFakeServer fakeserver = BuildTestingServer(); fakeserver.ShouldReceived(); string actualDeffaultMessage = HttpSender.SendPost(ListenedFakeServerURL, REQUEST_SAMPLE_BODY); Assert.AreEqual(AFakeServer.DEFAULT_RESPONSE_BODY, actualDeffaultMessage, "Wrong DeffaultMessage"); try { fakeserver.StopServer(); } catch (Exception) { //Сервер должен сказать что не все запросы пришли. Но в данном тесте это не проверяется. } }
protected void any_IFakeServer_should_able_to_get_history_of_ricivers_messages() { IFakeServer fakeserver = BuildTestingServer(); fakeserver.ShouldReceived(); HttpSender.SendPost(ListenedFakeServerURL, REQUEST_SAMPLE_BODY); string[] actualReceiveMessages = fakeserver.GetReceiveHistory(); Assert.AreEqual(1, actualReceiveMessages.Length, "Wrong count of element for array was returned by method GetReceiveHistory"); Assert.AreEqual(REQUEST_SAMPLE_BODY, actualReceiveMessages[0], "Wrong content of element for array was returned by method GetReceiveHistory"); try { fakeserver.StopServer(); } catch (Exception) { //Сервер должен сказать что не все запросы пришли. Но в данном тесте это не проверяется. } }
public void ShoutDownServer() { fakeserver.StopServer(); }