Failed tests

Jan 8, 2009 at 2:25 AM
there are couple of tests in the project. But half of them fails:
Failed    Deserialize_child_IEntity_without_ID_in_form_should_add_address_to_repository    Assert.AreEqual failed. Expected:<11>. Actual:<10>.     
Failed    Can_deserialize_select_input_for_IEntity    Assert.AreEqual failed. Expected:<Dark-side News>. Actual:<(null)>.     
Failed    Can_deserialize_repeat_for_non_IEntity_complex_object    Test method Mvc.XForms.Tests.XFormsTests.DeserializerTests.Can_deserialize_repeat_for_non_IEntity_complex_object threw exception:  System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Failed    Deserialize_child_IEntity_with_ID_in_form_should_update_repository_address    Test method Mvc.XForms.Tests.XFormsTests.DeserializerTests.Deserialize_child_IEntity_with_ID_in_form_should_update_repository_address threw exception:  System.NullReferenceException: Object reference not set to an instance of an object..    
Failed    Deserialize_empty_repeat_clears_list    Test method Mvc.XForms.Tests.XFormsTests.DeserializerTests.Deserialize_empty_repeat_clears_list threw exception:  System.NotImplementedException: The method or operation is not implemented..    

Doesn't sound any good.

Any updates on the project?

Jan 23, 2009 at 4:59 PM
The deserializer is really a work in progress. The functionality to pass these tests has not been implemented yet.

The idea behind the ones you mention is to do with ORM objects (NHibernate in particular). There is a problem when deserializing with NHibernate (and other ORM's I presume):

Say you have an object Customer with a child object Country. If you want to change the Country object you cannot simply change the ID of the Country (as a deserializer does) and call Save. In NHibernate, you must load up the new Country object based on the new ID and set the Customer.Country to the new Country object. For a deserializer to be able to do this, it needs to be able to call a repository (or service) with an object type and ID, get back an object and attach it to the parent object. This is why the deserializer has the abstract method:

protected abstract object GetEntity(long entityID, PropertyInfo property);

But as I say this is a work in progress.

I am waiting for the full release of MVC to take XForms forward and am about to write a blog post about this.