Testing the full stack - Async

Dec 5, 2012 at 11:22 AM
Edited Dec 6, 2012 at 9:34 AM

I've got a non MVVM SL5 app using RIA.

Installed R#7.1 and AgUnit.

This works

 [TestMethod]
        public void simpletest_givennothing_1equals1()
        {
            Assert.AreEqual(1, 1);
        }

This doesn't (seems to loop through the method once, then hang on !target.IsLoading forever).
        [TestMethod]
        [Asynchronous]
        public void Database_GivenUserID1001_ShouldHaveOnly0Role()
        {
            var target = new UERDomainContext();

            EnqueueCallback(() => target.Load(target.GetUsersByReviewerQuery(testUserADLogin, "AllUsers", "0")));
            EnqueueConditional(() => !target.IsLoading);

            EnqueueCallback(() => Assert.AreEqual(12, target.xyzUsers.Count()));

            EnqueueTestComplete();
        }
This tests works find in the SL Testing framework.

Ideally I'm trying drive out the Domain Services using TDD, and was trying to do it from the SL layer rather than straight against the webservices: http://stackoverflow.com/questions/13510361/ria-services-where-to-call-savechanges-from-a-test/13622463#13622463

First time testing SL.

Tried doing non async and couldn't get it to hit the db.
Dec 5, 2012 at 12:56 PM

Hi,

 

The problem is, AgUnit right now doesn't display a visual test surface.

This is the reason a lot of the async stuff doesn't work (the UI dispatcher is suspended).

See here for more info:

http://agunit.codeplex.com/discussions/404656

 

Greetings,

Steven

Dec 6, 2012 at 9:36 AM

Many thanks Steven - directly testing the RIA layer is where I've been getting biggest wins recently.. will stick with that for a while.  http://stackoverflow.com/questions/13510361/ria-services-where-to-call-savechanges-from-a-test