Exemplo n.º 1
0
        public static void GettingUnconfiguredUnfakeableProperty(
            IHaveInterestingProperties subject,
            UnfakeableClass firstValue,
            UnfakeableClass secondValue)
        {
            "establish"
            .x(() => subject = A.Fake <IHaveInterestingProperties>());

            "when getting the value of an unconfigured unfakeable property"
            .x(() =>
            {
                firstValue  = subject.UnfakeableProperty;
                secondValue = subject.UnfakeableProperty;
            });

            "it should not return null if dummy can be made"
            .x(() => firstValue.Should().NotBeNull());

            "it should return the same instance on a subsequent get"
            .x(() => secondValue.Should().BeSameAs(firstValue));
        }
Exemplo n.º 2
0
        public void GettingUnconfiguredUnfakeableProperty(
            IHaveInterestingProperties subject,
            UnfakeableClass firstValue,
            UnfakeableClass secondValue)
        {
            "establish"
                .x(() => subject = A.Fake<IHaveInterestingProperties>());

            "when getting the value of an unconfigured unfakeable property"
                .x(() =>
                    {
                        firstValue = subject.UnfakeableProperty;
                        secondValue = subject.UnfakeableProperty;
                    });

            "it should not return null if dummy can be made"
                .x(() => firstValue.Should().NotBeNull());

            "it should return the same instance on a subsequent get"
                .x(() => secondValue.Should().BeSameAs(firstValue));
        }
Exemplo n.º 3
0
        public static void GettingUnconfiguredPropertyOfUnfakeableType(
            IHaveInterestingProperties subject,
            UnfakeableClass firstGetResult,
            UnfakeableClass secondGetResult)
        {
            "Given a Fake with a property whose type is unfakeable"
            .x(() => subject = A.Fake <IHaveInterestingProperties>());

            "And the property type can be made into a Dummy"
            .x(() => { });     // see UnfakeableClass

            "When I get the value of the property"
            .x(() => firstGetResult = subject.UnfakeableProperty);

            "And I get the value of the property again"
            .x(() => secondGetResult = subject.UnfakeableProperty);

            "Then the property does not return null if a Dummy can be made"
            .x(() => firstGetResult.Should().NotBeNull());

            "And the property returns the same instance when called again"
            .x(() => secondGetResult.Should().BeSameAs(firstGetResult));
        }
        public static void GettingUnconfiguredPropertyOfUnfakeableType(
            IHaveInterestingProperties subject,
            UnfakeableClass firstGetResult,
            UnfakeableClass secondGetResult)
        {
            "Given a Fake with a property whose type is unfakeable"
                .x(() => subject = A.Fake<IHaveInterestingProperties>());

            "And the property type can be made into a Dummy"
                .x(() => { }); // see UnfakeableClass

            "When I get the value of the property"
                .x(() => firstGetResult = subject.UnfakeableProperty);

            "And I get the value of the property again"
                .x(() => secondGetResult = subject.UnfakeableProperty);

            "Then the property does not return null if a Dummy can be made"
                .x(() => firstGetResult.Should().NotBeNull());

            "And the property returns the same instance when called again"
                .x(() => secondGetResult.Should().BeSameAs(firstGetResult));
        }