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 303257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:10:19+00:00 2026-05-12T07:10:19+00:00

In short: How would I check the type of a UI user control during

  • 0

In short: How would I check the type of a UI user control during a Silverlight unit test?

In detail: I am loading child views into a ContentControl on a parent view. During testing I want to check that the correct view has been loaded at the correct time. My views are in separate projects, and I don’t want to add a reference to those assemblies into my test project for the parent view (too tightly coupled).

This is where I am stuck:

[TestMethod]
[Asynchronous]
[Description("Test to confirm that upon initial class creation, the login view is loaded as the default content for the TaskRegion.")]
public void Shell_Initialisation_LoginViewIsLoadedByDefault()
{
   Shell shell = new Shell();

   //helper method from Justin Angels example 
   WaitFor(shell, "Loaded");

   TestPanel.Children.Add(shell);

   Shell_ViewModel viewModel = shell.DataContext as Shell_ViewModel;

   EnqueueCallback(() => Assert.IsTrue(viewModel.TaskRegionContent is **How do I reference my control type**));

   EnqueueTestComplete();
}

Should I be using mocking?

(The WaitFor is a helper method supplied by Justin Angel)

  • 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-05-12T07:10:20+00:00Added an answer on May 12, 2026 at 7:10 am

    How about using GetType()? You can then use various methods on the Type instance to check whether it is an instance of type, or inherited from, the type.

    Assert.IsInstanceOfType(viewModel.TaskRegionContent, typeof(Control))
    

    Where “Control” above is the type of interest that you want to check.

    See also: http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.assert.isinstanceoftype(VS.80).aspx

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

Sidebar

Related Questions

I would like to generate a short, unique ID without having to check for
Short version : I would like the maven-glassfish-plugin to only be executed in the
Which algorithm would you use to search short substrings in short texts? By short
I would like to determine what the long url of a short url is.
I would like to implement operations that is undoable in a short time after
I would like to know how can I write a pointer array: short* myArray
How would you do to display rendered html code like this <b>short article</b> and
I put together a short script for a fellow classmate and thought I would
I am in the midst of a short thought experiment and would love some
I'm trying to write a short Wordpress JQuery for Wordpress comments that would allow

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.