endpoint.tv Screencast - Spike on Workflow Managed Email Verification

Download this episode

Download Video

Description

On this episode I'm doing a little spike project to prototype a web app that uses a workflow to manage email verification when registering a user for a web site.  You will see how you can
- Create a SendMail custom activity
- Unit test the SendMail custom activity
- Consider a new way for making it easy for the web developers to invoke your business process
- Close the loop on registration

There will be more to do on this project but I thought I would share it with you now so you can see what we have got so far.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      Grumpydev

      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 Smiley

       

      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 Smiley

    • User profile image
      rojacobs

      Sure - I agree that writing a file during a unit test, creating directories etc is a little icky. :=0

       

      No wonder they call you Grumpydev... Wink

    • User profile image
      Grumpydev

      Lol, I'm well and truly self-titled Smiley

       

      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.

       

      Your unit test still stinks though Wink

    • User profile image
      TechChaser

      This video will be great if you don't  dig into detail of Testing & SMTP's.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.