コード例 #1
0
ファイル: StrictFakeSpecs.cs プロジェクト: Potapy4/FakeItEasy
        public static void CallToGetHashCodeNotAllowed(
            StrictFakeOptions strictOptions,
            IMyInterface fake,
            Exception exception)
        {
            "Given a strict fake that doesn't allow calls to GetHashCode"
            .x(() => fake = A.Fake <IMyInterface>(options =>
                                                  options.Strict(strictOptions)));

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

            "Then it should throw an exception"
            .x(() => exception.Should().BeAnExceptionOfType <ExpectationException>());
        }
コード例 #2
0
ファイル: StrictFakeSpecs.cs プロジェクト: Potapy4/FakeItEasy
        public static void CallToGetHashCodeAllowed(
            StrictFakeOptions strictOptions,
            IMyInterface fake,
            Exception exception)
        {
            "Given a strict fake that allows calls to GetHashCode"
            .x(() => fake = A.Fake <IMyInterface>(options =>
                                                  options.Strict(strictOptions)));

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

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