コード例 #1
0
 //[ExpectedException(typeof(AssertFailedException))]
 protected void any_IFakeServer_should_verified_received_request()
 {
     using (IFakeServer fakeserver = BuildTestingServer())
     {
         fakeserver.ShouldReceived();
         fakeserver.CheckAllReceiverConditional();
     }
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        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.ShouldReceived(new XMLReceiverConditional()).Post(EXPECTED_XML).Response(SUCCESS_RESPONSE);

            string actualResponse = HttpSender.SendPost(LISTNED_HOST, ACTUAL_XML);

            Assert.AreEqual(SUCCESS_RESPONSE, actualResponse, "Wrong response");
            fakeserver.CheckAllReceiverConditional();
        }
コード例 #4
0
        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 XMLWithIgnoreNodeRreceiverConditional
            fakeserver.ShouldReceived(new XMLWithIgnoreNodeReceiverConditional()).Post(EXPECTED_XML).Response(SUCCESS_RESPONSE);

            string actualResponse = HttpSender.SendPost(LISTNED_HOST, ACTUAL_XML);

            Assert.AreEqual(SUCCESS_RESPONSE, actualResponse, "Wrong response");
            fakeserver.CheckAllReceiverConditional();
        }