public static void GetKeyAsync_Returns_WithoutJoinsCreatingASessionItself()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            Assert.DoesNotThrow(() => result = repo.GetKeyAsync <ITestSession>(1).Result);
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
        public static void GetKeyAsync_Returns_WithoutJoins()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            Assert.DoesNotThrowAsync(async() => result = await repo.GetKeyAsync(1, Connection));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
        public static void GetKeyAsync_Returns_WithoutJoinsWithUnitOrWork()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                Assert.DoesNotThrowAsync(async() => result = await repo.GetKeyAsync(1, uow));
            }
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
コード例 #4
0
        public static void DeleteKeyAsync_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.DeleteKeyAsync(expected, uow);
                    resultBrave = await repo.GetKeyAsync(expected, uow);
                    uow.Rollback();
                }
            }
                                     );
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }