Пример #1
0
        public static void GetAsync_Returns_WithoutJoins()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            Assert.DoesNotThrowAsync(async() => result = await repo.GetAsync(new Brave {
                Id = 1
            }, Connection));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Пример #2
0
        public static void GetAsync_Returns_WithoutJoinsCreatingASessionItself()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            Assert.DoesNotThrowAsync(async() => result = await repo.GetAsync <ISession>(new Brave {
                Id = 1
            }));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Пример #3
0
        public static void GetAsync_Returns_WithoutJoinsWithUnitOfWork()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                Assert.DoesNotThrowAsync(async() => result = await repo.GetAsync(new Brave {
                    Id = 1
                }, uow));
            }
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Пример #4
0
        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);
        }
Пример #5
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);
        }