示例#1
0
        public static void GenericFakeOptionsBuilderBuildOptionsForParentType(
            SomeParentClass fake)
        {
            "Given a type with a parameterless constructor"
            .See <SomeParentClass>();

            "And the constructor calls a virtual method"
            .See(() => new SomeParentClass());

            "And the type has a child"
            .See <SomeClass>();

            "And the child has an implicit options builder defined"
            .See <SomeClassOptionsBuilder>();

            "And the options builder extends the generic base"
            .See <SomeClassOptionsBuilder>();

            "And the options builder updates the options to configure the fake"
            .See("SomeClassOptionsBuilder.BuildOptions");     // it's protected

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

            "Then the option builder's configuration is not used during the constructor"
            .x(() => fake.IsConfigured.Should().BeFalse());
        }
示例#2
0
        public void GenericFakeOptionsBuilderBuildOptionsForParentType(
            SomeParentClass fake)
        {
            "When we create a fake of a type whose child has an options builder extending the generic base"
            .x(() => fake = A.Fake <SomeParentClass>());

            "Then the generic build options method will be not used to configure it"
            .x(() => fake.IsConfigured.Should().BeFalse());
        }