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)