Exemplo n.º 1
0
        public static void GetKey_Returns_WithoutJoinsCreatingASessionItself()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            Assert.DoesNotThrow(() => result = repo.GetByKey <ITestSession>(1));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Exemplo n.º 2
0
        public static void GetKey_Returns_WithoutJoins()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            Assert.DoesNotThrow(() => result = repo.GetByKey(1, Connection));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Exemplo n.º 3
0
        public static void GetKey_Returns_WithoutJoinsWithUnitOfWork()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                Assert.DoesNotThrow(() => result = repo.GetByKey(1, uow));
            }
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Exemplo n.º 4
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);
        }