Ho to mock HtmlPage.Document.QueryString (Silverlight)?

4 posts, 1 answers
  1. Jürgen
    Jürgen avatar
    4 posts
    Member since:
    Sep 2012

    Posted 25 May 2011 Link to this post

    Hi @All,

    I'm new using JustMock. It seems to be very different to other Frameworks like RhinoMock ;-)

    I want to test the gathering of parameters passed via QueryString in the Url of the Silverlight hosting page. I have to use HtmlPage.Document.QueryString to do this, but how can I mock this?

    I need to mock HtmlPage.Document.QueryString
    I need to return a custom Dictionary<string, string>

    I couldn't found anything in the documentation about that
  2. Jürgen
    Jürgen avatar
    4 posts
    Member since:
    Sep 2012

    Posted 25 May 2011 Link to this post

    Hi,

    I tried this code:

    var dic = new Dictionary<string, string> { { "KeyValue", "Hallo Welt" } };
    Mock.Arrange(() => HtmlPage.Document.QueryString).Returns(dic);

    But I get this error:
    "There were some problems intercepting the mock call. Optionally, please make sure that you have turned on JustMock's profiler while mocking concrete members. "
    What is "JustMock's profiler"? Where can i turn that on?
  3. DevCraft R3 2016 release webinar banner
  4. Answer
    Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 25 May 2011 Link to this post

    Hi Jürgen,

    Thanks again for making the question. JustMock profiler is used for mocking concreted members (Ex. Static methods) which is a commercial edition feature. However, profiling is not supported in Silverlight runtime since you are mocking System.Windows.Browser.HtmlPage. Therefore, in Silverlight you are limited to mocking the following items:

    1. Interfaces.
    2. Virtual members
    3. Non-sealed classes.

    Hope the information is useful.

    Kind Regards,
    Ricky
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Jürgen
    Jürgen avatar
    4 posts
    Member since:
    Sep 2012

    Posted 26 May 2011 Link to this post

    Hi,

    many thanks for your answer. 
Back to Top