Exemple #1
0
        public static void DefinedFakeOptionsBuilderWrapping(
            WrapsAValidObject fake)
        {
            "Given a type that has an implicit options builder defined"
            .See <WrapsAValidObject>();

            "And the options builder updates the options to wrap an object"
            .See <WrapsAValidObjectOptionsBuilder>(_ => _.BuildOptions);

            "And calls to the wrapped object are to be recorded"
            .See <WrapsAValidObjectOptionsBuilder>(_ => _.BuildOptions);

            "When I create a fake of the type"
            .x(() => fake = A.Fake <WrapsAValidObject>());

            "And I call a method on the fake"
            .x(() => fake.AMethod());

            "Then the call is delegated to the wrapped object"
            .x(() => A.CallTo(() => WrapsAValidObjectOptionsBuilder.WrappedObject.AMethod()).MustHaveHappened());

#if FEATURE_SELF_INITIALIZED_FAKES
            "And the call is recorded"
            .x(() =>
            {
                A.CallTo(() => WrapsAValidObjectOptionsBuilder.Recorder.RecordCall(A <ICompletedFakeObjectCall> ._))
                .MustHaveHappened();
            });
#endif
        }
Exemple #2
0
        public static void DefinedFakeOptionsBuilderWrapping(
            WrapsAValidObject fake)
        {
            "Given a type that has an implicit options builder defined"
            .See <WrapsAValidObject>();

            "And the options builder updates the options to wrap an object"
            .See <WrapsAValidObjectOptionsBuilder>(_ => _.BuildOptions);

            "When I create a fake of the type"
            .x(() => fake = A.Fake <WrapsAValidObject>());

            "And I call a method on the fake"
            .x(() => fake.AMethod());

            "Then the call is delegated to the wrapped object"
            .x(() => WrapsAValidObjectOptionsBuilder.WrappedObject.WasCalled.Should().BeTrue());
        }
Exemple #3
0
        public void DefinedFakeOptionsBuilderWrapping(
            WrapsAValidObject fake)
        {
            "When a fake is created for a type that has an options builder defined"
            .x(() => fake = A.Fake <WrapsAValidObject>());

            "Then the fake will wrap the configured target"
            .x(() =>
            {
                fake.AMethod();
                A.CallTo(() => WrapsAValidObjectOptionsBuilder.WrappedObject.AMethod()).MustHaveHappened();
            });

            "And calls will be forwarded to the recorder"
            .x(() =>
            {
                A.CallTo(
                    () => WrapsAValidObjectOptionsBuilder.Recorder.RecordCall(A <ICompletedFakeObjectCall> ._))
                .MustHaveHappened();
            });
        }