Exemple #1
0
        public void WhenInstanciatingDbQueryContextThenReturnsObject()
        {
            // Arrange
            FakeDbContext context = CreateDbContext();

            // Act
            DbQueryContext<FakeDbContext> queryContext = new DbQueryContext<FakeDbContext>(context);

            // Assert
            Assert.NotNull(queryContext);
        }
Exemple #2
0
        public void WhenDisposingQueryContexthenDisposeInnerDbContext()
        {
            // Arrange
            FakeDbContext context = CreateDbContext(10);
            DbQueryContext<FakeDbContext> queryContext = new DbQueryContext<FakeDbContext>(context);

            // Act
            queryContext.Dispose();

            // Assert
            Assert.True(context.Disposed);
        }
Exemple #3
0
        public async Task WhenFindingItemThenRetunsEntity()
        {
            // Arrange
            FakeDbContext context = CreateDbContext(10);
            DbQueryContext<FakeDbContext> queryContext = new DbQueryContext<FakeDbContext>(context);

            // Act
            FakeEntity result = await queryContext.FindAsync<FakeEntity>("test3");

            // Assert
            Assert.NotNull(result);
            Assert.Equal(3, result.Property2);
            Assert.Equal("test3", result.Property1);
        }
Exemple #4
0
        public void WhenQueryingItemsThenReturnsEntities()
        {
            // Arrange
            FakeDbContext context = CreateDbContext(10);
            DbQueryContext<FakeDbContext> queryContext = new DbQueryContext<FakeDbContext>(context);

            // Act
            var query = queryContext.Query<FakeEntity>();

            // Assert
            Assert.NotNull(query);
            Assert.Equal(context.Entities.Count(), query.Count());
            Assert.NotNull(query.FirstOrDefault());
            Assert.Equal(context.Entities.FirstOrDefault(), query.FirstOrDefault());
            Assert.Equal(context.Entities.Count(item => item.Property2 >= 5), query.Count(item => item.Property2 >= 5));
        }
Exemple #5
0
 internal MySQLGroupSortedResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #6
0
 internal MySQLQuerySet(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #7
0
 internal MySQLJoinGroupedResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #8
0
 internal MySQLJoinFilterResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #9
0
 protected override DbJoinGroupHavingResult <TEntity, TJoin1> CreateJoinGroupHavingResult <TEntity, TJoin1>(DbQueryContext queryContext)
 {
     return(new MySQLJoinGroupHavingResult <TEntity, TJoin1>(this, queryContext));
 }
Exemple #10
0
 protected override DbJoinFilterResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4> CreateJoinFilterResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4>(DbQueryContext queryContext)
 {
     return(new MySQLJoinFilterResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4>(this, queryContext));
 }
Exemple #11
0
 internal SQLServerQuerySet(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #12
0
 protected override DbSortedQuerySet <TEntity> CreateSortedQuerySet <TEntity>(DbQueryContext queryContext)
 {
     return(new SQLServerSortedQuerySet <TEntity>(this, queryContext));
 }
Exemple #13
0
 protected override DbJoinGroupHavingResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4> CreateJoinGroupHavingResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4>(DbQueryContext queryContext)
 {
     return(new SQLServerJoinGroupHavingResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4>(this, queryContext));
 }
Exemple #14
0
 protected override DbJoinPagedResult <TEntity, TJoin1> CreateJoinPagedResult <TEntity, TJoin1>(DbQueryContext queryContext)
 {
     return(new SQLiteJoinPagedResult <TEntity, TJoin1>(this, queryContext));
 }
Exemple #15
0
 protected override DbGroupHavingResult <TEntity> CreateGroupHavingResult <TEntity>(DbQueryContext queryContext)
 {
     return(new SQLiteGroupHavingResult <TEntity>(this, queryContext));
 }
Exemple #16
0
 protected override DbQuerySet <TEntity> CreateQuerySet <TEntity>(DbQueryContext queryContext)
 {
     return(new SQLiteQuerySet <TEntity>(this, queryContext));
 }
Exemple #17
0
 protected override DbJoinSortedResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4> CreateJoinSortedResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4>(DbQueryContext queryContext)
 {
     return(new SQLiteJoinSortedResult <TEntity, TJoin1, TJoin2, TJoin3, TJoin4>(this, queryContext));
 }
Exemple #18
0
 protected override DbJoinedResult <TEntity, TJoin1, TJoin2> CreateJoinedResult <TEntity, TJoin1, TJoin2>(DbQueryContext queryContext)
 {
     return(new MySQLJoinedResult <TEntity, TJoin1, TJoin2>(this, queryContext));
 }
Exemple #19
0
 internal SQLiteJoinGroupHavingResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #20
0
 internal SQLServerGroupHavingResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #21
0
 internal SQLServerJoinGroupSortedResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #22
0
 internal SQLiteJoinedResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }
Exemple #23
0
 protected override DbJoinFilterResult <TEntity, TJoin1, TJoin2> CreateJoinFilterResult <TEntity, TJoin1, TJoin2>(DbQueryContext queryContext)
 {
     return(new SQLServerJoinFilterResult <TEntity, TJoin1, TJoin2>(this, queryContext));
 }
Exemple #24
0
 protected override DbGroupSortedResult <TEntity> CreateGroupSortedResult <TEntity>(DbQueryContext queryContext)
 {
     return(new SQLServerGroupSortedResult <TEntity>(this, queryContext));
 }
Exemple #25
0
 protected override DbGroupedResult <TEntity> CreateGroupedResult <TEntity>(DbQueryContext queryContext)
 {
     return(new MySQLGroupedResult <TEntity>(this, queryContext));
 }
Exemple #26
0
 protected override DbJoinGroupSortedResult <TEntity, TJoin1> CreateJoinGroupSortedResult <TEntity, TJoin1>(DbQueryContext queryContext)
 {
     return(new SQLServerJoinGroupSortedResult <TEntity, TJoin1>(this, queryContext));
 }
Exemple #27
0
 internal SQLServerJoinFilterResult(DbSession session, DbQueryContext queryContext)
     : base(session, queryContext)
 {
 }