This is a migrated thread and some comments may be shown as answers.

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

3 Answers 39 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jürgen
Top achievements
Rank 1
Jürgen asked on 25 May 2011, 12:54 PM
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

3 Answers, 1 is accepted

Sort by
0
Jürgen
Top achievements
Rank 1
answered on 25 May 2011, 01:40 PM
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?
0
Accepted
Ricky
Telerik team
answered on 25 May 2011, 06:03 PM
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
0
Jürgen
Top achievements
Rank 1
answered on 26 May 2011, 10:51 AM
Hi,

many thanks for your answer. 
Tags
General Discussions
Asked by
Jürgen
Top achievements
Rank 1
Answers by
Jürgen
Top achievements
Rank 1
Ricky
Telerik team
Share this question
or