Beispiel #1
0
        public void Can_mock_a_request_with_a_stream_body()
        {
            var tmp     = Path.GetTempFileName();
            var payload = "blahblah";

            File.WriteAllText(tmp, payload);
            var message = DreamMessage.FromFile(tmp);
            var uri     = new XUri("http://mock/post/stream");

            MockPlug.Setup(uri).Verb("POST")
            .WithMessage(m => m.ToText() == payload)
            .ExpectAtLeastOneCall();
            var response = Plug.New(uri).Post(message, new Result <DreamMessage>()).Wait();

            response.AssertSuccess();
            MockPlug.VerifyAll(1.Seconds());
        }
Beispiel #2
0
 public void MockPlug_can_verify_call_via_VerifyAll()
 {
     MockPlug.Setup(new XUri("http://mock/foo")).ExpectCalls(Times.AtLeastOnce());
     Assert.IsTrue(Plug.New("http://mock/foo").Get(new Result <DreamMessage>()).Wait().IsSuccessful);
     MockPlug.VerifyAll();
 }