Beispiel #1
0
        public void Should__Call_Persister_Delete_Method_In_Reverse_Order()
        {
            _persister.Stub(a => a.Save(Arg <object> .Is.Anything)).Return(true);
            _persister.Stub(a => a.Delete(Arg <object> .Is.Anything)).Return(true);

            _factory.Define(() => new House {
                Color = "blue", SquareFoot = 50
            });
            _factory.Define(() => new Person()
            {
                FirstName = "Name"
            });
            var house  = _factory.Create <House>();
            var person = _factory.Create <Person>();


            _factory.ClearCreatedObjects();

            _persister.AssertWasCalled(x => x.Delete(person), options => options.Repeat.Once());
            _persister.AssertWasCalled(x => x.Delete(house), options => options.Repeat.Once());
        }