public static void DeleteByKeyAsync_Removes_EntityOnKeyWithSessionGeneric() { var repo = new BraveRepository(Factory); var result = false; var expected = new Brave() { NewId = 2 }; var resultBrave = new Brave(); Assert.DoesNotThrowAsync(async() => { repo.SaveOrUpdate <ITestSession>(expected); result = await repo.DeleteByKeyAsync <ITestSession>(expected.Id); resultBrave = await repo.GetAsync <ITestSession>(expected); }); Assert.That(result, Is.True); Assert.That(resultBrave, Is.Null); }
public static void DeleteByKeyAsync_Removes_EntityOnKey() { var repo = new BraveRepository(Factory); var result = false; var expected = 2; var resultBrave = new Brave(); Assert.DoesNotThrowAsync(async() => { using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable)) { result = await repo.DeleteByKeyAsync(expected, uow); resultBrave = await repo.GetByKeyAsync(expected, uow); uow.Rollback(); } }); Assert.That(result, Is.True); Assert.That(resultBrave, Is.Null); }