//[ExpectedException(typeof(AssertFailedException))] protected void any_IFakeServer_should_verified_recived_request() { using (IFakeServer fakeserver = BuildTestingServer()) { fakeserver.ShouldRecived(); fakeserver.CheckAllReciverConditional(); } }
protected void any_IFakeServer_should_stop_without_exception() { IFakeServer fakeserver = BuildTestingServer(); fakeserver.ShouldRecived().Post(REQUEST_SAMPLE_BODY).Response(RESPONSE_SEMPLE_BODY); var response = HttpSender.SendPost(ListenedFakeServerURL, REQUEST_SAMPLE_BODY); Assert.AreEqual(RESPONSE_SEMPLE_BODY, response); fakeserver.CheckAllReciverConditional(); fakeserver.StopServer(); }
public void FakeServer_should_able_to_compare_XML_body_with_different_representation() { const string EXPECTED_XML = "<?xml version=\"1.0\" encoding=\"utf - 8\"?><some-tag>value of some tag</some-tag>"; const string ACTUAL_XML = "<?xml version=\"1.0\" encoding=\"utf - 8\"?>\n" + " <!-- some comment -->\n" + " <some-tag>value of some tag</some-tag>"; fakeserver = new FakeHttpServer(LISTNED_HOST); fakeserver.ShouldRecived(new XMLReciverConditional()).Post(EXPECTED_XML).Response(SUCCESS_RESPONSE); string actualResponse = HttpSender.SendPost(LISTNED_HOST, ACTUAL_XML); Assert.AreEqual(SUCCESS_RESPONSE, actualResponse, "Wrong response"); fakeserver.CheckAllReciverConditional(); }
public void FakeServer_should_able_to_compare_XML_body_with_ignore_some_node() { const string EXPECTED_XML = "<?xml version=\"1.0\" encoding=\"utf - 8\"?>\n" + " <root>\n" + " <some-tag>value of some tag</some-tag>\n" + " <ignored-node>#:={Ignore the node}</ignored-node>" + " </root>"; const string ACTUAL_XML = "<?xml version=\"1.0\" encoding=\"utf - 8\"?>\n" + " <root>\n" + " <ignored-node>some value</ignored-node>\n" + " <some-tag>value of some tag</some-tag>\n" + " </root>"; fakeserver = new FakeHttpServer(LISTNED_HOST); //For this fiture should use XMLWithIgnoreNodeRreciverConditional fakeserver.ShouldRecived(new XMLWithIgnoreNodeRreciverConditional()).Post(EXPECTED_XML).Response(SUCCESS_RESPONSE); string actualResponse = HttpSender.SendPost(LISTNED_HOST, ACTUAL_XML); Assert.AreEqual(SUCCESS_RESPONSE, actualResponse, "Wrong response"); fakeserver.CheckAllReciverConditional(); }