示例#1
0
        public void DefinedFakeOptionsBuilderMakingStrict(
            Strict fake,
            Exception exception)
        {
            "Given a fake of a type that has an options builder defined that makes the fake strict"
            .x(() => fake = A.Fake <Strict>());

            "When a method is called on the fake"
            .x(() => exception = Record.Exception(() => fake.AMethod()));

            "Then an exception will be thrown"
            .x(() => exception.Should().BeAnExceptionOfType <ExpectationException>());
        }
示例#2
0
        public static void DefinedFakeOptionsBuilderMakingStrict(
            Strict fake,
            Exception exception)
        {
            "Given a type that has an implicit options builder defined"
            .See <Strict>();

            "And the options builder updates the options to make it strict"
            .See <StrictOptionsBuilder>(_ => _.BuildOptions);

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

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

            "Then an exception is thrown"
            .x(() => exception.Should().BeAnExceptionOfType <ExpectationException>());
        }