Esempio n. 1
0
            public void Scenario(SuperSubject instance1, SuperSubject instance2)
            {
                "Given an aggregate root with an undefined natural key selector"
                .f(() => { });

                "When two instances of that aggregate root are instantiated"
                .f(() =>
                {
                    instance1 = new SuperSubject();
                    instance2 = new SuperSubject();
                });

                "Then the first instance is not equal to the second instance"
                .f(() => instance1.Should().NotBe(instance2));
            }
Esempio n. 2
0
            public void Scenario(Subject instance1, Subject instance2, string naturalKey)
            {
                "Given an aggregate root with a natural key selector defined in the base class and the subclass"
                .f(() => { });

                "And a natural key value"
                .f(() => naturalKey = "key");

                "When two instances of that aggregate root are instantiated with the subclass natural key value assigned"
                .f(() =>
                {
                    instance1 = new SuperSubject {
                        NaturalKey = "unequalValue", NaturalKey2 = naturalKey
                    };
                    instance2 = new SuperSubject {
                        NaturalKey = "unequalValue2", NaturalKey2 = naturalKey
                    };
                });

                "Then the first instance is equal to the second instance"
                .f(() => instance1.Should().Be(instance2));
            }