public virtual void ShouldCallAppropriateUnitOfWorkMethod()
 {
     var uow = Substitute.For<IUnitOfWork>();
     var customer = new Customer(SeqGuid.NewGuid(), new FullName("Test", "Test"));
     customer.AsDeletedIn(uow);
     uow.Received(1).MarkAsDeleted(customer as IDeletableEntity);
 }
Ejemplo n.º 2
0
        public virtual void ShouldDelegateDeleteMethodToDataSession()
        {
            var options = new { };

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

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

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

            session.ClearReceivedCalls();

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

            session.Received(1).MarkAsDeleted(customer as IDeletableEntity);
        }