It is good to see samples like this. We recently had a WF4.0 talk at the user group I run and it really made me ask myself why the hell we weren't looking at using it in almost EVERY app we were writing. Even for relatively simple tasks like email verifications,
having WF handle reminders, flagging of unactivated accounts etc is just so much less hassle to implement, and even more of an advantage if those rules need to change.
Nice idea to show something that a lot of web apps will have, but probably don't currently leverage WF for. I also like the idea of the static method to remove any of the WF "plumbing" from the main code.
Really don't like your test though. Having the SmtpClient and the file system as a dependency is pretty nasty in my book. Although you probably kept it that way to make sure you didn't over complicate the demo, I think it's worth pointing out that's probably
not a very "good" test for the real world
Personally I'd create an ISendService, add an ISendService public property to the CodeActivity (defaulting to a concrete version that uses SmtpClient) and add another overload to Invoke to accept an ISendService. You can easily then create a fake in your
test (statically or dynamically) that makes sure the "Send" method is executed correctly without taking on any other dependencies.
Like I said, it probably over complicates this demo, but I thought it was worth pointing out