Ejemplo n.º 1
0
		public void MSSQLQuery_SelectWithWhereClause_ReturnsTheRightQuery()
		{
			var expectedQuery = @"SELECT [Id] AS [Id] FROM Users WHERE ([Id] = @Id)";

            TestDbContext context = new TestDbContext();
            var query = context.Query<User>().Where(p => p.Id == 2);
            
            IEntityMapper mapper = context.DatabaseModel.MapperWithType(typeof(User));
            QueryVisitor visitor = new QueryVisitor(mapper, new WhereVisitor(), new ProjectorVisitor());
            //string text = visitor.Translate(query.Expression);

            //Assert.AreEqual(expectedQuery, text);
		}
Ejemplo n.º 2
0
        public void MSSQLQuery_Select_ReturnsTheRightQuery()
        {
            var expectedQuery = @"SELECT [Id] AS [Id] FROM Users";

            TestDbContext context = new TestDbContext();
            var query = context.Query<User>().Select(p => new { p.Id });

            IEntityMapper mapper = context.DatabaseModel.MapperWithType(typeof(User));
            QueryVisitor visitor = new QueryVisitor(mapper, new WhereVisitor(), new ProjectorVisitor());
            //Tuple<string, IdD text = visitor.Translate(query.Expression);

            //Assert.AreEqual(expectedQuery, text);
        }