public static void MultipleObservationsShouldNotCauseContextInstantiationToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given a context that may not be established twice".Given(() => sut.ThrowInvalidOperationExceptionOnSecondCall());

            "we expect our first assertion to pass".Then(() => Assert.True(true));
            "we expect the context instantiation not to be repeated for the second assertion".Then(() => Assert.True(true));
        }
        public static void MultipleObservationsShouldNotCauseContextInstantiationToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given a context that may not be established twice".Given(() => sut.ThrowInvalidOperationExceptionOnSecondCall());

            "we expect our first assertion to pass".Then(() => Assert.True(true));
            "we expect the context instantiation not to be repeated for the second assertion".Then(() => Assert.True(true));
        }
        public static void MultipleAssertionsShouldNotCauseContextInstantiationToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given a context instantiation".Given(sut.Call);
            "... that may not be called twice".And(sut.ThrowIfCalledTwice);

            "we expect the context instantiation to be called once".Then(() => Assert.Equal(1, sut.Called));
            "we expect the context instantiation not to be repeated for the second assertion".Then(() => Assert.Equal(1, sut.Called));
        }
        public static void MultipleAssertionsShouldNotCauseContextInstantiationToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given a context instantiation".Given(sut.Call);
            "... that may not be called twice".And(sut.ThrowIfCalledTwice);

            "we expect the context instantiation to be called once".Then(() => Assert.Equal(1, sut.Called));
            "we expect the context instantiation not to be repeated for the second assertion".Then(() => Assert.Equal(1, sut.Called));
        }
        public static void MultipleObservationsShouldNotCauseActionToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given an externally managed context".Given(() => { });
            "when we execute an action on it that may be invoked only once".When(sut.ThrowInvalidOperationExceptionOnSecondCall);

            "we expect our first assertion to pass".Then(() => Assert.True(true));
            "we expect the action not to be repeated for the second assertion".Then(() => Assert.True(true));
        }
        public static void MultipleObservationsShouldNotCauseActionToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given an externally managed context".Given(() => { });
            "when we execute an action on it that may be invoked only once".When(sut.ThrowInvalidOperationExceptionOnSecondCall);

            "we expect our first assertion to pass".Then(() => Assert.True(true));
            "we expect the action not to be repeated for the second assertion".Then(() => Assert.True(true));
        }
        public static void MultipleContextsShouldCauseContextInstantiationToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given a context instantiation"
            .Given(sut.Call);

            "we expect the context instantiation to be called in the first context"
            .Then(() => Assert.Equal(1, sut.Called))
            .InIsolation();

            "we expect the context instantiation to be repeated for the second context"
            .Then(() => Assert.Equal(2, sut.Called))
            .InIsolation();
        }
        public static void MultipleContextsShouldCauseContextInstantiationToBeRepeated()
        {
            var sut = new ContextFixtureSpy();

            "Given a context instantiation"
                .Given(sut.Call);

            "we expect the context instantiation to be called in the first context"
                .Then(() => Assert.Equal(1, sut.Called))
                .InIsolation();

            "we expect the context instantiation to be repeated for the second context"
                .Then(() => Assert.Equal(2, sut.Called))
                .InIsolation();
        }