public static void GetAllITestSession_Returns_CorrectAmountCreatingASessionItself()
        {
            var repo = new BraveRepository(Factory);
            IEnumerable <Brave> results = null;

            Assert.DoesNotThrow(() => results = repo.GetAll <ITestSession>());
            Assert.That(results, Is.Not.Null);
            Assert.That(results, Is.Not.Empty);
            results.Should().HaveCount(x => x > 0);
        }
        public static void GetAll_Returns_CorrectAmountWithoutJoins()
        {
            var repo = new BraveRepository(Factory);
            IEnumerable <Brave> results = null;

            Assert.DoesNotThrow(() => results = repo.GetAll(Connection));
            Assert.That(results, Is.Not.Null);
            Assert.That(results, Is.Not.Empty);
            results.Should().HaveCount(x => x > 0);
        }
        public static void GetAll_Returns_CorrectAmountWithoutJoinsWithUnitOfWork()
        {
            var repo = new BraveRepository(Factory);
            IEnumerable <Brave> results = null;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                Assert.DoesNotThrow(() => results = repo.GetAll(uow));
            }
            Assert.That(results, Is.Not.Null);
            Assert.That(results, Is.Not.Empty);
            results.Should().HaveCount(x => x > 0);
        }
        public static void _3_SaveOrUpdateAsync_Returns_IdForInsertedEnitiyCreatesOwnUnitOfWork()
        {
            var repo     = new BraveRepository(Factory);
            var expected = new Brave
            {
                NewId = 1
            };
            var result = 0;
            var maxId  = repo.GetAll <ITestSession>().Max(x => x.Id);

            Assert.DoesNotThrowAsync(async() => result = await repo.SaveOrUpdateAsync <ITestSession>(expected));
            Assert.That(result, Is.EqualTo(++maxId));
        }
        public static void _3_SaveOrUpdateAsync_Returns_IdForInsertedEnitiy()
        {
            var repo     = new BraveRepository(Factory);
            var expected = new Brave
            {
                NewId = 1
            };
            var result = 0;
            int maxId;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                maxId = repo.GetAll <ITestSession>().Max(x => x.Id);
                Assert.DoesNotThrowAsync(async() => result = await repo.SaveOrUpdateAsync(expected, uow));
            }
            Assert.That(result, Is.EqualTo(++maxId));
        }