Interested in a
Personal Demo ?

Name* :
Please Enter your Name
Company E–Mail* :
Please Enter a Valid Email


"Typemock - My testing tool of choice. Each time I use it, I rediscover its power, and I'm amazed. Great tool!"
Jason Divis, @CodingOfficer
Success stories


US Toll Free
Outside US
Get your printable quote
Buy online


Unit Testing Silverlight With SilverUnit

Download source code examples of using SilverUnit here.

There are many advantages for unit testing Silverlight with Typemock Isolator. These include shortening the development cycle, reducing the development costs, increasing code coverage, releasing a product with less bugs, providing good documentation and more...

Microsoft Silverlight runs with its own version of .Net runtime. Up until now, it was not possible to isolate Silverlight code in tests. But now, thanks to SilverUnit, built on top of Typemock Isolator, it is possible to test Silverlight with ease.

SilverUnit does not require that you run your tests inside the Silverlight runtime. You can run your regular NUnit or MSTest tests only in-memory. The CThru engine underneath SilverUnit takes care of intercepting and “skipping” all calls to the Silverlight runtime. SilverUnit does its part and mimics the missing pieces (Dependency Properties, RoutedEvents, and so on), so you wouldn't need to write them yourself.

SilverUnit is the first implementation of CThru, targeted specifically at testing Silverlight applications. CThru is an AOP (Aspect Oriented-Programming) open source project based on a new Typemock Isolator feature set called "Open AOP" that allows you to intercept any call in a precompiled system (SharePoint, Silverlight, etc.) and change its behavior.  

The following video shows the differences between silverunit and the MS silverlight test framework. SilverUnit is shown in the second half of the presentation.

Unit Testing Silverlight Code Sample VB.NET

Below you can see a unit testing Silverlight code sample. This test sets dependency properties and checks what happens when an Invalid value is set on them. The next one uses two controls with each other.


    public class AutoCompleteBoxTests

        public void SetProperty()
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
        public void SetChildTemplate()
            var box = new AutoCompleteBox();
            SilverUnit.SetTemplateChild(box, "Text", new TextBox());
            SilverUnit.SetTemplateChild(box, "Popup", new Popup()); 
            SilverUnit.SetTemplateChild(box, "SelectionAdapter", new ListBox());
            SilverUnit.SetTemplateChild(box, "DropDownToggle", new ToggleButton());


Download the source code and examples for SilverUnit and CThru