public virtual void ShouldCallAppropriateUnitOfWorkMethod()
 {
     var uow = Substitute.For<IUnitOfWork>();
     var customer = new Customer(SeqGuid.NewGuid(), new FullName("Test", "Test"));
     customer.AsCreatedIn(uow);
     uow.Received(1).MarkAsCreated(customer as IAggregateRoot);
 }
        public virtual void ShouldDelegateCreateMethodToDataSession()
        {
            var options = new { };

            var customer = new Customer(SeqGuid.NewGuid(), new FullName("Nikita", "Govorov"));

            using (var uow = new UnitOfWork(source))
            {
                uow.MarkAsCreated(customer, options);
            }

            session.Received(1).MarkAsCreated(customer, options);

            session.ClearReceivedCalls();

            Func<Customer> factory = () => customer;

            using (var uow = new UnitOfWork(source))
            {
                uow.MarkAsCreated(factory, options);
            }

            session.Received(1).MarkAsCreated(factory, options);

            session.ClearReceivedCalls();

            using (var uow = new UnitOfWork(source))
            {
                customer.AsCreatedIn(uow);
            }

            session.Received(1).MarkAsCreated(customer as IAggregateRoot);
        }