This project is read-only.

Testing a control with a DataTemplate - using XamlReader.Load()

Jan 10, 2010 at 7:24 PM

Hi,

I'm really loving CThru and SilverUnit - it rocks. Revolutionized my Silverlight testing. :)
But, I'm having a bit of a problem. I have a control that has a DataTemplate and I need to programatically create this and set it, but XamlReader.Load() returns null, no matter what I throw at it.

Any suggestions would be great as to how this could be solved. 

Coordinator
Jan 10, 2010 at 7:36 PM
WHat do you need the DataTemplate? Usually one would "inject" the inner child controls manually.
can you send a sample of the data template?
the main idea behind silverunit is that you do *not* use underlying files to make the tests work (that would make them integration tests).
perhaps there is a way to make that work in pure code?

I need more information.

also, I might be presenting on SIlverUnit soon, so if you'd like to share a success story, ping to to Roy at osherove dot com. maybe i will use it.

On Sun, Jan 10, 2010 at 8:24 PM, adept <notifications@codeplex.com> wrote:

From: adept

Hi,

I'm really loving CThru and SilverUnit - it rocks. Revolutionized my Silverlight testing. :)
But, I'm having a bit of a problem. I have a control that has a DataTemplate and I need to programatically create this and set it, but XamlReader.Load() returns null, no matter what I throw at it.

Any suggestions would be great as to how this could be solved. 

Read the full discussion online.

To add a post to this discussion, reply to this email (CThru@discussions.codeplex.com)

To start a new discussion for this project, email CThru@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
Thanks,

Roy Osherove
www.TypeMock.com - Unit Testing, Plain Smart

Author of "The Art Of Unit Testing" (http://ArtOfUnitTesting.com )
A blog for team leaders: http://5Whys.com
my .NET blog: http://www.ISerializable.com
Twitter: http://twitter.com/RoyOsherove
+972-524-655388 (GMT+2)
Jan 10, 2010 at 7:47 PM

I'm developing a set of controls for my Balder project (3D engine for Silverlight), and one of the features I'm trying to test is that it can pick up the DataTemplate and actually uses the template correctly and that all databinding done in the template is handled correctly. It doesn't feel appropriate for these tests to be integration tests. My DataTemplate is fairly simple: 

 

<DataTemplate xmlns="http://schemas.microsoft.com/client/2007" xmlns:balder="clr-namespace:Balder.Core.Objects;assembly=Balder.Core">
   <balder:Mesh/>
</DataTemplate>

I'll see what I can put together for a possible success story. 

Thanks again!