blog.kenne
April 7, 2010
Upcoming free events in STHLM april

Lots of inspiring events is coming up:

8/4: Stockholm GTUG, with Google Go, WebGL and Geocoding API.

12/4: Visual Studio 2010 - The Ultimate Tour, microsoft release party!

19/4 Real world Scala, at our Stockholm Jayway office

20/4 Stockholm Web Monkeys, HTML, CSS and JavaScript galore!

22/4 Reactive Extensions for .NET, at our Stockholm Jayway office

/love Carl


Comments ( 1 ) :: Post A Comment! :: Permanent Link


February 27, 2010
ASP.NET MVC 2 session in march

A new, exciting and free (!) session is coming up in march: "ASP.NET MVC 2.0 & vänner".  The session starts at 17.00 at our Jayway office on Drottninggatan. Read all about it here.

Be there, I will!

love carl


Comments ( 0 ) :: Post A Comment! :: Permanent Link


January 24, 2010
Testing the PropertyChanged event

Testing a ViewModel and it’s properties may look quite easy at first. But ViewModels are quite treacherous to their nature. There’s no guarantee that the value of a property in a unit test is the same as what the view is displaying, because of NotifyPropertyChanged (if no PropertyChanged is fired, nothing is updated in the view, right?).

And really, what use do you have of a unit test that you can’t fully rely on?

I thought about solving this issue a few days back and came up with a small extension helper method that increases the test accuracy without increasing the complexity too much.

Given this Context:

    [TestFixture]

    public class When_updating_a_property_which_a_WpfControl_is_binding_to

    {

        private ViewModel _viewModel;

 

        [SetUp]

        public void Context()

        {

            _viewModel = new ViewModel();

            _viewModel.PropertyWithWPFBinding = 100;

        }

 

        [Test]

        public void It_should_display_the_correct_value_since_it_has_fired_a_propertyChanged_event()

        {

            Assert.That(_viewModel.PropertyWithWPFBinding, Is.EqualTo(100));

        }

    }


The test will certainly pass both with or without PropertyChanged (which is bad).
So with a small modification, and with the use of ShouldBeDisplayedAs():

    [TestFixture]

    public class When_updating_a_property_which_a_WpfControl_is_binding_to

    {

        private ViewModel _viewModel;

 

        [SetUp]

        public void Context()

        {

            _viewModel = new ViewModel();

            _viewModel.MakePropertyChangedAware();

            _viewModel.PropertyWithWPFBinding = 100;

        }

 

        [Test]

        public void It_should_display_the_correct_value_since_it_has_fired_a_propertyChanged_event()

        {

            _viewModel.ShouldBeDisplayedAs(x => x.PropertyWithWPFBinding, 100);

        }

    }

The test will fail if no PropertyChanged was fired. To avoid confusion I also added a more descriptive fail reason:

error message_1.png

Pretty sweet.

What the code really does is simply creating a listener for all ProperyChanged events that has been fired with the MakePropertyChangedAware() method. And records the values of the ViewModel only if a PropertyChanged is fired.

If you want a sample project and the source, download here.

/love Carl


Comments ( 0 ) :: Post A Comment! :: Permanent Link


January 17, 2010
Interesting session coming up

Ever wondered whats cooking on the darkside theese days? Renowed Rickard Öberg drops by the Stockholm office to show som new tricks from his Qi4j framework.  The session is on the 26th januari and free of charge (read more here).

Sounds really interesting and i can really recommend it, unfortunatley I wont be there since I already got a date with Jim Coplien that day.  

 

By the way:
Google just told me that Roger Alsing is working on a .Net port... awesome!

/love Carl


Comments ( 0 ) :: Post A Comment! :: Permanent Link


October 18, 2009
Exciting upcoming weeks - a prelude to Øredev

The upcoming weeks looks promising, full of interesting seminars and "geek gatherings" all over Stockholm. In other words, it it's the perfect warmup for the King of Developer Conferences - Øredev in the first week of November.


Oktober:
  Mo-day / 19th 
    -
 Entity Framework 4.0 (Dotway)
    - Using the cloud for testing (Jayway)

  Tu-day / 20th
    - Geek Meet with Molly and HTML 5 (Bwin)

  We-day / 21th
    - Limited WIP Society (Kanban) (Avega)

  Thu-day / 22th
    - Digital vs Fysiskt (multitouch) (Inuse)

  Mo-day / 26th
    - Det behövs mer än bara user stories  (Agical, GeekNight) 


November:
  Mo-day
-> Fri-day / 2th - 6th
    -
Øredev (Malmö)

 

And the best of all... They're all free ( ... well almost all of them :-) )

See you there
/love Carl


Comments ( 0 ) :: Post A Comment! :: Permanent Link


About Me

Right now:
WPF
Composite WPF
DDD
Clean Code


Recent Posts
Menu
Calendar
« July 2010 »
MonTueWedThuFriSatSun
 1234
567891011
12131415161718
19202122232425
262728293031 

Friends
    Links


    Page 1 of 4
    Last Page | Next Page