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

            Assert.DoesNotThrow(() => result = repo.GetKey(1, Connection));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
        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.GetKey(1, uow));
            }
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Exemplo n.º 3
0
        public static void DeleteKey_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.DeleteKey(expected, uow);
                    resultBrave = repo.GetKey(expected, uow);
                    uow.Rollback();
                }
            }
                                );
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }