Exemplo n.º 1
0
        public static void DeleteByKey_Removes_EntityOnKeyWithSessionGeneric()
        {
            var repo     = new BraveRepository(Factory);
            var result   = false;
            var expected = new Brave()
            {
                NewId = 2
            };
            var resultBrave = new Brave();

            Assert.DoesNotThrow(() =>
            {
                repo.SaveOrUpdate <ITestSession>(expected);
                result      = repo.DeleteByKey <ITestSession>(expected.Id);
                resultBrave = repo.Get <ITestSession>(expected);
            });
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }
Exemplo n.º 2
0
        public static void DeleteByKey_Removes_EntityOnKey()
        {
            var repo        = new BraveRepository(Factory);
            var result      = false;
            var expected    = 2;
            var resultBrave = new Brave();

            Assert.DoesNotThrow(() =>
            {
                using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
                {
                    result      = repo.DeleteByKey(expected, uow);
                    resultBrave = repo.GetByKey(expected, uow);
                    uow.Rollback();
                }
            });
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }