Skip Navigation Links / Posts / Posts By Category

Posts for Category: Tools

Feed for this Category
Outlook 2007 TFS Addin

If you are working with TFS then I behoove you to install this great TFS add-in for Outlook:

Outlook 2007 TFS Addin

When installed this add-in surfaces as a little toolbar in Outlook and allows you to create work items directly from emails simply by clicking on a "New" button.  The workflow scenarios that this enables are very useful indeed.  Now I can shoot an email off to my customer with a question, get a detailed reply from them, and convert the whole conversation to a work item.  A great way to ensure that you don't miss any customer requests while helping keep your inbox empty at the same time!

posted on 7/19/2007 9:10:12 AM ( 0 Comments )


t3rse::proper

David Seruyange has built this great little macro/code generator to produce property definitions from a terse little grammar.  Basically you can type a string like this:

int Age;Dictionary<int,string> AdditionalData;

And Proper will generate property stubs that look like this:

private int _age;
public int Age{
    get{ return _age; }
    set{ _age=value; }
}

private Dictionary<int,string> _additionalData;
public Dictionary<int,string> AdditionalData{
    get{ return _additionalData; }
    set{ _additionalData=value; }
}

What a great idea... especially when you have a large number of properties to generate!

Proper is a tool that generates properties in a few different languages with a lot less typing than is usually done in an editor. The syntax is simple:

Source: t3rse::proper

posted on 1/11/2007 7:44:00 AM ( 3 Comments )


Using Rhino Mocks to test objects

Yesterday Phil Haack posted up this nice post about how to code the MVP pattern in a web application.  The implementation would look fairly familiar to anyone who has used MVC before but apparently big 'A' guy Martin Fowler asserts that there are now many different flavors of a model-view-controller|presenter pattern and in this post, Phil is showing us what the Supervising Controller pattern looks like.

One of the best things that I learned most from Phil's post was how he used the Rhino.Mocks library to create mock objects for his unit tests of his code.  This looks like a very simple way to test code that is normally difficult to test - such as ASP.NET code or code whose state is heavily reliant upon certain runtime conditions to be met.  In such cases you'll often find yourself factoring code out into interfaces and then writing testable stubs for them.  Mock objects save you from writing lots of additional code just for the sake of getting testable stubs of objects.  Here's some code from Phil's sample project in his post where he tests the events and the state of a view in his test code:

[TestMethod]
public void HandlesLoadEventAndSetsViewPropertiesCorrectly()
{
    //Setup the service return values.
 BlogPost blogPost = new BlogPost(1);
    blogPost.Tags.Add(new Tag("ASP.NET"));
 blogPost.Tags.Add(new Tag("C#"));
   
    blogPost.Description = "My computer's cup holder is broken.";
   
    //Setup the load event
    viewMock.Load += null; //ugly syntax, I know, but the only way to get this to work
    IEventRaiser loadRaiser = LastCall.IgnoreArguments().GetEventRaiser();

    // Make sure that the proper service methods were called
    // by the presenter.
    Expect.Call(this.dataServiceMock.GetById(1)).Return(blogPost);
    mocks.ReplayAll();

    //Now run the test.
    new PostEditController(viewMock, this.dataServiceMock);
    loadRaiser.Raise(viewMock, EventArgs.Empty);
   
    //Check that the view was properly populated.
    Assert.AreEqual(2, viewMock.Tags.Count);
    Assert.AreEqual("My computer's cup holder is broken.", viewMock.BlogPostBody);

    mocks.VerifyAll();
}

If the code looks a little odd then read from one of Phil's other fine article where he specifically shows how to use Rhino.Mocks to test events - that will help explain what some of that code is doing.

posted on 8/11/2006 3:31:58 AM ( 1 Comments )


Vance Morrison's perf blog

Vance Morrison is the Performance Architect for the CLR and has a blog here:

    http://blogs.msdn.com/vancem/

One of the things that Vance has said that he'll be blogging about is how to use tools to better monitor perf. 

Subscribed!

posted on 6/20/2006 3:00:43 PM ( 0 Comments )


Do you work with XML?

Here's a couple of tools that I wrote recently while doing a lot of work with XML.  The first tool is called XSLTTestHarness and it allows you to create XSLT's and view the output of a transform immediately.  Here is a screenshot of XSLTHarness:

XSLTTestHarness

[Grab the source code]


The next tool allows me to quickly validate XML against a schema by loading a schema and an XML file and pressing validate.  You are notified of any errors in the XML and you can correct the XML within the tool and re-submit it to re-validate it.  Here is a screenshot of SchemaValidator:

Schema Validator

[Grab the source code]

posted on 3/23/2006 9:21:27 AM ( 2 Comments )


How to debug your SchemaImporterExtension

As I mentioned yesterday, you can write a custom SchemaImporterExtension component to customize the output from XSD.  Basically I want to write my own extension so that I can control some of the syntax and semantics that are produced by XSD when I run it to create my business entity classes.  For example, out-of-the box XSD will name my fields something like: "rolecodeField" and doesn't create nice, strongly typed collections the way I want.  All-in-all I just want a very generic SchemaImporterExtension that will give me something like:

Fields: _camelCase
Properties: PascalCase
Collections: CustomCollection Inherits List<T>

At this stage I really have no idea how to write such a component but I have worked out how to attach the debugger to XSD to debug the class as you are writing it...

Grab XSD.exe (C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin) and copy it into the build directory for your project - most likely the \Bin\Debug folder.  Next, create an XSD.exe.config for XSD and add the following configuration information to it, this is the bit that tells XSD.exe to hook to your SchemaImporterExtension.

<configuration>
  <system.xml.serialization>
    <schemaImporterExtensions>
      <!-- This should refer to your SchemaImporterExtention class -->
      <add
        name="MarkItUp.GenericSchemaImporterExtention"  
        type="MarkItUp.GenericSchemaImporterExtention, Common, Version=1.0.0.0"
      />
    </schemaImporterExtensions>
  </system.xml.serialization>
</configuration>

Next, open up the Project Properties window for your Project and open up the "Debug" tab.  Set the start action to "Start External Application" and point it to the XSD.exe program that you copied into your \bin folder.  Something like:

C:\Projects\SchemaImporterTests\Common\bin\Debug\xsd.exe

In the start options field, type in the command line arguments that will allow XSD.exe to point to a .xsd file.  This will look something like:

"C:\Projects\SchemaImporterTests\XSD\Test.xsd" /classes /o:"C:\Projects\SchemaImporterTests\XSD\Bin"

This will create classes based on Test.xsd and output a file named Test.cs into the C:\Projects\SchemaImporterTests\XSD\Bin folder.

Finally, create your GenericSchemaImporterExtention class in your project and set a breakpoint somewhere in the ImportSchemaType method:

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization.Advanced;

namespace Common
{
  class GenericSchemaImporterExtention : SchemaImporterExtension
  {
    public override string ImportSchemaType(...)
    {
      string foo = "bar";
      return foo;
    }

  }
}

When you press Debug/Start your debug symbol will be hit!   Now you simply need to add the few small lines of code into the ImportSchemaType method and you are done, easy huh? :-)

posted on 9/9/2005 7:00:49 AM ( 2 Comments )


ASMX2 and SchemaImporterExtension links

I've been working on an application that is essentially a data processing pipeline.  Due to the nature of this service we essentially started from a contract-first design principle.  This was interesting as it forced me to look at many of the application development processes from a diffrent viewpoint and, in the process I discovered some really cool tools and articles that can help you design from a schema-first standpoint and wanted to blog about them so that I don't lose some links.

SchemaImporterExtension

After the schema contracts were defined the next task was to get the code generation tools in place to assist with the generation of business classes and some of the business and data component layers.  Here are some articles that describe how to use the SchemaImporterExtension class to meet any shortfalls from the out-of-the-box XSD.exe code.

    John Bristowe's tutorial on implementing SchemaImporterExtension
    Walking XMLSchema objects

ASMX2

    Christian Weyer talking about WebService enhancements in ASMX2

Schematron

We decided to use Schematron to assist with some of the data validation for business rule data constraints.  This is really nice an allows you to easily create standalone rulesets that can be applied against incoming XML documents to validate data constraints:

    http://www.schematron.com/spec.html

posted on 9/8/2005 4:00:22 AM ( 1 Comments )


Configuration Designer Base Class

I recently toiled with building a designer for use in the EntLib Configuration Tool:

    http://MarkItUp.com/Posts/Post.aspx?postId=adf62fde-bc04-4d52-8212-b4d5c53418f6

One of the things that struck me was how poorly abstracted the classes for doing this are.  I was hoping to get around to factoring out the common stuff into some base classes to help speed up the process but it seems that someone has beaten me to it :-)

    http://weblogs.asp.net/pgielens/archive/2005/08/12/422339.aspx

 

posted on 8/12/2005 11:09:36 AM ( 1 Comments )


CLR Profiler for .NET Framework V2

I was asking Mitch about CLR Profiler for Framework V2 - which obviously shows you how often I use it :-) - and he pointed me to Brian Johnson's article about it:

    http://blogs.msdn.com/brianjo/archive/2005/06/28/433395.aspx

posted on 8/7/2005 9:48:18 AM ( 0 Comments )