At the moment I'm developing an UnitTest for a CustomControl. In this Control there is some Code, which is only excuted when the called method is not called in the DesignTime. When I run the test, the given Code is not executed, because the current context seems to be the DesignTime.
Example:
public void SomeMethod() // EDIT: this is the OnLoaded Event for example.
{
if(IsNotInDesignMode()) // This is implemented somewhere else.
{
// I want this to be called in the Test Execution.
DoSomething();
}
}
EDIT: Seems like my first attempt wasnt clear enough, so here another description.
Is there a way to tell my Test Method/Class to run the Test as a Runtime Version? I dont want to change Properties or Methods in my CustomControl. And I dont have acccess to the Method IsNotInDesignMode() (by mocking it for example), because it is implemented in an external library.
EDIT 2: See Code.
Thanks for helping me out.