Exemplo n.º 1
0
            public void CanAddSimpleObject()
            {
                var fixture = new InMemorySetFixture();

                var obj = new Address();
                fixture.InMemorySet.Add(obj);

                Assert.Equal(1, fixture.InMemorySet.Items.Count);
                Assert.Equal(obj, fixture.InMemorySet.Items.First());
            }
Exemplo n.º 2
0
            public void InvokesIdGeneratorForAllObjectsInGraph()
            {
                var person = new Person();
                var address = new Address();
                person.Address = address;

                var fixture = new InMemorySetFixture();

                fixture.InMemorySet.Add(person);

                fixture.IdGenerator.Received(1).Identify(person);
                fixture.IdGenerator.Received(1).Identify(address);
            }
Exemplo n.º 3
0
            public void CanAddNestedObject()
            {
                var fixture = new InMemorySetFixture();

                var person = new Person();
                var address = new Address();
                person.Address = address;

                fixture.InMemorySet.Add(person);

                Assert.Equal(person, fixture.InMemorySet.Items.Single());
                Assert.Equal(address, fixture.Cache.For(typeof (Address)).Items.Single());
            }
Exemplo n.º 4
0
            public void InvokesMaterializationHook()
            {
                var address = new Address();
                var person = new Person
                    {
                        Address = address
                    };

                var fixture = new InMemorySetFixture();
                var hook = Substitute.For<IMaterializationHook>();

                fixture.MaterializationHooks.Add(hook);

                fixture.InMemorySet.Add(person);

                hook.Received(1).Execute(person);
                hook.Received(1).Execute(address);
            }