<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>CThru Wiki &amp; Documentation Rss Feed</title><link>http://www.codeplex.com/CThru/Wiki/View.aspx?title=Home</link><description>CThru Wiki Rss Description</description><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=18</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: Examples of tests using SilverUnit at: &lt;a href="http://download.typemock.com/SilverUnitExamples.604.zip" class="externalLink"&gt;http://download.typemock.com/SilverUnitExamples.604.zip&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;see also: What is CThru: &lt;a href="http://cthru.codeplex.com" class="externalLink"&gt;http://cthru.codeplex.com&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:36:36 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043636P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=17</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: Examples of tests using SilverUnit at: &lt;a href="http://download.typemock.com/SilverUnitExamples.604.zip" class="externalLink"&gt;http://download.typemock.com/SilverUnitExamples.604.zip&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;see also: What is CThru: &lt;a href="http://cthru.codeplex.com/wikipage?title=http%3a%2f%2fcthru.codeplex.com&amp;referringTitle=SilverUnit%20examples"&gt;http&amp;#58;&amp;#47;&amp;#47;cthru.codeplex.com&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:36:22 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043622P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=16</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: Examples of tests using SilverUnit at: &lt;a href="http://download.typemock.com/SilverUnitExamples.604.zip" class="externalLink"&gt;http://download.typemock.com/SilverUnitExamples.604.zip&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;see also: What is CThru: http://cthru.codeplex.com&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:36:12 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043612P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=15</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: Examples of tests using SilverUnit at: &lt;a href="http://download.typemock.com/SilverUnitExamples.604.zip" class="externalLink"&gt;http://download.typemock.com/SilverUnitExamples.604.zip&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=What%20is%20CThru%3ahttp%3a%2f%2fcthru.codeplex.com%2f&amp;referringTitle=SilverUnit%20examples"&gt;What is CThru&amp;#58;http&amp;#58;&amp;#47;&amp;#47;cthru.codeplex.com&amp;#47;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:35:54 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043554P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=14</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: Examples of tests using SilverUnit at: &lt;a href="http://download.typemock.com/SilverUnitExamples.604.zip" class="externalLink"&gt;http://download.typemock.com/SilverUnitExamples.604.zip&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:34:27 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043427P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=13</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: Examples of tests using SilverUnit at: &lt;a href="http://cthru.codeplex.com/wikipage?title=urlhttp%3a%2f%2fdownload.typemock.com%2fSilverUnitExamples.604.zip&amp;referringTitle=SilverUnit%20examples"&gt;urlhttp&amp;#58;&amp;#47;&amp;#47;download.typemock.com&amp;#47;SilverUnitExamples.604.zip&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:34:00 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043400P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=12</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Download: &lt;a href="http://Examples of tests using SilverUnit[http://download.typemock.com/SilverUnitExamples.604.zip" class="externalLink"&gt;Examples of tests using SilverUnit[http://download.typemock.com/SilverUnitExamples.604.zip&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&amp;#39;s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it&amp;#39;s easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 23 Sep 2010 16:33:04 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20100923043304P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=11</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;'s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


[Test,SilverlightUnitTest]
public void SetChildTemplate()
{

   //arrange
   var box = new AutoCompleteBox();

    //injecting our child controls into the parent control without needing XAML
    SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
    SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
    SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

     //act
     box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


      //assert      
      SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;In VB.NET&lt;/h2&gt;&lt;pre&gt;
   //it's easy to trigger control events on any control using special extension methods
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnTextBox_ACBoxIsUpdated()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
        txt.IsEnabled = True
        txt.Focus()

        box.TextBox = txt
        txt.Text = &amp;quot;a&amp;quot;
        txt.FireEvent(Events.TextChanged, Me, FakeInstance(Of TextChangedEventArgs))    //here we also are able to send in fake event args

        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)

    End Sub  

&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 10 Dec 2009 21:25:16 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20091210092516P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/wikipage?title=SilverUnit examples&amp;version=10</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;SilverUnit &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://cthru.codeplex.com/wikipage?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;'s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;
&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/wikipage?title=Understanding%20the%20SilverUnit%20source%20code&amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Things to notice in the examples: 
&lt;ul&gt;&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;
&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;
&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;
&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;
&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;In C#&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }


        [Test,SilverlightUnitTest]
        public void SetChildTemplate()
        {
            var box = new AutoCompleteBox();

            //injecting our child controls into the parent control without needing XAML
            SilverUnit.SetTemplateChild(box, &amp;quot;Text&amp;quot;, new TextBox());
            SilverUnit.SetTemplateChild(box, &amp;quot;Popup&amp;quot;, new Popup()); 
            SilverUnit.SetTemplateChild(box, &amp;quot;SelectionAdapter&amp;quot;, new ListBox());
            SilverUnit.SetTemplateChild(box, &amp;quot;DropDownToggle&amp;quot;, new ToggleButton());

            box.OnApplyTemplate(); //full control of when to call OnApplyTemplate


            SilverUnit.Assert.VisualStatedWasChangedTo(&amp;quot;Normal&amp;quot;,box,false);   //special SilverUnit Assert to check moving to a Visual State
        }


&lt;/pre&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Thu, 10 Dec 2009 21:19:26 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20091210091926P</guid></item><item><title>New Comment on "Getting a SilverUnit project up and running"</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;ANCHOR#C13498</link><description>I created a new silverunit test project using the template, having SL 3.0 as the framework. I right click on ControlTests1.cs and choose Run Test&amp;#40;s&amp;#41;. I get&amp;#58;&amp;#10;&amp;#10;The target type doesn&amp;#39;t contain tests from a known test framework or a &amp;#39;Main&amp;#39; method.&amp;#10;&amp;#10;The same thing happens if I go to the submenu and click Run with Debugger&amp;#47;Coverage&amp;#47;TypeMock. I can run the examples &amp;#40;framework 3.5&amp;#41; from TypeMock just fine. Any ideas&amp;#63;</description><author>martinording</author><pubDate>Thu, 30 Jul 2009 15:04:37 GMT</pubDate><guid isPermaLink="false">New Comment on "Getting a SilverUnit project up and running" 20090730030437P</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=16</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Setting up a SilverUnit project&lt;/h1&gt;
&lt;h2&gt;To start using SilverUnit you will need:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;
&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;
&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;
&lt;li&gt;Visual Studio Express or above&lt;/li&gt;
&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Using the SilverUnit Project Template &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;The simplest solution to start writing a test would be to download the &lt;a href="http://cthru.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27748#DownloadId=69314" class="externalLink"&gt;SilverUnit project template&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for visual studio from the latest release.&lt;/li&gt;
&lt;li&gt;double click on the downloaded .vsi file and visual studio will create a new project type under &amp;quot;silverlight&amp;quot; for you. &lt;a href="http://weblogs.asp.net/rosherove/archive/2009/05/23/silverunit-project-template-and-new-version.aspx" class="externalLink"&gt;More details here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;if you somehow are not able to do this, then follow the instructions below.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Follow these steps to create a project Manually&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;NOTE: only use these instructions if you are not going to use the project template installer (in the paragraph above).&lt;/li&gt;
&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;
&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;
&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;
&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;
&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;
&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;
&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;
&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Add references for SilverUnit&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}

&lt;/pre&gt;
&lt;h2&gt;How to know SilverUnit is working&lt;/h2&gt;When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)
&lt;h2&gt;It's not working. What do I do?&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;
&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;
&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant&lt;/h2&gt;Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;referringTitle=SilverUnit%20examples"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;referringTitle=SilverUnit%20examples"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?&lt;/h2&gt;You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt;
&lt;h2&gt;Does SilverUnit support Silverlight 3.0?&lt;/h2&gt;Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Sun, 24 May 2009 10:38:29 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090524103829A</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=15</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Setting up a SilverUnit project&lt;/h1&gt;
&lt;h2&gt;To start using SilverUnit you will need:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;
&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;
&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;
&lt;li&gt;Visual Studio Express or above&lt;/li&gt;
&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Using the SilverUnit Project Template &lt;/h1&gt;&lt;ul&gt;&lt;li&gt;The simplest solution to start writing a test would be to download the &lt;a href="http://cthru.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27748#DownloadId=69288" class="externalLink"&gt;SilverUnit project template&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for visual studio from the latest release.&lt;/li&gt;
&lt;li&gt;double click on the downloaded .vsi file and visual studio will create a new project type under &amp;quot;silverlight&amp;quot; for you. &lt;a href="http://weblogs.asp.net/rosherove/archive/2009/05/23/silverunit-project-template-and-new-version.aspx" class="externalLink"&gt;More details here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;if you somehow are not able to do this, then follow the instructions below.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Follow these steps to create a project Manually&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;NOTE: only use these instructions if you are not going to use the project template installer (in the paragraph above).&lt;/li&gt;
&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;
&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;
&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;
&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;
&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;
&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;
&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;
&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Add references for SilverUnit&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}

&lt;/pre&gt;
&lt;h2&gt;How to know SilverUnit is working&lt;/h2&gt;When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)
&lt;h2&gt;It's not working. What do I do?&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;
&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;
&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant&lt;/h2&gt;Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;referringTitle=SilverUnit%20examples"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;referringTitle=SilverUnit%20examples"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?&lt;/h2&gt;You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt;
&lt;h2&gt;Does SilverUnit support Silverlight 3.0?&lt;/h2&gt;Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Sat, 23 May 2009 19:55:50 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090523075550P</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=14</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Setting up a SilverUnit project&lt;/h1&gt;
&lt;h2&gt;To start using SilverUnit you will need:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;
&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;
&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;
&lt;li&gt;Visual Studio Express or above&lt;/li&gt;
&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Using the SilverUnit Project Template &lt;/h2&gt;&lt;ul&gt;&lt;li&gt;The simplest solution to start writing a test would be to download the &lt;a href="http://cthru.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27748#DownloadId=69288" class="externalLink"&gt;SilverUnit project template&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for visual studio from the latest release.&lt;/li&gt;
&lt;li&gt;double click on the downloaded .vsi file and visual studio will create a new project type under &amp;quot;silverlight&amp;quot; for you. &lt;a href="http://weblogs.asp.net/rosherove/archive/2009/05/23/silverunit-project-template-and-new-version.aspx" class="externalLink"&gt;More details here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;if you somehow are not able to do this, then follow the instructions below.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Follow these steps to create a project &lt;/h2&gt;&lt;ul&gt;&lt;li&gt;NOTE: only use these instructions if you are not going to use the project template installer (in the paragraph above).&lt;/li&gt;
&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;
&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;
&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;
&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;
&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;
&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;
&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;
&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Add references for SilverUnit&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}

&lt;/pre&gt;
&lt;h2&gt;How to know SilverUnit is working&lt;/h2&gt;When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)
&lt;h2&gt;It's not working. What do I do?&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;
&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;
&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant&lt;/h2&gt;Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;referringTitle=SilverUnit%20examples"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;referringTitle=SilverUnit%20examples"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?&lt;/h2&gt;You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt;
&lt;h2&gt;Does SilverUnit support Silverlight 3.0?&lt;/h2&gt;Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Sat, 23 May 2009 19:55:02 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090523075502P</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=13</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Setting up a SilverUnit project&lt;/h1&gt;

&lt;h2&gt;To start using SilverUnit you will need:&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;
&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;
&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;
&lt;li&gt;Visual Studio Express or above&lt;/li&gt;
&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Follow these steps to create a project &lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;
&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;
&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;
&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;
&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;
&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;
&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;
&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Add references for SilverUnit&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}

&lt;/pre&gt;
&lt;h2&gt;How to know SilverUnit is working&lt;/h2&gt;
When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)
&lt;h2&gt;It's not working. What do I do?&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;
&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;
&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant&lt;/h2&gt;
Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;referringTitle=SilverUnit%20examples"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;referringTitle=SilverUnit%20examples"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?&lt;/h2&gt;
You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt;
&lt;h2&gt;Does SilverUnit support Silverlight 3.0?&lt;/h2&gt;
Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Tue, 12 May 2009 00:29:21 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090512122921A</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=12</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Setting up a SilverUnit project&lt;/h1&gt;

&lt;h2&gt;To start using SilverUnit you will need:&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;
&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;
&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;
&lt;li&gt;Visual Studio Express or above&lt;/li&gt;
&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Follow these steps to create a project (or alternatively use the &lt;a href="http://weblogs.asp.net/nunitaddin/archive/2008/05/01/silverlight-nunit-projects.aspx" class="externalLink"&gt;NUnit-Silverlight&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; template)&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;
&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;
&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;
&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;
&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;
&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;
&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;
&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Add references for SilverUnit&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}

&lt;/pre&gt;
&lt;h2&gt;How to know SilverUnit is working&lt;/h2&gt;
When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)
&lt;h2&gt;It's not working. What do I do?&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;
&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;
&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant&lt;/h2&gt;
Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;referringTitle=SilverUnit%20examples"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;referringTitle=SilverUnit%20examples"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?&lt;/h2&gt;
You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt;
&lt;h2&gt;Does SilverUnit support Silverlight 3.0?&lt;/h2&gt;
Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Mon, 11 May 2009 23:26:01 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090511112601P</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=11</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Setting up a SilverUnit project&lt;/h1&gt;

&lt;h2&gt;To start using SilverUnit you will need:&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;
&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;
&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;
&lt;li&gt;Visual Studio Express or above&lt;/li&gt;
&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Follow these steps to create a project (or alternatively use the &lt;a href="http://weblogs.asp.net/nunitaddin/archive/2008/05/01/silverlight-nunit-projects.aspx" class="externalLink"&gt;NUnit-Silverlight&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; template)&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;
&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;
&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;
&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;
&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;
&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;
&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;
&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;
&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}

&lt;/pre&gt;
&lt;h2&gt;How to know SilverUnit is working&lt;/h2&gt;
When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)
&lt;h2&gt;It's not working. What do I do?&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;
&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;
&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant&lt;/h2&gt;
Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;referringTitle=SilverUnit%20examples"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;referringTitle=SilverUnit%20examples"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?&lt;/h2&gt;
You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt;
&lt;h2&gt;Does SilverUnit support Silverlight 3.0?&lt;/h2&gt;
Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Mon, 11 May 2009 23:25:05 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090511112505P</guid></item><item><title>New Comment on "Getting a SilverUnit project up and running"</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;ANCHOR#C12853</link><description>TypeMock Isolator is a total deal breaker... is it possible to use another mocking framework instead&amp;#63;</description><author>chakrit</author><pubDate>Sat, 09 May 2009 18:56:03 GMT</pubDate><guid isPermaLink="false">New Comment on "Getting a SilverUnit project up and running" 20090509065603P</guid></item><item><title>Updated Wiki: SilverUnit examples</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=SilverUnit examples&amp;version=9</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
SilverUnit 
&lt;/h1&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=Getting%20a%20SilverUnit%20project%20up%20and%20running&amp;amp;referringTitle=SilverUnit%20examples"&gt;Getting a SilverUnit project up and running&lt;/a&gt;&lt;/li&gt;&lt;li&gt;SilverUnit sits on top of &lt;a href="http://www.typemock.com" class="externalLink"&gt;Typemock Isolator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;'s Open-AOP hooks. (Isolator is a commercial unit testing tool).&lt;/li&gt;&lt;li&gt;see also: &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=Understanding%20the%20SilverUnit%20source%20code&amp;amp;referringTitle=SilverUnit%20examples"&gt;Understanding the SilverUnit source code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt; &lt;br /&gt;Things to notice in the examples: &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;Tests can be run with the regular NUnit or MS Test tools. No need for specialized Silverlight-based compilation.&lt;/li&gt;&lt;li&gt;Objects under test can still be part of a Silverlight Assembly (in the examples, these are the Silverlight Toolkit Controls)&lt;/li&gt;&lt;li&gt;We simply &amp;quot;new&amp;quot; up objects under test. But the tests can be run in the regular CLR runtime, not in silverlight.&lt;/li&gt;&lt;li&gt;Tests do not run in the browser - they are fully in memory&lt;/li&gt;&lt;li&gt;Tests do no invoke the silverlight runtime, due to the use of the &amp;quot;SilverlightUnitTest&amp;quot; attribute&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
In VB.NET:
&lt;/h2&gt;This test sets dependency properties and checks what happens when an Invalid value is set on them.&lt;br /&gt;The next one uses two controls with each other.&lt;br /&gt;&lt;pre&gt;
 &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
        Public Sub MinimumPrefixLength_SetToLessThanMinusOne_ResetsToMinusOne()
        Dim box As AutoCompleteBox = New AutoCompleteBox
        box.MinimumPrefixLength = -3
        Assert.AreEqual(-1, box.MinimumPrefixLength)
    End Sub
 
  &amp;lt;SilverlightUnitTest(), Test()&amp;gt; _
    Public Sub SetTextBox_SetTextOnCompleteBox_TextBGoxIsUpdatedWithCompleteBox()
        Dim txt As TextBox = New TextBox()
        Dim box As AutoCompleteBox = New AutoCompleteBox()
        txt.SelectionStart = 0
        txt.SelectionLength = 0
 
        box.TextBox = txt
        box.Text = &amp;quot;a&amp;quot;
        Assert.AreEqual(&amp;quot;a&amp;quot;, box.Text)
        Assert.AreEqual(box.Text, txt.Text)
 
    End Sub
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
In C#
&lt;/h2&gt;&lt;pre&gt;
 [Test,SilverlightUnitTest]
 public void SetProperty()
 {
            var box = new AutoCompleteBox();
            box.MinimumPrefixLength = -3;
            int length =  (int) box.MinimumPrefixLength;
            Assert.AreEqual(-1, length);
  }
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Wed, 01 Apr 2009 20:22:40 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SilverUnit examples 20090401082240P</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=10</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Setting up a SilverUnit project
&lt;/h1&gt; &lt;br /&gt;&lt;h2&gt;
To start using SilverUnit you will need:
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;&lt;li&gt;Visual Studio Express or above&lt;/li&gt;&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;
Follow these steps to create a project
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]  // &amp;lt;----- where the magic happens
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}
 
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
How to know SilverUnit is working
&lt;/h2&gt;When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)&lt;br /&gt;&lt;h2&gt;
It's not working. What do I do?
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant
&lt;/h2&gt;Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;amp;referringTitle=Getting%20a%20SilverUnit%20project%20up%20and%20running"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;amp;referringTitle=Getting%20a%20SilverUnit%20project%20up%20and%20running"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?
&lt;/h2&gt;You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Does SilverUnit support Silverlight 3.0?
&lt;/h2&gt;Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;br /&gt;
&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Wed, 01 Apr 2009 20:21:24 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090401082124P</guid></item><item><title>Updated Wiki: Getting a SilverUnit project up and running</title><link>http://cthru.codeplex.com/Wiki/View.aspx?title=Getting a SilverUnit project up and running&amp;version=9</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
Setting up a SilverUnit project
&lt;/h1&gt; &lt;br /&gt;&lt;h2&gt;
To start using SilverUnit you will need:
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;The latest version of Typemock Isolator installed on the local machine (currently it is 5.3)&lt;/li&gt;&lt;li&gt;The latest version of the SilverUnit dlls (currently 0.4) : &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt; that were compiled against the latest version of Isolator.&lt;/li&gt;&lt;li&gt;A silverlight class library or executable project that you'd like to test (compiled or as source)&lt;/li&gt;&lt;li&gt;Visual Studio Express or above&lt;/li&gt;&lt;li&gt;NUnit, MbUnit or MSTest&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;
Follow these steps to create a project
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Create an empty solution in visual studio&lt;/li&gt;&lt;li&gt;Add the Silverlight project that you'd like to test to the solution projects&lt;/li&gt;&lt;li&gt;Create a new standard (not Silverlight!) class library project in C# or VB.NET (this is where you will write your tests)&lt;/li&gt;&lt;li&gt;Add a reference to NUnit or MSTest or MbUnit so you can write tests with it.&lt;/li&gt;&lt;li&gt;right click on the test project (the standard class library) and Add a reference to the silverlight project that you'd like to test&lt;/li&gt;&lt;li&gt;In the test project, &lt;b&gt;remove&lt;/b&gt; references to System.core, system.xml&lt;/li&gt;&lt;li&gt;in the test project, add references to the silverlight versions of system.core, system.xml and the other system.* dlls from silverlight.&lt;/li&gt;&lt;li&gt;Continue changing the references until everthing compiles successfully (If you have resharper it might &lt;b&gt;think&lt;/b&gt; that there are problems, but as long as compilation passes you're OK.&lt;/li&gt;&lt;li&gt;Add references to &lt;b&gt;Typemock.dll&lt;/b&gt; (from the &amp;quot;.NET&amp;quot; tab) as well as to the &lt;b&gt;CThru.dll&lt;/b&gt; and &lt;b&gt;CThru.Silverlight.dll&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;You should now be able to write a test that looks somewhat like this:&lt;br /&gt;&lt;pre&gt;
[TestMethod]
[SilverlightUnitTest]
public void SomeTestAgainstSilverlight()
{
//code against silverlight here
}
 
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
How to know SilverUnit is working
&lt;/h2&gt;When SilverUnit is running the first test, you should see in the output console a sentence similar to the following:&lt;br /&gt;&amp;quot;&lt;i&gt;Loading isolation aspects...&lt;/i&gt;&amp;quot;&lt;br /&gt;If you see nothing that looks like this before the first test is running it means that something is wrong and SilverUnit is not really isolating you from the Silverlight runtime objects (you'll also get nasty exceptions relating to &lt;i&gt;DependencyObject&lt;/i&gt; based classes)&lt;br /&gt;&lt;h2&gt;
It's not working. What do I do?
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;make sure you have the latest version of Typemock Isolator running and &lt;b&gt;enabled&lt;/b&gt; in the process that is running the test. If it's not running inside visual studio you may need to run that process using TMockRunner.exe which is part of Typemock's Installation&lt;/li&gt;&lt;li&gt;Make sure you have the latest version of the compiled CThru and SilverUnit binaries (0.4 as of writing). These are compiled against the core typemock.dll with version 5.3. it will not work otherwise.&lt;/li&gt;&lt;li&gt;if you are getting &amp;quot;could not load file or dependencies&amp;quot; stuff, it most likely is a reference problem. remove all unneeded references from the test project as long as it still compiles. Also add the silverlight versions of those dlls if they are reported as not found, as references to the test project.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
I'm getting a nasty exception from &amp;quot;JoltHelper&amp;quot; and none of the above is relevant
&lt;/h2&gt;Make sure that you are &lt;b&gt;not&lt;/b&gt; creating instances of your controls inside a &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=SetUp&amp;amp;referringTitle=Getting%20a%20SilverUnit%20project%20up%20and%20running"&gt;SetUp&lt;/a&gt; or &lt;a href="http://cthru.codeplex.com/Wiki/View.aspx?title=TestInitialize&amp;amp;referringTitle=Getting%20a%20SilverUnit%20project%20up%20and%20running"&gt;TestInitialize&lt;/a&gt; method. Create instances of objects inheriting from DependencyObject only from inside the test, because that is when the SilverUnit engine begins to work.  For now this should be the practice. Do not use &amp;quot;new&amp;quot; on things inheriting from DependencyObject in a setup method.&lt;br /&gt;Examples:&lt;br /&gt;Good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[Test,SilverlightUnitTest]
public void SomeTest()
{
control = new MyControl();  //&amp;lt;---- *this is OK*
myControl.DoSomething();//
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Not good:&lt;br /&gt;&lt;pre&gt;
private MyControl control;
[SetUp]
public void Setup()
{
control = new MyControl();  //&amp;lt;---- *big no no*
}
[Test,SilverlightUnitTest]
public void SomeTest()
{
myControl.DoSomething();//
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Can I use SilverUnit inside a project that uses the Silverlight test framework from Microsoft?
&lt;/h2&gt;You can't. Silverunit is based on the regular CLR runtime, and the MS test framework is compiled against the silverlight runtime. You can't use both of them on the same project (and you shouldn't need to). Have one project which holds &lt;b&gt;unit tests&lt;/b&gt; and uses SilverUnit, and another project that holds &lt;b&gt;Integration Tests&lt;/b&gt; and uses the MS test framework.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Does SilverUnit support Silverlight 3.0?
&lt;/h2&gt;Not officially. It has not been tested with it yet. There is a very high chance that tests already written against silverlight 2.0 should &lt;b&gt;just work&lt;/b&gt; if the code under test is compiled into Silverlight 3.0.&lt;br /&gt;
&lt;/div&gt;</description><author>RoyOsherove</author><pubDate>Wed, 01 Apr 2009 20:17:38 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Getting a SilverUnit project up and running 20090401081738P</guid></item></channel></rss>