public void RecordMethodsAndReplayThemInSameOrder()
        {
            OrderedMethodRecorder recorder = new OrderedMethodRecorder(new ProxyMethodExpectationsDictionary());
            recorder.Record(this.demo, this.voidNoArgs, expectationOne);
            recorder.Record(this.demo, voidThreeArgs, new AnyArgsExpectation(new FakeInvocation(voidThreeArgs), new Range(1, 1)));

            Assert.IsNotNull(recorder.GetRecordedExpectation(new FakeInvocation(voidNoArgs), this.demo, this.voidNoArgs, new object[0]));
            Assert.IsNotNull(recorder.GetRecordedExpectation(new FakeInvocation(voidNoArgs), this.demo, this.voidThreeArgs, new object[0]));
        }
        public void RecordMethodsAndReplayThemOutOfOrder()
        {
            OrderedMethodRecorder recorder = new OrderedMethodRecorder(new ProxyMethodExpectationsDictionary());
            recorder.Record(this.demo, this.voidNoArgs, expectationOne);
            recorder.Record(this.demo, this.voidThreeArgs, expectationOne);

            Assert.NotNull(recorder.GetRecordedExpectation(new FakeInvocation(this.voidNoArgs), this.demo, this.voidNoArgs, new object[0]));
            Assert.Throws<ExpectationViolationException>(
                "Unordered method call! The expected call is: 'Ordered: { IDemo.VoidNoArgs(); }' but was: 'IDemo.VoidNoArgs();'",
                () =>
                recorder.GetRecordedExpectation(new FakeInvocation(this.voidNoArgs), this.demo, this.voidNoArgs, new object[0]));
        }
        public void RecordMethodsAndReplayThemOutOfOrder_WillUseMessage()
        {
            OrderedMethodRecorder recorder = new OrderedMethodRecorder(new ProxyMethodExpectationsDictionary());
            expectationOne.Message = "Test Message";
            recorder.Record(this.demo, this.voidNoArgs, expectationOne);
            recorder.Record(this.demo, this.voidThreeArgs, expectationOne);

            Assert.IsNotNull(recorder.GetRecordedExpectation(new FakeInvocation(this.voidNoArgs), this.demo, this.voidNoArgs, new object[0]));
            recorder.GetRecordedExpectation(new FakeInvocation(this.voidNoArgs), this.demo, this.voidNoArgs, new object[0]);
        }
        public void RecordMethodsAndReplayThemOutOfOrder_WillUseMessage()
        {
            OrderedMethodRecorder recorder = new OrderedMethodRecorder(new ProxyMethodExpectationsDictionary());
            expectationOne.Message = "Test Message";
            recorder.Record(this.demo, this.voidNoArgs, expectationOne);
            recorder.Record(this.demo, this.voidThreeArgs, expectationOne);

            Assert.NotNull(recorder.GetRecordedExpectation(new FakeInvocation(this.voidNoArgs), this.demo, this.voidNoArgs, new object[0]));
            var ex = Assert.Throws<ExpectationViolationException>(() =>
                                                                  recorder.GetRecordedExpectation(new FakeInvocation(this.voidNoArgs), this.demo, this.voidNoArgs, new object[0]));
            Assert.Equal("Unordered method call! The expected call is: 'Ordered: { Message: Test Message\nIDemo.VoidNoArgs(); }' but was: 'IDemo.VoidNoArgs();'", ex.Message);
        }