Silverlight 4 Unit Testing Framework

Feb 3, 2012 at 8:45 PM

Having trouble using the Silverlight Unit Testing Framework in conjuction with the "HSS.ServiceModel.VirtualServiceProvider". The steps I've taken after adding the Silverlight Unit Testing App Project template to my VS2010 Solution include the following

- Added "existing" project reference to the new Unit Testing Project in my solution

- Copied "existing" service contract/interface to the Unit Testing class

- Created test method and applied [TestMethodAttribute]

- Modiified Global.asax  in the Unit Test Hosting Web App

All of my Unit Test that evaluate "Getter" and "Setter" method properties work, but when I attempt to execute a Unit Test that trys to invoke a method in a ViewModel class created in a separate project referenced by the Unit Testing project, I receive errors "VirtualChannelNotInitializedException was unhandled by user code...

 Here's my application_startup in the Gloabal.asax

   protected void Application_Start(object sender, EventArgs e)
        {
            VirtualServiceProvider.Initialize("MyToken", false);
            VirtualServiceProvider.Register("services");

         }

        [TestMethod]
        [Tag("Save")]
        public void Save_WaterFallRule()
        {
            Create_ViewModelInstatnce();

            VirtualChannel<INPVService>.Invoke<MXRuleResults>(s => s.UpdateWaterfallRules(this.TRule,false),             (results, ex) => {....... }

 Anybody able to point me to a tutortial, walkthrough or provide a code example of HSS Core Framework being used with the Microsoft Testing Framework ?

 

 


Coordinator
Feb 3, 2012 at 11:13 PM

Not sure what your exact use case is, but this is intended to execute a remote (server side) service.

The idea being you have an interface on the server side, and a duplicate on the client side.

It will execute the remote (server side) interface with your configured implementation of that interface.

As far as examples goes, the source includes a UnitTest project.