<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>How-To</title>
        <link>http://www.wtfnext.com/WTFNext/category/8761.aspx</link>
        <description>From beginner to advanced, this post had you in mind for continued learning.</description>
        <language>en-US</language>
        <copyright>Stacy Vicknair</copyright>
        <managingEditor>svickn@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Code Documentation Generation with SandCastle</title>
            <link>http://wtfnext.com/archive/2011/10/25/code-documentation-generation-with-sandcastle.aspx</link>
            <description>&lt;p&gt;If you, like me, have ever looked over the MSDN documentation and though how nice it would be to have that type of documentation for your codebase, &lt;a href="http://sandcastle.codeplex.com/"&gt;SandCastle&lt;/a&gt; is the tool you’ve been looking for. &lt;a href="http://sandcastle.codeplex.com/"&gt;SandCastle&lt;/a&gt; is a Codeplex project initiated by Microsoft in order to provide MSDN-esque documentation for .NET projects or asssemblies. The documentation can come in several formats such as CHM files or a website.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h3&gt;GhostDoc and SandCastle Help File Builder&lt;/h3&gt;  &lt;p&gt;To get started with SandCastle for documentation, I recommend a few additional tools: &lt;a href="http://submain.com/products/ghostdoc.aspx"&gt;GhostDoc&lt;/a&gt; and &lt;a href="http://shfb.codeplex.com/"&gt;SandCastle Help File Builder&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://submain.com/products/ghostdoc.aspx"&gt;GhostDoc&lt;/a&gt; is a Visual Studio extension that allows quick XML documentation to be generated based on naming convention for methods, properties and parameters. XML documentation is the heart of how SandCastle generates documentation, so being able to quickly generate simple comments is a great benefit. The Pro version of GhostDoc also allows for customizations based on T4 templating.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://shfb.codeplex.com/"&gt;SandCastle Help File Builder&lt;/a&gt; is a second Codeplex project that adds a GUI and additional support for SandCastle to make the overall experience of its use even better.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h3&gt;Installation&lt;/h3&gt;  &lt;p&gt;For a comprehensive installation guide, check out the &lt;a href="http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/8c0c97d0-c968-4c15-9fe9-e8f3a443c50a.htm"&gt;SandCastle Help File Builder Installation Instructions&lt;/a&gt;. Their guided installer is easy to use and will verify that everything you need is in the right place. It will also let you know if you are lacking any dependencies you might need for generating specific help file types.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;Usage&lt;/h3&gt;  &lt;p&gt;Once you have SHFB installed, open the SandCastle Help File Builder GUI and select &lt;strong&gt;File &amp;gt; New Project… &lt;/strong&gt;then choose a location and name for your project. I follow the conventions for project naming that we use for any other project type and add the project to a subdirectory of the code solution.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/image_thumb.png" width="504" height="379" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;SHFB saves projects as shfbproj types. These types can be built using MSBuild and incorporated into your current build processes. Do note that the time to generate documentation has a fair amount of overhead to reflect through your generated code.&lt;/p&gt;  &lt;p&gt;After you have saved your project you can proceed to customize the sources to document by right clicking &lt;strong&gt;Documentation Sources&lt;/strong&gt; then browsing to either the solution, project, or dll file you would like to include.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/SS-2011-10-25_19.58.35_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SS-2011-10-25_19.58.35" border="0" alt="SS-2011-10-25_19.58.35" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/SS-2011-10-25_19.58.35_thumb.png" width="537" height="216" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you are looking to generate an HTML site specifically, this can be set on the &lt;strong&gt;HelpFileFormat&lt;/strong&gt; under the &lt;strong&gt;Build&lt;/strong&gt; section of the project properties.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/SS-2011-10-25_20.04.16_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SS-2011-10-25_20.04.16" border="0" alt="SS-2011-10-25_20.04.16" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/SS-2011-10-25_20.04.16_thumb.png" width="544" height="288" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Afterwards, just select &lt;strong&gt;Documentation &amp;gt; Build Project&lt;/strong&gt; to create your very own MSDN-esque documentation!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/SS-2011-10-25_20.09.45_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SS-2011-10-25_20.09.45" border="0" alt="SS-2011-10-25_20.09.45" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/Windows-Live-Writer/Code-Documentation-Generation-with-Ghost_11244/SS-2011-10-25_20.09.45_thumb.png" width="552" height="414" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h3&gt;Links&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://sandcastle.codeplex.com"&gt;http://sandcastle.codeplex.com&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://shfb.codeplex.com/"&gt;http://shfb.codeplex.com/&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://submain.com/products/ghostdoc.aspx"&gt;http://submain.com/products/ghostdoc.aspx&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/8c0c97d0-c968-4c15-9fe9-e8f3a443c50a.htm"&gt;http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/8c0c97d0-c968-4c15-9fe9-e8f3a443c50a.htm&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://broadcast.oreilly.com/2010/09/build-html-documentation-for-y.html"&gt;http://broadcast.oreilly.com/2010/09/build-html-documentation-for-y.html&lt;/a&gt;&lt;/p&gt; &lt;img src="http://wtfnext.com/aggbug/147454.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2011/10/25/code-documentation-generation-with-sandcastle.aspx</guid>
            <pubDate>Wed, 26 Oct 2011 01:15:38 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/147454.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2011/10/25/code-documentation-generation-with-sandcastle.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/147454.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/147454.aspx</trackback:ping>
        </item>
        <item>
            <title>Unit Testing Role-based Authorization in ASP.NET MVC 3</title>
            <link>http://wtfnext.com/archive/2011/08/23/unit-testing-role-based-authorization-in-asp.net-mvc-3.aspx</link>
            <description>&lt;p&gt;When testing in ASP.NET MVC3, one of the common elements you might want to test is authorization. Although the framework does most of the heavy lifting for ASP.NET Membership and authorization it is still worthwhile to be able to write a test to show that the proper Authorization tag is in place.&lt;/p&gt;  &lt;p&gt;You might think that it’s as easy as calling the method on the controller with a proper context, but that’s not the case. When you call the methods directly on the controller the authorizations are skipped. These authorizations are handled by the ActionInvoker when the MVC application runs, so in order to test this via MVC itself &lt;a href="http://stackoverflow.com/questions/669175/unit-testing-asp-net-mvc-authorize-attribute-to-verify-redirect-to-login-page"&gt;would take a lot of cruft&lt;/a&gt;. Since we trust that ASP.NET MVC is doing its job correctly it is easier to simply &lt;a href="http://darioquintana.com.ar/blogging/2009/05/23/aspnet-mvc-testing-a-custom-authorize-filters/"&gt;test for the presence of the attributes&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Since this is such a common task I ventured forth to create an extension method that will accomplish exactly what I want with the API I want. Using a lambda syntax most of us are familiar with from mocking frameworks, the final product yields a test method like the following:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;TestMethod()&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; Register_WhenUserIsInAdministratorRole_ShouldBeAuthorized()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;'Arrange&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; target = &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; AccountController()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #008000"&gt;'Assert&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     target.AssertRoleIsAuthorizedForAction(&lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt;(a) a.Register(&lt;span style="color: #0000ff"&gt;New&lt;/span&gt; RegisterModel()), &lt;span style="color: #006080"&gt;"Administrator"&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Simply pass in a lambda of the action you are attempting to test along with the role you expect authorization to be successful for. The extension method code is as follows:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;Extension()&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; AssertRoleIsAuthorizedForAction(Of T &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; Controller)(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; controller &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; T,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; expression &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; Expression(Of Action(Of T)), role &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #008000"&gt;'Arrange&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #008000"&gt;'Get method from expression&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; callExpression = &lt;span style="color: #0000ff"&gt;TryCast&lt;/span&gt;(expression.Body, MethodCallExpression)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; callExpression &lt;span style="color: #0000ff"&gt;Is&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;Throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; ArgumentException(&lt;span style="color: #006080"&gt;"Could not determine method from expression"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"expression"&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;'Act&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; roles = callExpression.Method.GetCustomAttributes(&lt;span style="color: #0000ff"&gt;GetType&lt;/span&gt;(AuthorizeAttribute), inherit:=&lt;span style="color: #0000ff"&gt;True&lt;/span&gt;) _&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         .Cast(Of AuthorizeAttribute)() _&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         .Where(&lt;span style="color: #0000ff"&gt;Function&lt;/span&gt;(a) &lt;span style="color: #0000ff"&gt;Not&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;.IsNullOrEmpty(a.Roles)) _&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         .SelectMany(&lt;span style="color: #0000ff"&gt;Function&lt;/span&gt;(a) a.Roles.Split(&lt;span style="color: #006080"&gt;","&lt;/span&gt;)) _&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;         .ToList()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;     &lt;span style="color: #008000"&gt;'Assert&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;     Assert.IsTrue(roles.Contains(role))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The method takes the given lambda and extracts the method. Then the AuthorizeAttributes for the method that include roles are split into a list of roles. Finally we assert that the list of roles contains our role in question.&lt;/p&gt;

&lt;p&gt;In C#:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; [TestMethod]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Register_WhenUserIsInAdministratorRole_ShouldBeAuthorized()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//arrange&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     var accountController = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; AccountController();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//assert&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     accountController.AssertRoleIsAuthorizedForAction(ac =&amp;gt; ac.Register(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RegisterModel()), &lt;span style="color: #006080"&gt;"Administrator"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 335px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 280px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; AssertRoleIsAuthorizedForAction&amp;lt;T&amp;gt;(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; T controller, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     Expression&amp;lt;Action&amp;lt;T&amp;gt;&amp;gt; expression, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; role) &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; T : Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Arrange&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Get method from expression&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     var callExpression = expression.Body &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; MethodCallExpression;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(callExpression == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentException(&lt;span style="color: #006080"&gt;"Could not determine method from expression"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"expression"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Act&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     var roles = callExpression.Method.GetCustomAttributes(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(AuthorizeAttribute),&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         .Cast&amp;lt;AuthorizeAttribute&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         .Where(a =&amp;gt; !&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.IsNullOrEmpty(a.Roles))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         .SelectMany(a =&amp;gt; a.Roles.Split(&lt;span style="color: #006080"&gt;','&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         .ToList();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Assert&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;     Assert.IsTrue(roles.Contains(role));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;References: 
  &lt;br /&gt;&lt;a title="http://stackoverflow.com/questions/669175/unit-testing-asp-net-mvc-authorize-attribute-to-verify-redirect-to-login-page" href="http://stackoverflow.com/questions/669175/unit-testing-asp-net-mvc-authorize-attribute-to-verify-redirect-to-login-page"&gt;http://stackoverflow.com/questions/669175/unit-testing-asp-net-mvc-authorize-attribute-to-verify-redirect-to-login-page&lt;/a&gt; 

  &lt;br /&gt;&lt;a title="http://darioquintana.com.ar/blogging/2009/05/23/aspnet-mvc-testing-a-custom-authorize-filters/" href="http://darioquintana.com.ar/blogging/2009/05/23/aspnet-mvc-testing-a-custom-authorize-filters/"&gt;http://darioquintana.com.ar/blogging/2009/05/23/aspnet-mvc-testing-a-custom-authorize-filters/&lt;/a&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:043a21a7-3225-42e4-bc3d-0f609b278ee5" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MVC" rel="tag"&gt;MVC&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ASP.NET" rel="tag"&gt;ASP.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ASP.NET+MVC3" rel="tag"&gt;ASP.NET MVC3&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MVC3" rel="tag"&gt;MVC3&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Unit+Testing" rel="tag"&gt;Unit Testing&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Authorize" rel="tag"&gt;Authorize&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/146639.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2011/08/23/unit-testing-role-based-authorization-in-asp.net-mvc-3.aspx</guid>
            <pubDate>Tue, 23 Aug 2011 13:02:13 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/146639.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2011/08/23/unit-testing-role-based-authorization-in-asp.net-mvc-3.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/146639.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/146639.aspx</trackback:ping>
        </item>
        <item>
            <title>MSXML 6 failure on SQL Server 2005 Tools install</title>
            <link>http://wtfnext.com/archive/2009/09/09/msxml-6-failure-on-sql-server-2005-tools-install.aspx</link>
            <description>&lt;p&gt;Today I ran into this problem when setting up the SQL Server Management Tools for SQL Server 2005. Like any good little code slinger, I googled (if you are particular to Microsoft, you can read that as “binged”) to see who’s had the problem, because it’s no news that when you aren’t on the crest of the tech wave that someone else has had the same issue.&lt;/p&gt;  &lt;p&gt;In particular, MSXML 6 would fail and the log would have a message similar to:&lt;/p&gt;  &lt;pre&gt;MSI (s) (40:58) [22:16:00:859]: MainEngineThread is returning 1605&lt;/pre&gt;

&lt;p&gt;Well, undoubtedly I found many other results for others who have had this issue, primarily those that have XP SP3. To get around this failure, you’ve got to install the tool available at the link below and then use it to remove any entry starting with MSXML 6. For me, I had two entries, one “parser” and one SP2. Afterwards, just start the install over again.&lt;/p&gt;

&lt;p&gt;I think what made the experience frustrating for me is that the SQL Server 2005 Setup fails in too friendly of a way. I’m used to the brutal honesty of the NUnit GUI. Give me a big red bar to illustrate how bad I failed or get out.&lt;/p&gt;

&lt;p&gt;For the uninstall tool:
  &lt;br /&gt;&lt;a title="http://support.microsoft.com/kb/290301" href="http://support.microsoft.com/kb/290301"&gt;http://support.microsoft.com/kb/290301&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A couple resources about the problem itself:
  &lt;br /&gt;&lt;a title="http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/493b5a95-1af6-4ec1-aa24-92875e4497c0" href="http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/493b5a95-1af6-4ec1-aa24-92875e4497c0"&gt;http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/493b5a95-1af6-4ec1-aa24-92875e4497c0&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://www.eggheadcafe.com/conversation.aspx?messageid=33740907&amp;amp;threadid=33664744" href="http://www.eggheadcafe.com/conversation.aspx?messageid=33740907&amp;amp;threadid=33664744"&gt;http://www.eggheadcafe.com/conversation.aspx?messageid=33740907&amp;amp;threadid=33664744&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:75dcd724-1ef7-4520-8d89-bc111ba4be31" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MSXML6" rel="tag"&gt;MSXML6&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MSXML" rel="tag"&gt;MSXML&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SQLServer2005" rel="tag"&gt;SQLServer2005&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SQL+Server+2005" rel="tag"&gt;SQL Server 2005&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/134587.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/09/09/msxml-6-failure-on-sql-server-2005-tools-install.aspx</guid>
            <pubDate>Thu, 10 Sep 2009 02:37:39 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/134587.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/09/09/msxml-6-failure-on-sql-server-2005-tools-install.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/134587.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/134587.aspx</trackback:ping>
        </item>
        <item>
            <title>How To: Create a plugin architecture in VB.NET</title>
            <link>http://wtfnext.com/archive/2009/05/06/how-to-create-a-plugin-architecture-in-vb.net.aspx</link>
            <description>&lt;p&gt;Creating a plugin architecture in .NET can be achieved in a few steps using the .NET framework. All it takes is a little time, a common interface and reflection. In this blog we’re going to look at how to make a simple plugin that performs basic integer calculations. &lt;span style="font-weight: bold; font-style: italic;"&gt;As a disclaimer, this method is not CLS compliant.&lt;/span&gt; If that is necessary for you, then stick around and I hope to have a new version that maintains compliance posted.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;The code in this blog is mostly illustrative, and the full code is available on CodePlex at the following link:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://wtfnext.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27051" title="http://wtfnext.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27051"&gt;http://wtfnext.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27051&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Setting up a common interface&lt;/h1&gt;
&lt;p&gt;Our main console application has to know just basic things about our plugin. It doesn’t need to know any more about it than that it complies to an expected interface. For this example, our plugins must:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Expose a class named Plugin&lt;/li&gt;
    &lt;li&gt;The class must implement our common interface: IPlugin.&lt;/li&gt;
    &lt;li&gt;The plugin must end in “Plugin.dll” and be present in the application directory.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If we get all of these done, we can connect to the plugin successfully. The first step is to define the IPlugin interface, which acts as the basic contract between any plugin and the console application. We’ll place this in its own project to compile into a separate DLL, so that we can easily reference it from our plugin projects.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;Public Interface &lt;/span&gt;IPlugin&lt;br /&gt;    &lt;span style="color: blue;"&gt;ReadOnly Property &lt;/span&gt;Name() &lt;span style="color: blue;"&gt;As String&lt;br /&gt;    ReadOnly Property &lt;/span&gt;ActionName() &lt;span style="color: blue;"&gt;As String&lt;br /&gt;    Sub &lt;/span&gt;Calculate(&lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value1 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value2 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;End Interface&lt;/span&gt;&lt;/pre&gt;
&lt;h1&gt;
&lt;p&gt;     &lt;/p&gt;
&lt;/h1&gt;
&lt;h1&gt;Consuming the interface according to our rules&lt;/h1&gt;
&lt;p&gt;So our calculation plugins will expose the name, what their action is and a calculate function that operates on two values. We can create an example plugin that performs addition:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;Public Class &lt;/span&gt;Plugin&lt;br /&gt;    &lt;span style="color: blue;"&gt;Implements &lt;/span&gt;IPlugin&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;ReadOnly Public Property &lt;/span&gt;Name() &lt;span style="color: blue;"&gt;As String Implements &lt;/span&gt;IPlugin.Name&lt;br /&gt;        &lt;span style="color: blue;"&gt;Get&lt;br /&gt;            Return &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;"Addition"&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;End Get&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    ReadOnly Public Property &lt;/span&gt;ActionName() &lt;span style="color: blue;"&gt;As String Implements &lt;/span&gt;IPlugin.ActionName&lt;br /&gt;        &lt;span style="color: blue;"&gt;Get&lt;br /&gt;            Return &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;"Add Values"&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;End Get&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;    Public Sub &lt;/span&gt;Calculate (&lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value1 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal &lt;/span&gt;value2 &lt;span style="color: blue;"&gt;As Integer&lt;/span&gt;) &lt;span style="color: blue;"&gt;Implements &lt;/span&gt;IPlugin.Calculate&lt;br /&gt;        &lt;span style="color: blue;"&gt;Dim &lt;/span&gt;result &lt;span style="color: blue;"&gt;As Integer &lt;/span&gt;= value1 + value2&lt;br /&gt;        MessageBox.Show (&lt;span style="color: rgb(163, 21, 21);"&gt;"The result is " &lt;/span&gt;+ result.ToString)&lt;br /&gt;    &lt;span style="color: blue;"&gt;End Sub&lt;br /&gt;End Class&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;See how we named the class that implements the plugin as just Plugin? This is because this is what the consol application expects. We can have other classes and whatnot in our plugin that do the meat of our work, but the application that consumes the plugin only cares that the possible plugin follow our rules stated earlier.&lt;/p&gt;
&lt;h1&gt;Checking and consuming the plugin&lt;/h1&gt;
&lt;p&gt;In our console application, all we’ve got to do is grab our possible plugins, then check their validity. Once we’re sure it is valid, we can consume it via the interface.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;Dim &lt;/span&gt;asm &lt;span style="color: blue;"&gt;As &lt;/span&gt;Assembly = Assembly.LoadFrom(possiblePlugin)&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim &lt;/span&gt;myType &lt;span style="color: blue;"&gt;As &lt;/span&gt;System.Type = asm.GetType(asm.GetName.Name + &lt;span style="color: rgb(163, 21, 21);"&gt;".Plugin"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim &lt;/span&gt;implementsIPlugin &lt;span style="color: blue;"&gt;As Boolean &lt;/span&gt;= &lt;span style="color: blue;"&gt;GetType&lt;/span&gt;(IPlugin).IsAssignableFrom(myType)&lt;br /&gt;&lt;span style="color: blue;"&gt;If &lt;/span&gt;implementsIPlugin &lt;span style="color: blue;"&gt;Then&lt;br /&gt;    &lt;/span&gt;Console.WriteLine(asm.GetName.Name + &lt;span style="color: rgb(163, 21, 21);"&gt;" is a valid plugin!"&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;Dim &lt;/span&gt;plugin &lt;span style="color: blue;"&gt;As &lt;/span&gt;IPlugin = &lt;span style="color: blue;"&gt;CType&lt;/span&gt;(Activator.CreateInstance(myType), IPlugin)&lt;br /&gt;    Console.WriteLine(&lt;span style="color: rgb(163, 21, 21);"&gt;"{0}: {1}"&lt;/span&gt;, plugin.Name, plugin.ActionName)&lt;br /&gt;    plugin.Calculate(5, 4)&lt;br /&gt;&lt;span style="color: blue;"&gt;End If&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;h1&gt;Wrapping things up&lt;/h1&gt;
&lt;p&gt;Well, this was a quick and dirty look at implementing your own plugin architecture into your application. Please leave feedback or questions. I’d be happy to hear both!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline; float: none;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:425965f3-ceb0-4370-b300-bdfc9054f29a" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/VB.NET"&gt;VB.NET&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Plugin"&gt;Plugin&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/architecture"&gt;architecture&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/131855.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/05/06/how-to-create-a-plugin-architecture-in-vb.net.aspx</guid>
            <pubDate>Thu, 07 May 2009 01:19:35 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/131855.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/05/06/how-to-create-a-plugin-architecture-in-vb.net.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/131855.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/131855.aspx</trackback:ping>
        </item>
        <item>
            <title>Hot-To: Model a Work Breakdown Structure with Project 2007 and Visio 2007</title>
            <link>http://wtfnext.com/archive/2009/01/11/hot-to-model-a-work-breakdown-structure-with-project-2007-and.aspx</link>
            <description>&lt;p&gt;If you’re trying to make a WBS from your suite of 2007 applications, &lt;a title="The people who keep me having a good job." href="http://www.microsoft.com" target="_blank"&gt;Microsoft&lt;/a&gt; Download Center has a Visio add-on that might save you some time.&lt;/p&gt;  &lt;p&gt;To get a WBS pumped out quickly, just do the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download and install &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=34c28a49-e14c-4a7d-8d49-90061fe08ab4&amp;amp;displaylang=en" target="_blank"&gt;Microsoft Office Visio 2007 WBS Modeler&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;Open Visio, and start from the new WBS Modeler.&lt;/li&gt;    &lt;li&gt;Open Project and open the project you want to make a WBS for.&lt;/li&gt;    &lt;li&gt;In Visio, click WBS Modeler, then &lt;strong&gt;Import From Microsoft Office Project…&lt;/strong&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Click through a couple more settings and here you have it. An easy WBS, and best of all it is free! When I was looking around the best alternative looks like it will run you around $200.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:0f7d1049-b340-43fe-9c74-e1e536fffcc9" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Project" rel="tag"&gt;Project&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Visio" rel="tag"&gt;Visio&lt;/a&gt;,&lt;a href="http://technorati.com/tags/WBS" rel="tag"&gt;WBS&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/128572.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/01/11/hot-to-model-a-work-breakdown-structure-with-project-2007-and.aspx</guid>
            <pubDate>Mon, 12 Jan 2009 00:05:25 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128572.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/01/11/hot-to-model-a-work-breakdown-structure-with-project-2007-and.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128572.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128572.aspx</trackback:ping>
        </item>
        <item>
            <title>How-To: Enumerate the Internet Explorer Installed OpenSearch Engines</title>
            <link>http://wtfnext.com/archive/2008/11/26/how-to-enumerate-the-internet-explorer-installed-opensearch-engines.aspx</link>
            <description>&lt;p&gt;For my recent &lt;a href="http://www.codeplex.com/launcher"&gt;Launcher&lt;/a&gt; project, I was constructing a ribbon that would allow the user to search the web via their engines installed in Internet Explorer. The engines themselves are an XML document following the &lt;a href="http://www.opensearch.org/Home"&gt;OpenSearch&lt;/a&gt; schema. For firefox, these xml documents just get stored locally. What does IE do with theirs?&lt;/p&gt;  &lt;p&gt;Well, IE sticks them in the registry. &lt;strong&gt;Why?&lt;/strong&gt; Maybe someone else can answer that. Here's a brief look at how to get the search engines out of the registry. The following snippets of code come from the &lt;a href="http://www.codeplex.com/launcher"&gt;launcher&lt;/a&gt; project. If you want to see how I abstracted the engines and the complete code, you can &lt;a href="http://www.codeplex.com/launcher"&gt;download it from Codeplex&lt;/a&gt;. If you want to critique the code or make suggestions on how I can code better, leave me a comment here. I'm not the best programmer and I'm starving to learn.&lt;/p&gt;  &lt;p&gt;First off, lets give a simple answer to this post: &lt;strong&gt;How do I enumerate the IE search engines?&lt;/strong&gt; The search engines are located in &lt;em&gt;Software\Microsoft\Internet Explorer\SearchScopes&lt;/em&gt;, the rest of the task is just enumerating the keys and values to extract important information.&lt;/p&gt;  &lt;p&gt;First off, I made a straightforward structure to represent my individual search engine:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Public Structure &lt;/span&gt;SearchEngine
    &lt;span style="color: blue"&gt;Private &lt;/span&gt;m_DisplayName &lt;span style="color: blue"&gt;As String
    Public Property &lt;/span&gt;DisplayName() &lt;span style="color: blue"&gt;As String
        Get
            Return &lt;/span&gt;m_DisplayName
        &lt;span style="color: blue"&gt;End Get
        Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As String&lt;/span&gt;)
            m_DisplayName = value
        &lt;span style="color: blue"&gt;End Set
    End Property

    Private &lt;/span&gt;m_SearchString &lt;span style="color: blue"&gt;As String
    Public Property &lt;/span&gt;SearchString() &lt;span style="color: blue"&gt;As String
        Get
            Return &lt;/span&gt;m_SearchString
        &lt;span style="color: blue"&gt;End Get
        Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As String&lt;/span&gt;)
            m_SearchString = value
        &lt;span style="color: blue"&gt;End Set
    End Property

    Private &lt;/span&gt;m_isDefault &lt;span style="color: blue"&gt;As Boolean
    Public Property &lt;/span&gt;isDefault() &lt;span style="color: blue"&gt;As Boolean
        Get
            Return &lt;/span&gt;m_isDefault
        &lt;span style="color: blue"&gt;End Get
        Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As Boolean&lt;/span&gt;)
            m_isDefault = value
        &lt;span style="color: blue"&gt;End Set
    End Property

    Public Overrides Function &lt;/span&gt;ToString() &lt;span style="color: blue"&gt;As String
        Return &lt;/span&gt;m_DisplayName.ToString
    &lt;span style="color: blue"&gt;End Function
End Structure&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;This structure just contains the display name, the search string and whether or not it is the default.&lt;/p&gt;

&lt;p&gt;I fill a list of search engines as so:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;GatherEnginesFromRegistry()
    &lt;span style="color: green"&gt;'Clear list
    &lt;/span&gt;m_engineList.Clear()

    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;regKey &lt;span style="color: blue"&gt;As &lt;/span&gt;RegistryKey = Registry.CurrentUser.OpenSubKey(&lt;span style="color: #a31515"&gt;"Software\Microsoft\Internet Explorer\SearchScopes"&lt;/span&gt;, &lt;span style="color: blue"&gt;False&lt;/span&gt;)
    &lt;span style="color: green"&gt;'Gather Default key
    &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;defaultKey &lt;span style="color: blue"&gt;As String &lt;/span&gt;= regKey.GetValue(&lt;span style="color: #a31515"&gt;"DefaultScope"&lt;/span&gt;)

    &lt;span style="color: green"&gt;'Gather all search engines
    &lt;/span&gt;&lt;span style="color: blue"&gt;For Each &lt;/span&gt;subKey &lt;span style="color: blue"&gt;As String In &lt;/span&gt;regKey.GetSubKeyNames
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;engine &lt;span style="color: blue"&gt;As New &lt;/span&gt;SearchEngine
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;engineKey &lt;span style="color: blue"&gt;As &lt;/span&gt;RegistryKey = regKey.OpenSubKey(subKey)
        &lt;span style="color: blue"&gt;If &lt;/span&gt;engineKey.GetValue(&lt;span style="color: #a31515"&gt;""&lt;/span&gt;) = &lt;span style="color: blue"&gt;String&lt;/span&gt;.Empty &lt;span style="color: blue"&gt;Then
            &lt;/span&gt;engine.DisplayName = engineKey.GetValue(&lt;span style="color: #a31515"&gt;"DisplayName"&lt;/span&gt;)
        &lt;span style="color: blue"&gt;Else
            &lt;/span&gt;engine.DisplayName = engineKey.GetValue(&lt;span style="color: #a31515"&gt;""&lt;/span&gt;)
        &lt;span style="color: blue"&gt;End If
        &lt;/span&gt;engine.SearchString = engineKey.GetValue(&lt;span style="color: #a31515"&gt;"URL"&lt;/span&gt;)
        &lt;span style="color: blue"&gt;If &lt;/span&gt;(subKey = defaultKey) &lt;span style="color: blue"&gt;Then
            &lt;/span&gt;engine.isDefault = &lt;span style="color: blue"&gt;True
        Else
            &lt;/span&gt;engine.isDefault = &lt;span style="color: blue"&gt;False
        End If
        &lt;/span&gt;m_engineList.Add(engine)
        engineKey.Close()
    &lt;span style="color: blue"&gt;Next

    &lt;/span&gt;regKey.Close()
&lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Here you see &lt;strong&gt;regKey &lt;/strong&gt;as a key to the SearchScopes subkey within CURRENT_USER. Within SearchScopes the &lt;strong&gt;DefaultScope&lt;/strong&gt; value contains the subkey name for the default search engine.&lt;/p&gt;

&lt;p&gt;After fetching the name of the default engine, I just iterate through eachsubKey and convert it into my structure, and add it to a generic list. The important values being &lt;strong&gt;DisplayName&lt;/strong&gt; and &lt;strong&gt;URL&lt;/strong&gt;. However, if the &lt;strong&gt;(Default)&lt;/strong&gt; value for the subkey is specified, I take it instead of the &lt;strong&gt;DisplayName&lt;/strong&gt;. Why? because LiveSearch does this oddity:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/HowToEnumeratetheInternetExplorerInstall_BB23/image_8.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="123" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/HowToEnumeratetheInternetExplorerInstall_BB23/image_thumb_3.png" width="504" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;DisplayName&lt;/strong&gt; is a DLL call of sorts and the &lt;strong&gt;(Default)&lt;/strong&gt; is the name? What's up with that? :\&lt;/p&gt;

&lt;p&gt;And finally, to use the search within an application just replace the &lt;strong&gt;{searchTerms} &lt;/strong&gt;in the URL with the appropriate URI formatted text and send it on its way via &lt;strong&gt;Process.Start&lt;/strong&gt;!&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;btnSearch_Click(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As &lt;/span&gt;System.Object, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) &lt;span style="color: blue"&gt;Handles &lt;/span&gt;btnSearch.Click
    Process.Start(searchURL.Replace(&lt;span style="color: #a31515"&gt;"{searchTerms}"&lt;/span&gt;, ConvertStringToURI(searchText)))
&lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6d715787-06d9-423d-a02f-832a87f2eef4" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/How-To" rel="tag"&gt;How-To&lt;/a&gt;,&lt;a href="http://technorati.com/tags/IE%20Search%20Engine%20Enumeration" rel="tag"&gt;IE Search Engine Enumeration&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/127411.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/11/26/how-to-enumerate-the-internet-explorer-installed-opensearch-engines.aspx</guid>
            <pubDate>Thu, 27 Nov 2008 01:27:41 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/127411.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/11/26/how-to-enumerate-the-internet-explorer-installed-opensearch-engines.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/127411.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/127411.aspx</trackback:ping>
        </item>
        <item>
            <title>How to: Set up Google Analytics on your GeeksWithBlogs blog</title>
            <link>http://wtfnext.com/archive/2008/11/21/how-to-set-up-google-analytics-on-your-geekswithblogs-blog.aspx</link>
            <description>&lt;p&gt;If you haven't seen Google analytics before, you ought to know this: it rocks. You'll get great reports on everything from geographic location to browser to flash version (Why no Silverlight version, eh Google?) See example awesomeness here:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/HowtoSetupGoogleAnalyticsonyourGeeksWith_B658/image_2.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="393" alt="image" width="504" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/HowtoSetupGoogleAnalyticsonyourGeeksWith_B658/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Obviously I've only recently set this up. However, since it is up and running and working great, I figured I'd show you how to get yours up and running as well.&lt;/p&gt;
&lt;p&gt;Firstly, sign up for &lt;a href="http://www.google.com/analytics"&gt;Google Analytics&lt;/a&gt;. Then afterwards, Google will provide a script to monitor the site usage. But if you can't access the head for your site, where do you put it? Good question. Almost million dollar.&lt;/p&gt;
&lt;p&gt;So since there's only one question when it comes to Google Analytics and GWB, I figured I'd just throw out the answer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Q. Where do I put the JavaScript thingy?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A. Put it in your news section. Google screams a tantrum that you've got to stick it in the &amp;lt;head&amp;gt; of your html, but the whole thing works out fine right in the news section (which you can edit in your GWB admin panel).&lt;/p&gt;
&lt;p&gt; So my next question is, &lt;strong&gt;&lt;em&gt;Does anyone know how to get Google Webmaster Tools working on GWB?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:85a7d264-7826-4fa2-8e0e-1a5306306363" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/geekswithblogs"&gt;geekswithblogs&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/google%20analytics"&gt;google analytics&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/127285.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/11/21/how-to-set-up-google-analytics-on-your-geekswithblogs-blog.aspx</guid>
            <pubDate>Sat, 22 Nov 2008 00:58:08 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/127285.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/11/21/how-to-set-up-google-analytics-on-your-geekswithblogs-blog.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/127285.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/127285.aspx</trackback:ping>
        </item>
        <item>
            <title>Custom Code Snippets Series Part 3: XML Example</title>
            <link>http://wtfnext.com/archive/2008/11/04/custom-code-snippets-series-part-3-xml-example.aspx</link>
            <description>&lt;p&gt;Hey guys,&lt;/p&gt;  &lt;p&gt;Here we are, and I’m taking the time to finish up my first series at my new host &lt;a title="My hosting solution, you got a technical blog? Could be yours too!" href="http://www.geekswithblogs.net" rel="" target="_blank"&gt;geekswithblogs&lt;/a&gt;! For this part of the series we’ll be taking a look at a practical example of an XML snippet, namely the snippet to create snippets.&lt;/p&gt;  &lt;p&gt;I’ve created my own version, but if you’ve toyed with XML snippets before you would know that Microsoft has already included a snippet snippet. This is a good alternative to the “Hard” way described in Part 1, but what if you want a little more of a custom feel to your snippet snippet?&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h1&gt;Getting Started&lt;/h1&gt;  &lt;p&gt;This time around I’ve published the code on &lt;a href="http://www.codeplex.com/"&gt;Codeplex&lt;/a&gt;, at the following address:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/wtfnextsnippetseries" href="http://www.codeplex.com/wtfnextsnippetseries"&gt;http://www.codeplex.com/wtfnextsnippetseries&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can download the premade snippet directly, and then we’ll be looking into the elements of the snippet briefly.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h1&gt;A look through the XML&lt;/h1&gt;  &lt;p&gt;This snippet is fairly straightforward, and many of the items you might recognize if you are familiar with snippets or have gone through the first part of this series. Our header section is straightforward, and we make good use of literals.&lt;/p&gt;  &lt;p&gt;There is one literal that we need to note here: &lt;strong&gt;CDATAEND&lt;/strong&gt;. There’s a bit of a quirk that requires a workaround when making an XML snippet, and that’s if we need to use a CDATA section within our snippet itself.&lt;/p&gt;  &lt;p&gt;The problem is that a &lt;a href="http://www.w3schools.com/XML/xml_cdata.asp"&gt;CDATA section cannot contain another CDATA section&lt;/a&gt;. As a result, making a snippet of another snippet becomes complicated. How do you do it? Simply put a literal in the CDATA of your snippet that represents the terminator for the internal CDATA in the snippet.&lt;/p&gt;  &lt;p&gt;So, we see in the snippet itself this:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: gray"&gt;    &amp;lt;Snippet&amp;gt;
      &amp;lt;Code Language="$Language$"&amp;gt;
        &amp;lt;![CDATA[$selected$$CDATAEND$
      &amp;lt;/Code&amp;gt;
    &amp;lt;/Snippet&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;and we have the literal &lt;strong&gt;CDATAEND&lt;/strong&gt; defined as this:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Literal &lt;/span&gt;&lt;span style="color: red"&gt;Editable&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;false&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;CDATAEND&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Default&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;]]&lt;span style="color: red"&gt;&amp;amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Default&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Literal&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;The &lt;strong&gt;$selected$&lt;/strong&gt; is a placeholder for any selected text when we use the &lt;strong&gt;SurroundsWith&lt;/strong&gt; datatype. This allows us to highlight some VB or whatever and when we insert the snippet it automatically knows we want the code selected to be surrounded by our snippet, and have the selection inserted at the &lt;strong&gt;$selected$&lt;/strong&gt; point.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h1&gt;Summary&lt;/h1&gt;

&lt;p&gt;So this concludes the brief look at snippets, and I want to tell you guys that I’ll appreciate any feedback. The “Hard” way isn’t really that bad, and all in all (if you’re like me) it gives you complete quick control over your snippet creation. The “Easy” way is an external application, and is designed with syntax highlighting for a language specific creation, so you won’t be popping out the XML or C# snippets from the VB snippet creator.&lt;/p&gt;

&lt;p&gt;Please post comments if you have criticisms or anything to say, I’m looking forward to improving the quality of this blog and of myself, and feedback will help with both!&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d5295045-18ea-4128-b807-e76885e00919" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Custom+Code+Snippets+Series" rel="tag"&gt;Custom Code Snippets Series&lt;/a&gt;,&lt;a href="http://technorati.com/tags/snippet" rel="tag"&gt;snippet&lt;/a&gt;,&lt;a href="http://technorati.com/tags/xml" rel="tag"&gt;xml&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/126613.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/11/04/custom-code-snippets-series-part-3-xml-example.aspx</guid>
            <pubDate>Wed, 05 Nov 2008 00:45:58 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/126613.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/11/04/custom-code-snippets-series-part-3-xml-example.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/126613.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/126613.aspx</trackback:ping>
        </item>
        <item>
            <title>Custom Code Snippets Series Part 2 of 3: The &amp;ldquo;Easy&amp;rdquo; Way</title>
            <link>http://wtfnext.com/archive/2008/10/20/custom-code-snippets-series-part-2-of-3-the-ldquoeasyrdquo.aspx</link>
            <description>&lt;p&gt;Here we are at part two of the Custom Code Snippet Series. In the &lt;a href="http://geekswithblogs.net/WTFNext/archive/2008/10/14/custom-code-snippets-series-part-1-of-3-the-ldquohardrdquo.aspx"&gt;previous part&lt;/a&gt; we covered how to make your own snippet by creating an XML .snippet file and adding to it the necessary content to get a custom snippet up and running.&lt;/p&gt;  &lt;p&gt;This time around, we’re going to cover the “Easy” method of creating custom code snippets: through a GUI. Thankfully, the MSDN itself has a Code Snippet Editor for both Visual Basic 2005 and 2008 available at the following links. This tutorial will make use of the Visual Basic 2005 Code Snippet Editor.&lt;/p&gt;  &lt;p&gt;To get the 2005 version:   &lt;br /&gt;&lt;a title="http://msdn.microsoft.com/en-us/vbasic/ms789085.aspx" href="http://msdn.microsoft.com/en-us/vbasic/ms789085.aspx"&gt;http://msdn.microsoft.com/en-us/vbasic/ms789085.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;to get the 2008 version:   &lt;br /&gt;&lt;a title="http://msdn.microsoft.com/en-us/vbasic/bb973770.aspx" href="http://msdn.microsoft.com/en-us/vbasic/bb973770.aspx"&gt;http://msdn.microsoft.com/en-us/vbasic/bb973770.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, after installing the Code Snippet Editor, we’re ready to get started.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h1&gt;Add the path to My Code Snippets&lt;/h1&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;p&gt;Right off the bat, you can tell we are going to have a small issue. Looking through the tree in the snippet editor does not show the custom code snippets! That’s alright, we’ll just add our path.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Right-click&lt;/strong&gt; in the tree view area of the program and select &lt;strong&gt;Add Path…&lt;/strong&gt;. Browse to the path we discussed for saving snippets in the previous part:&lt;strong&gt;My Documents &amp;gt; Visual Studio &lt;em&gt;YYYY&lt;/em&gt; &amp;gt; Code Snippets &amp;gt; &lt;em&gt;Language of Choice&lt;/em&gt; &amp;gt; My Code Snippets&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_2.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px" height="172" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_thumb.png" width="308" border="0" /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now we can see our custom code snippets in the editor. If you’ve done the previous part in this series you should see the &lt;strong&gt;cmdWrite&lt;/strong&gt; snippet show up in the tree under the &lt;strong&gt;My Code Snippets&lt;/strong&gt; folder:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_4.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="136" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_thumb_1.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h1&gt;Create new snippet in My Code Snippets&lt;/h1&gt;  &lt;p&gt;Why do I stress putting the new snippets in our &lt;strong&gt;My Code Snippets&lt;/strong&gt; folder? If you want a centralized location that is somewhat protected from other users of the computer, in your &lt;strong&gt;My Documents &lt;/strong&gt;folder makes sense. You might even want to make your own location that you point Visual Studio to, that way you can implement version control to make sure changes benefit your code and rollback if they do not.&lt;/p&gt;  &lt;p&gt;To create a new snippet, just right click the folder and select &lt;strong&gt;Add New Snippet&lt;/strong&gt;. Name your snippet, today we’re going to make a simple For loop, so I’ll name this one &lt;strong&gt;ForLoop&lt;/strong&gt;. Obviously, you’ll make snippets that matter more.&lt;/p&gt;  &lt;p&gt;Once you create the snippet, double click on it. Here you’ll see a GUI representation of the XML document. Fairly straightforward.&lt;/p&gt;  &lt;p&gt;To start, let’s fill in our info. Here’s what I put:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_8.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="201" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_thumb_3.png" width="443" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Now let’s put in our VB code into the editor at the top. Here’s what I put:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;Dim &lt;/span&gt;&lt;span style="background: white; color: black"&gt;count &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;as integer &lt;/span&gt;&lt;span style="background: white; color: black"&gt;= 0
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;Dim &lt;/span&gt;&lt;span style="background: white; color: black"&gt;countMax &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;as integer &lt;/span&gt;&lt;span style="background: white; color: black"&gt;= 100

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;For &lt;/span&gt;&lt;span style="background: white; color: black"&gt;count = 0 &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;to &lt;/span&gt;&lt;span style="background: white; color: black"&gt;countMax
    &lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;'Something to do
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;Next&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Now we’ll transform this code into a dynamic snippet. I want &lt;strong&gt;count&lt;/strong&gt; to be a choice for the variable name, so highlight &lt;strong&gt;count&lt;/strong&gt; and on the &lt;strong&gt;Replacements&lt;/strong&gt; tab at the bottom hit the yellow plus sign.&lt;/p&gt;

&lt;p&gt;count will become surrounded by $ symbols, and become a decadent orange color. At the bottom, you’ll see that most information has been filled in for us. For type, we’ll leave it blank, and for tooltip, we’ll just describe the replacement. Now, do the same for &lt;strong&gt;countMax&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We’re practically done! Flip over to the &lt;strong&gt;Test&lt;/strong&gt; tab and hit the big test button. Did it work okay? If so, we’re ready to find it in VS and start using it, just make sure to save your snippet!&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h1&gt;Check it out in Visual Studio&lt;/h1&gt;

&lt;p&gt;Go ahead and close the Snippet Editor and open up a new console project in Visual Studio, VB of course.&lt;/p&gt;

&lt;p&gt;If you’ve set up the same snippet as me, go ahead and type &lt;strong&gt;ForLoop?&lt;/strong&gt; and hit &lt;strong&gt;Tab&lt;/strong&gt; twice and you should see your new snippet come to life!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_10.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="212" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/WTFNext/WindowsLiveWriter/CustomCodeSnippetsSeriesPart2of3TheEasyW_9A47/image_thumb_4.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:843b2943-eebe-4c53-acd3-0b658386f552" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Custom+Code+Snippets+Series" rel="tag"&gt;Custom Code Snippets Series&lt;/a&gt;,&lt;a href="http://technorati.com/tags/VB+.NET" rel="tag"&gt;VB .NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Tutorials" rel="tag"&gt;Tutorials&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/125954.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/10/20/custom-code-snippets-series-part-2-of-3-the-ldquoeasyrdquo.aspx</guid>
            <pubDate>Mon, 20 Oct 2008 22:58:08 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/125954.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/10/20/custom-code-snippets-series-part-2-of-3-the-ldquoeasyrdquo.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/125954.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/125954.aspx</trackback:ping>
        </item>
        <item>
            <title>For those geeks that want decent looking &amp;lt;pre&amp;gt; code</title>
            <link>http://wtfnext.com/archive/2008/10/14/for-those-geeks-that-want-decent-looking-ltpregt-code.aspx</link>
            <description>&lt;p&gt;I mashed together a variety of random web resources on how to make a decent pre tag for code and the output looks like this (ignore how incredibly bad this code is... I was testing SVN and making sporadic changes... Steve McConnell would strangle me):&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: blue"&gt;Module &lt;/span&gt;Module1
    &lt;span style="COLOR: blue"&gt;Sub &lt;/span&gt;Main()
        Console.BackgroundColor = ConsoleColor.DarkBlue
        Console.ForegroundColor = ConsoleColor.White
        Console.Clear()

        &lt;span style="COLOR: blue"&gt;My&lt;/span&gt;.User.InitializeWithWindowsUser()

        &lt;span style="COLOR: blue"&gt;Dim &lt;/span&gt;sw &lt;span style="COLOR: blue"&gt;As New &lt;/span&gt;Stopwatch()
        sw.Start()

        &lt;span style="COLOR: blue"&gt;Dim &lt;/span&gt;username &lt;span style="COLOR: blue"&gt;As String &lt;/span&gt;= &lt;span style="COLOR: blue"&gt;My&lt;/span&gt;.User.IsInRole(ApplicationServices.BuiltInRole.Administrator).ToString

        Console.WriteLine(&lt;span style="COLOR: #a31515"&gt;"User is admin: " &lt;/span&gt;&amp;amp; username &amp;amp; &lt;span style="COLOR: #a31515"&gt;"!"&lt;/span&gt;)
        sw.Stop()
        Console.WriteLine(&lt;span style="COLOR: #a31515"&gt;"Time: " &lt;/span&gt;&amp;amp; sw.Elapsed.ToString)
        Console.ReadLine()

        
    &lt;span style="COLOR: blue"&gt;End Sub
End Module&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;There’s word wrap, and it’s at least differentiated from the rest of the post nicely IMO. the code is as follows:&lt;/p&gt;
&lt;pre&gt;&lt;p&gt;pre {border: solid 1px #CCCCCC; &lt;/p&gt;
&lt;p&gt; font-size: 1.3 em;   &lt;br /&gt; margin: 10px; 
&lt;br /&gt; padding:10px; 
&lt;br /&gt; background: #EEEEEE; &lt;/p&gt;
&lt;p&gt; white-space: pre-wrap;  &lt;br /&gt; white-space: -moz-pre-wrap !important;
&lt;br /&gt; white-space: -pre-wrap;
&lt;br /&gt; white-space: -o-pre-wrap; 
&lt;br /&gt; word-wrap: break-word;
&lt;br /&gt;}&lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;Hope it helps some of you other code bloggers :)&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:121934da-67a6-4bfe-8b18-5b4919a5aff6" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Code"&gt;Code&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Pre"&gt;Pre&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/CSS"&gt;CSS&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/GWB"&gt;GWB&lt;/a&gt;&lt;/div&gt; &lt;img src="http://wtfnext.com/aggbug/125841.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/10/14/for-those-geeks-that-want-decent-looking-ltpregt-code.aspx</guid>
            <pubDate>Wed, 15 Oct 2008 01:48:51 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/125841.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/10/14/for-those-geeks-that-want-decent-looking-ltpregt-code.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/125841.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/125841.aspx</trackback:ping>
        </item>
    </channel>
</rss>
