﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Jimmy Zimms commented on Async tests in Silverlight</title><description>And reading these comments I see that most everyone missed the entire point here that should be the take away. Regardless of underlying technology, if you are working in an intrinsically async environment (and that should be EVERYONE) then you have to deal with the realities of async APIs and the related tests for them. Oren points out real life techniques and components to handle this problem area in an elegant manner without getting in my way as a developer. Somehow people evolved into Silverlight is Dead vs Long Live Silverlight and missed the boat.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment15</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment15</guid><pubDate>Wed, 07 Dec 2011 18:56:50 GMT</pubDate></item><item><title>Sam commented on Async tests in Silverlight</title><description>I wish Silverlight was dead. It's a horrendous CPU hog even when it's (apparently) doing nothing, and it breaks expected UI conventions (context menus bug me the most). I'm pretty sure it's responsible for the random freezes the desktop at home is experiencing.

The only reason I haven't disabled it is Raven Studio and Azure Management Portal, and I dread having to start up either one of those.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment14</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment14</guid><pubDate>Wed, 07 Dec 2011 05:34:56 GMT</pubDate></item><item><title>Marwijn commented on Async tests in Silverlight</title><description>Hi All

I tried to use the same approach using microsoft async CTP to try to make the syntax a bit simpler. I came up with this:

[TestMethod]
[Asynchronous]
public async Task AnotherWay()
{
    await SomeTestTask.DoSomethingAsync();
    int result = await SomeTestTask.DoSomethingAsync();

    await Delay(100);

    Assert.AreEqual(42, result);
}


To make this working I added 

public void ExecuteTest2(MethodInfo test)
{
     Task task = (Task)test.Invoke(this, new object[] { });     
      EnqueueConditional(()=&gt; task.IsCompleted || task.IsFaulted);
      EnqueueCallback(() =&gt;
                            {
                                if (task.IsFaulted)
                                {
                                    throw task.Exception.InnerException;
                                }
                            });
            EnqueueTestComplete();
        }
} 

to AsynchronousTaskTest

and 

if (Method.ReturnType == typeof(Task))
{
                var executer =   
                     instance.GetType().GetMethod("ExecuteTest2");
                executer.Invoke(instance, new[] { methodInfo });
}

to TestMethod.

Just let me know if it works for you.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment13</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment13</guid><pubDate>Tue, 06 Dec 2011 12:23:25 GMT</pubDate></item><item><title>Peter commented on Async tests in Silverlight</title><description>I need to express my feeling here in the comment thread, sorry, here goes:

Who cares if Silverlight dies. Who cares! 

I guess it makes testing easier if it does?

Why do we care if Silverlight dies? Why do we care if Windows Phone dies?

It used to matter to me, but I don't understand why now. A lost time investment?</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment12</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment12</guid><pubDate>Tue, 06 Dec 2011 01:02:38 GMT</pubDate></item><item><title>Harry Steinhilber commented on Async tests in Silverlight</title><description>@Coreo, 
And which technologies that work should I stick to then? Maybe I should just continue to write Webforms apps? My point is that Silverlight will be supported for many years to come and there is no harm in continuing to use it. 

As far as corporations not installing Silverlight, many actually do. And the fact that it is sandboxed on the client is a *feature* that corporations like from a security prospective.

As far as where is Silverlight 5, Microsoft released an RC in September, and it was unofficially supposed to RTM in November. However, the official site still shows a 2011 release timeframe.  Is that real enough for you?</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment11</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment11</guid><pubDate>Mon, 05 Dec 2011 23:31:32 GMT</pubDate></item><item><title>Mouzik commented on Async tests in Silverlight</title><description>And that is why everyone just needs to write dates yyyy-mm-dd :)</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment10</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment10</guid><pubDate>Mon, 05 Dec 2011 15:42:05 GMT</pubDate></item><item><title>Remco commented on Async tests in Silverlight</title><description>@Coreo

March? How can he comment on a post which was not even published then.

Windows Phone dies? Wow, the only one who needs to get real is you. If you look at the world like this, just go sit in a hole somewhere where nobody can iritate you. And nobody is irritated by your useless statements.

my2c</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment9</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment9</guid><pubDate>Mon, 05 Dec 2011 01:08:49 GMT</pubDate></item><item><title>K00lAid commented on Async tests in Silverlight</title><description>Harry, dude just drink the Kool Aid, dont chug it.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment8</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment8</guid><pubDate>Sun, 04 Dec 2011 15:47:06 GMT</pubDate></item><item><title>lol commented on Async tests in Silverlight</title><description>No Coreo, he wrote it in December not in March. Get real.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment7</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment7</guid><pubDate>Sun, 04 Dec 2011 12:25:45 GMT</pubDate></item><item><title>Coreo commented on Async tests in Silverlight</title><description>Harry...

Silverligh IS dead, the technology like that was doomed at the very beginning. It is tedious, prone to errors, runs in a sandbox on the client machine, most corporations would never even allow it to be installed in their networks...Same as for Linq to SQL and other technologies, they just die. Stick to the ones that work.
Now we are all bound to move the beaufully colored rectangles on the screen being thrilled that we use Metro....wow. But just for a few years, until Windows Phone finally dies...
You wrote this in March this year, saying it is only a month of two until Silverlight 5, now we will soon be in 2012, so where is it? Get real.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment6</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment6</guid><pubDate>Sun, 04 Dec 2011 11:50:56 GMT</pubDate></item><item><title>Jeff Circeo commented on Async tests in Silverlight</title><description>Thanks Ayende, this is definitely a much cleaner approach and I love it.
</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment5</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment5</guid><pubDate>Sat, 03 Dec 2011 18:00:18 GMT</pubDate></item><item><title>Harry Steinhilber commented on Async tests in Silverlight</title><description>@fact
Really? Last time I checked, Microsoft supports [products for 10 years](http://support.microsoft.com/gp/lifepolicy). In the next month or two, we are looking at the release of Silverlight 5. That means that Silverlight will be alive and kicking until *at least* the end of 2021.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment4</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment4</guid><pubDate>Fri, 02 Dec 2011 23:53:54 GMT</pubDate></item><item><title>fact commented on Async tests in Silverlight</title><description>Silverlight is dead</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment3</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment3</guid><pubDate>Fri, 02 Dec 2011 21:53:30 GMT</pubDate></item><item><title>José F. Romaniello commented on Async tests in Silverlight</title><description>I like this thing, it is in fact how you implement co-routines.
I guess in the near future with async/await in c# it is going to be simpler.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment2</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment2</guid><pubDate>Fri, 02 Dec 2011 16:20:49 GMT</pubDate></item><item><title>tobi commented on Async tests in Silverlight</title><description>This technique is also useful pre C# 5 to get async code emulated using iterators.</description><link>http://ayende.com/141313/async-tests-in-silverlight#comment1</link><guid>http://ayende.com/141313/async-tests-in-silverlight#comment1</guid><pubDate>Fri, 02 Dec 2011 13:50:38 GMT</pubDate></item></channel></rss>