Esempio n. 1
0
        public void Default_uri_keeps_working_as_no_op_after_DeregisterAll()
        {
            MockPlug.DeregisterAll();
            var msg = Plug.New(MockPlug.DefaultUri).Get();

            Assert.AreEqual("empty", msg.ToDocument().Name);
        }
Esempio n. 2
0
        public void DeregisterAll_clears_all_mocks()
        {
            int  firstCalled = 0;
            XUri uri         = new XUri("http://www.mindtouch.com/foo");

            MockPlug.Register(uri, delegate(Plug p, string v, XUri u, DreamMessage r, Result <DreamMessage> r2) {
                firstCalled++;
                r2.Return(DreamMessage.Ok());
            });
            MockPlug.Register(new XUri("http://www.mindtouch.com/bar"), delegate(Plug p, string v, XUri u, DreamMessage r, Result <DreamMessage> r2) {
                r2.Return(DreamMessage.Ok());
            });
            Assert.IsTrue(Plug.New(uri).GetAsync().Wait().IsSuccessful);
            Assert.AreEqual(1, firstCalled);
            MockPlug.DeregisterAll();
            int secondCalled = 0;

            MockPlug.Register(uri, delegate(Plug p, string v, XUri u, DreamMessage r, Result <DreamMessage> r2) {
                secondCalled++;
                r2.Return(DreamMessage.Ok());
            });
            MockPlug.Register(new XUri("http://www.mindtouch.com/bar"), delegate(Plug p, string v, XUri u, DreamMessage r, Result <DreamMessage> r2) {
                r2.Return(DreamMessage.Ok());
            });
            Assert.IsTrue(Plug.New(uri).GetAsync().Wait().IsSuccessful);
            Assert.AreEqual(1, firstCalled);
            Assert.AreEqual(1, secondCalled);
        }
Esempio n. 3
0
 public void Teardown()
 {
     MockPlug.DeregisterAll();
 }
Esempio n. 4
0
 public void PerTestCleanup()
 {
     MockPlug.DeregisterAll();
 }