public virtual void ShouldThrowExceptionIfDeleteCalledAfterDispose() { Assert.That( () => { var uow = new UnitOfWork(source); ((IDisposable)uow).Dispose(); uow.MarkAsDeleted(new Customer()); }, Throws.Exception.With.Message.EqualTo(string.Format(InteractAfterComplete, false))); Assert.That( () => { var uow = new UnitOfWork(source); ((IDisposable)uow).Dispose(); uow.MarkAsDeleted(new Customer()); }, Throws.Exception.With.Message.EqualTo(string.Format(InteractAfterComplete, false))); Assert.That( () => { var uow = new UnitOfWork(source); ((IDisposable)uow).Dispose(); new Customer().AsDeletedIn(uow); }, Throws.Exception.With.Message.EqualTo(string.Format(InteractAfterComplete, false))); }
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); }