public void ChangeRecorderTwice()
        {
            IMethodRecorder recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary());

            MethodRecorderBaseTests.TestMethodRecorder testRecorder = new MethodRecorderBaseTests.TestMethodRecorder();
            using (new RecorderChanger(mocks, recorder, testRecorder))
            {
                Assert.Same(testRecorder, Get.Recorder(mocks));
                MethodRecorderBaseTests.TestMethodRecorder testRecorder2 = new MethodRecorderBaseTests.TestMethodRecorder();
                using (new RecorderChanger(mocks, recorder, testRecorder2))
                {
                    Assert.Same(testRecorder2, Get.Recorder(mocks));
                    testRecorder2.DoRecordCalled = false;
                    recorder.Record(proxy, method, expectation);
                    Assert.True(testRecorder2.DoRecordCalled);
                }
                Assert.Same(testRecorder, Get.Recorder(mocks));
                testRecorder.DoRecordCalled = false;
                recorder.Record(proxy, method, expectation);
                Assert.True(testRecorder.DoRecordCalled);
            }
            Assert.NotSame(testRecorder, Get.Recorder(mocks));
            testRecorder.DoRecordCalled = false;
            recorder.Record(proxy, method, expectation);
            Assert.False(testRecorder.DoRecordCalled);
        }
 public void ChangeRecorderOnCtor()
 {
     IMethodRecorder recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary());
     MethodRecorderBaseTests.TestMethodRecorder testRecorder = new MethodRecorderBaseTests.TestMethodRecorder();
     new RecorderChanger(mocks, recorder, testRecorder);
     recorder.GetAllExpectationsForProxy(new object());
     Assert.IsTrue(testRecorder.DoGetAllExpectationsForProxyCalled);
     Assert.AreSame(testRecorder, Get.Recorder(mocks));
 }
        public void ChangeRecorderOnCtor()
        {
            IMethodRecorder recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary());

            MethodRecorderBaseTests.TestMethodRecorder testRecorder = new MethodRecorderBaseTests.TestMethodRecorder();
            new RecorderChanger(mocks, recorder, testRecorder);
            recorder.GetAllExpectationsForProxy(new object());
            Assert.True(testRecorder.DoGetAllExpectationsForProxyCalled);
            Assert.Same(testRecorder, Get.Recorder(mocks));
        }
 public void ChangeBackOnDispose()
 {
     IMethodRecorder recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary());
     MethodRecorderBaseTests.TestMethodRecorder testRecorder = new MethodRecorderBaseTests.TestMethodRecorder();
     using (new RecorderChanger(mocks, recorder, testRecorder))
     {
         Assert.Same(testRecorder, Get.Recorder(mocks));
     }
     Assert.NotSame(testRecorder, Get.Recorder(mocks));
     testRecorder.DoRecordCalled = false;
     recorder.Record(proxy, method, expectation);
     Assert.False(testRecorder.DoRecordCalled);
 }
 public void ChangeRecorderTwice()
 {
     IMethodRecorder recorder = new UnorderedMethodRecorder(new ProxyMethodExpectationsDictionary());
     MethodRecorderBaseTests.TestMethodRecorder testRecorder = new MethodRecorderBaseTests.TestMethodRecorder();
     using (new RecorderChanger(mocks, recorder, testRecorder))
     {
         Assert.AreSame(testRecorder, Get.Recorder(mocks));
         MethodRecorderBaseTests.TestMethodRecorder testRecorder2 = new MethodRecorderBaseTests.TestMethodRecorder();
         using (new RecorderChanger(mocks, recorder, testRecorder2))
         {
             Assert.AreSame(testRecorder2, Get.Recorder(mocks));
             testRecorder2.DoRecordCalled = false;
             recorder.Record(proxy, method, expectation);
             Assert.IsTrue(testRecorder2.DoRecordCalled);
         }
         Assert.AreSame(testRecorder, Get.Recorder(mocks));
         testRecorder.DoRecordCalled = false;
         recorder.Record(proxy, method, expectation);
         Assert.IsTrue(testRecorder.DoRecordCalled);
     }
     Assert.AreNotSame(testRecorder, Get.Recorder(mocks));
     testRecorder.DoRecordCalled = false;
     recorder.Record(proxy, method, expectation);
     Assert.IsFalse(testRecorder.DoRecordCalled);
 }