Unit Testing Silverlight With SilverUnit
|
Download source code examples of using SilverUnit here. There are many advantages for unit testing Silverlight with Typemock Isolator. These include shortening the development cycle, reducing the development costs, increasing code coverage, releasing a product with less bugs, providing good documentation and more... Microsoft Silverlight runs with its own version of .Net runtime. Up until now, it was not possible to isolate Silverlight code in tests. But now, thanks to SilverUnit, built on top of Typemock Isolator, it is possible to test Silverlight with ease.
The following video shows the differences between silverunit and the MS silverlight test framework. SilverUnit is shown in the second half of the presentation. Unit Testing Silverlight Code Sample VB.NETdownload the source code and examples for SilverUnit and CThru Below you can see a unit testing Silverlight code sample. This test sets dependency properties and checks what happens when an Invalid value is set on them. The next one uses two controls with each other.
<SilverlightUnitTest(), Test()> _
Public Sub MinimumPrefixLength_SetToLessThanMinusOne_ResetsToMinusOne()
Dim box As AutoCompleteBox = New AutoCompleteBox
box.MinimumPrefixLength = -3
Assert.AreEqual(-1, box.MinimumPrefixLength)
End Sub
<SilverlightUnitTest(), Test()> _
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 = "a"
Assert.AreEqual("a", box.Text)
Assert.AreEqual(box.Text, txt.Text)
End Sub
download the source code and examples for SilverUnit and CThru
Resources
|

