public void Should_PostInsertHook_InterfaceHook_Calls_Into_GenericMethod()
        {
            var hook   = new TimestampPostUpdateHook();
            var entity = new TimestampedSoftDeletedEntity();

            ((IHook)hook).Hook(entity, null);
            Assert.AreEqual(DateTimeOffset.UtcNow.Date, entity.LastModificationDateTime.Value.Date);
        }
Beispiel #2
0
        public void Should_PreDeleteHook_Reassign_To_Modified_State()
        {
            var hook     = new SoftDeletePreDeleteHook();
            var metadata = new HookEntityMetadata(EntityState.Deleted);
            var entity   = new TimestampedSoftDeletedEntity();

            hook.Hook(entity, metadata);

            Assert.AreEqual(true, metadata.HasStateChanged);
            Assert.AreEqual(EntityState.Modified, metadata.State);
        }