Project Description
Caliburn is a framework designed to aid in the development of WPF and Silverlight applications. It implements a variety of UI patterns that are geared towards solving problems encountered in real-world scenarios. Some patterns that are enabled by the framework include MVC, MVP, Presentation Model (MVVM), and Commands. Caliburn is based on several years of real-world development with WPF and aims to bring techniques developed in those projects to developers on both the WPF and Silverlight platforms.

Goals
  • Support building WPF/SL application that are TDD friendly.
  • Implement functionality for simplifying various UI design patterns in WPF/SL. These patterns include MVC, MVP, Presentation Model (MVVM), Commands, etc.
  • Ease the use of a dependency injection container with WPF/SL.
  • Simplify or provide alternatives to common WPF/SL related tasks.
  • Provide solutions to common UI architecture problems.

Documentation can be found here.

 .NET & Funky Fresh News Feed 
Monday, November 17, 2008  |  From .NET & Funky Fresh

 Yes, you read that right.  Check out ScottGu's blog for the proof.  Let the good times roll...

Tuesday, October 28, 2008  |  From .NET & Funky Fresh

If you noticed, when Silverlitht 2 was released, they only released an RC1 of the tools.  Today, they have released the Silverlight Tools RTW.  You can get it here.  You can read some more details on Mike Snow's blog.

Saturday, October 25, 2008  |  From .NET & Funky Fresh

The Caliburn.Testability assembly contains various classes related to unit testing a UI. You can use the BindingValidator to validate data bindings on DependencyObjects, DataTemplates and Styles. The easiest way to access this functionality is through the static Validator class.  It has several methods for the most common scenarios related to unit testing data bindings.

Note: This feature of Caliburn is only available to WPF due to limitations in the Silverlight API.  It is not in the Alpha download but can be found in the Trunk.

Here is an example of a simple unit test:

[TestFixture]
public class The_UI_for_adding_a_new_customer
{
    [Test]
    public void is_data_bound_to_a_CustomerModel()
    {
        var validator = Validator.For<AddNewCustomerForm, CustomerModel>();
        var result = validator.Validate();
 
        Assert.That(result.HasErrors, Is.False, result.ErrorSummary);
    }
}

The Validator class has several 'For' methods. In this case, we are using the overload that takes a type parameter for the UI and a type parameter for the bound data type. Simply call the Validate method and check the results to insure that all your binding expressions are correct. The ErrorSummary contains a textual representation of any errors that are found. The framework will walk the entire UI hierarchy checking data bindings on all dependency properties. It will check all elements for inline DataTemplates (such as ItemsControl.ItemTemplate) and, if found, check the template. All inline styles will be checked. Triggers on both DataTemplate and Style will also be checked.

You can also validate the presence of a specific property:

[TestFixture]
public class The_UI_for_adding_a_new_customer
{
    [Test]
    public void is_data_bound_to_the_CustomerModel_FirstName()
    {
        var validator = Validator.For<AddNewCustomerForm, CustomerModel>();
        var result = validator.Validate();
 
        Assert.That(result.WasBoundTo(x => x.FirstName));
    }
}

By using the WasBoundTo method, a test can use lambda expressions to do strongly typed validation of specific properties. There is also a WasNotBoundTo method for convenience purposes.

Validation of items in resource dictionaries is also easy:

[TestFixture]
public class The_UI_for_adding_a_new_customer
{
    [Test]
    public void is_data_bound_to_a_CustomerModel()
    {
        var validator = Validator.For<MyResources, CustomerModel>("addNewCustomerTemplate");
        var result = validator.Validate();
 
        Assert.That(result.HasErrors, Is.False, result.ErrorSummary);
    }
}

In the above example, the validator creates the ResourceDictionary called MyResources and then locates the resource with key "addNewCustomerTemplate." It then determines whether the resource is a DataTemplate, Style or DependencyObject and runs the appropriate validation.

 .NET & Funky Fresh News Feed 

Last edited Oct 17 at 10:23 PM by EisenbergEffect, version 6
Comments
Also available: 1 review for current release.

No comments yet.

Updating...