示例#1
0
        public static void CallToToStringNotAllowed(
            StrictFakeOptions strictOptions,
            IMyInterface fake,
            Exception exception)
        {
            "Given a strict fake that doesn't allow calls to ToString"
            .x(() => fake = A.Fake <IMyInterface>(options =>
                                                  options.Strict(strictOptions)));

            "When I call ToString on the fake"
            .x(() => exception = Record.Exception(
                   () => fake.ToString()));

            "Then it should throw an exception"
            .x(() => exception.Should().BeAnExceptionOfType <ExpectationException>());
        }
示例#2
0
        public static void CallToToStringAllowed(
            StrictFakeOptions strictOptions,
            IMyInterface fake,
            Exception exception)
        {
            "Given a strict fake that allows calls to ToString"
            .x(() => fake = A.Fake <IMyInterface>(options =>
                                                  options.Strict(strictOptions)));

            "When I call ToString on the fake"
            .x(() => exception = Record.Exception(
                   () => fake.ToString()));

            "Then it shouldn't throw an exception"
            .x(() => exception.Should().BeNull());
        }