Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8555145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:03:20+00:00 2026-06-11T15:03:20+00:00

I work in an enterprise environment and our front ends (client and web) don’t

  • 0

I work in an enterprise environment and our front ends (client and web) don’t have direct DB access, but rather talk to services over a network. Proof of concept work has started for an externally available ASP.Net web API and we were thinking of trying to use an implementation of IQueryable to be able to use OData. The problem is that the web API would be another “front-end” that accesses a service layer that is a network hop away, which means we have to write our own implementation of IQueryable.

One IQueryable implementation is what I call a RangeQueryable which would be abstract and take three generic parameters; TRaw, TData, TRange. It would be an IQueryable<TData>

var queryable = new RangeQueryableImplementation<RawData, ConvertedData, DateTime>("Created");

In the previous code line RawData is TRaw, ConvertedData is TData and DateTime is TRange.

RangeQueryable would also have two abstract methods.

public abstract IEnumerable<TRaw> GetData(TRange from, TRange to);
public abstract TData Convert(TRaw raw);

GetData would make a call to the service layer over the network and use from and to as parameters in the call. Convert would then convert the data into my types.

TRaw is the type that the service would return, TData is the type within the frontend and the type inside the IQueryable, and TRangeis the range type.

So this would be possible:

queryable.Where(d => d.Created < DateTime.Now && d.Created > DateTime.Now.AddDays(-5))

…or the OData equivalent.

This is where the ExpressionVisitor comes in. I need to use the ExpressionVisitor to find the From and To dates.

I’ve looked at some tutorials and come up with some ideas. The problem I’m having is that I have no idea how I would unit test an ExpressionVisitor. How would I create an Expression which is equivalent to what the Queryable extension methods create?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:03:21+00:00Added an answer on June 11, 2026 at 3:03 pm

    I would write each test case as having a certain expression tree as an input and (in your case) expect certain range as the output. Specifying the expression tree can be done in multiple ways:
    – You can create the expression tree manually through calls to Expression.Call and so on (each type of expression node has a static method on the Expression type which creates it).
    – You can create the expression tree using the extension methods as you did above
    – You can use query comprehension to create the expression tree (the select from where syntax)

    Each of these will end up with an expression tree. The extension methods end up calling the Expression. method as well. Most of them are in fact just inject a Call expression into the tree to themselves – you can take a look in disassembler or in the publicly available source code in the debugger.

    The query comprehension syntax is just another way to write the call to the extension method, so you end up with the same thing as well.

    In unit tests you don’t even have to run the queryable, so just creating it, applying an expression tree to it, and running the expression visitor should be enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my work environment, we have a number of Enterprise Java applications that run
I work with an engineering team that's built an enterprise-class web application. Currently, the
We are working in a CI environment, with Enterprise Cruise running our builds. Developers
I have an enterprise Flex web application, served up over https, that runs fine
I work on an enterprise web application that runs in IE8. It appears blur()
I work for an enterprise service desk, and many of our users use Android
The .NET enterprise system I work with, has disparate web-services all over the place.
In your enterprise work environment, how are engineers held accountable for performing code inspections
Currently in our enterprise we have a situation that i think it's not very
I have Visual Studio 2010 on my work machine, but I'd also like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.