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

            Assert.DoesNotThrowAsync(async() =>
            {
                repo.SaveOrUpdate <ITestSession>(expected);
                result      = await repo.DeleteAsync <ITestSession>(expected);
                resultBrave = await repo.GetAsync <ITestSession>(expected);
            }
                                     );
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }
Ejemplo n.º 2
0
        public static void DeleteAsync_Removes_EntityOnKey()
        {
            var repo     = new BraveRepository(Factory);
            var result   = false;
            var expected = new Brave {
                Id = 1
            };
            Brave resultBrave = new Brave();

            Assert.DoesNotThrowAsync(async() =>
            {
                using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
                {
                    result      = await repo.DeleteAsync(expected, uow);
                    resultBrave = await repo.GetAsync(expected, uow);
                    uow.Rollback();
                }
            }
                                     );
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }