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

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

            Assert.DoesNotThrow(() => result = repo.Get(new Brave {
                Id = 1
            }, Connection));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
        public static void Get_Returns_WithoutJoinsAndUnitOfWork()
        {
            var   repo   = new BraveRepository(Factory);
            Brave result = null;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                Assert.DoesNotThrow(() => result = repo.Get(new Brave {
                    Id = 1
                }, uow));
            }
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Id, Is.EqualTo(1));
        }
Esempio n. 4
0
        public static void DeleteKey_Removes_EntityOnKeyWithSessionGeneric()
        {
            var repo     = new BraveRepository(Factory);
            var result   = false;
            var expected = new Brave {
                NewId = 2
            };
            var resultBrave = new Brave();

            Assert.DoesNotThrow(() =>
            {
                repo.SaveOrUpdate <ITestSession>(expected);
                result      = repo.DeleteKey <ITestSession>(expected.Id);
                resultBrave = repo.Get <ITestSession>(expected);
            });
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }
Esempio n. 5
0
        public static void Delete_Removes_EntityOnKey()
        {
            var repo     = new BraveRepository(Factory);
            var result   = false;
            var expected = new Brave {
                Id = 1
            };
            Brave resultBrave = new Brave();

            Assert.DoesNotThrow(() =>
            {
                using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
                {
                    result      = repo.Delete(expected, uow);
                    resultBrave = repo.Get(expected, uow);
                    uow.Rollback();
                }
            }
                                );
            Assert.That(result, Is.True);
            Assert.That(resultBrave, Is.Null);
        }