May 27 2007

Create TFS Work Items Using Outlook 2007

Category: Cool ProductsJoeGeeky @ 18:23

If you have every read through the SSW Rules to Better... you can see how may people live within Outlook.  In fact, there was a really interesting DotNetRocks Show that spoke with one of the SSW authors, and it is worth a listen.  Recently, I found a neat Outlook 2007 plugin that lets me add TFS Work Items from within Outlook and saves me the time of entering Team Explorer.  I have been using it for a little while and it is pretty nice...  That being said, this product requires use of integrated Windows Domain credentials and does not work for people making Workgroup-style connections.

Team System Outlook 2007 Addin - v1.0
http://blogs.microsoft.co.il/blogs/srlteam/archive/2007/03/04/Team-System-Outlook-2007-Addin-_2D00_-v1.0.aspx

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.

Tags:

May 26 2007

Manage TFS Source From the Windows Shell

Category: Cool ProductsJoeGeeky @ 12:36

I ran across the below blog entry and was really excited...  Back in the days when we all dreaded Visual Source Safe (VSS), many of us used open source products like CVS and SVN.  One of the great tools that grew out of this community was a Source Control Client that was implemented as a Windows Shell Extension. TortoiseCVS and TortoiseSVN, are really easy to use Revision, Version, and Source control software. Until now there was no similar solution for TFS-based source control.  Dubbelbock TFS is the first project to attempt to bring a shell integrated experience to TFS users. 

Benjamin Day Consulting Blog Entry

Since it's not an integration for a specific IDE you can use it with whatever development tools you like. TortoiseSVN is free to use. You don't need to get a loan or pay a full years salary to use it. Ever heard of Tortoise SVN?  It's a great tool that lets you control Subversion source control from Windows Explorer.  Right-click on a file or folder and you can do operations like check-in, check-out, add, etc.

I use Team Foundation Server for my source control and have missed the convenience of being able to access source like that.  So, I wrote it. 

This is the official announcement of “Dubbelbock TFS“.  With Dubbelbock you can select a directory or file and do “Get Latest“, “Check in“, “Check out“, “Lock“, “Add“, “Undo“, “View Status“, “Compare to Server Version (diff)“, and “View History“.

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.

Tags:

May 23 2007

TFS Work Item Vista Gadgets

Category: Cool ProductsJoeGeeky @ 23:56

For those of you who use Team Systems here a couple of Vista Gadgets to help keep you update to date on Work Item Numbers.  Ostensibly, these are targeting the out-of-the-box Microsoft Process Template.  I am using the Conchango SCRUM Process Template so these are not 100% for the SCRUM process template.  Enjoy 

TFS Tasks

http://gallery.live.com/liveItemDetail.aspx?li=bded877c-aead-4ed3-82db-387eef322f86&bt=1&pl=1 

TFS Projects

http://gallery.live.com/liveItemDetail.aspx?li=443cb551-fb75-494a-9c70-cded2ec5d882&bt=1&pl=1

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.

Tags:

May 18 2007

How to make a web service call from javascript

Category: Tips and TricksJoeGeeky @ 22:10

The other day I was having a coversation with a couple of my colleague about making web service calls via JavaScript.  Within the .NET Web Service Ecosystem (e.g. ASMX web services) there are two popular technologies which are being used to facilitate this process

  • Microsoft AJAX Extensions
    • In order to make AJAX calls using this, the target Web Service must be decorated with the ‘[ScriptService]’ attribute which can be a problem if you do not own the web service.
  • JavaScript SOAP Client
    • This is an open source project that is delivered in the form of a .js file.  The good news here is that you can see how it all works and have complete control over what you put in your projects

Here are a couple of links to get started with either… 

Microsoft AJAX Extensions:
http://ajax.asp.net/docs/
(Look at the ‘Web Services’ Section)

Open Source JavaScript SOAP Client:
http://www.guru4.net/articoli/javascript-soap-client/en/

Working DEMOs
http://www.guru4.net/articoli/javascript-soap-client/demo/en.aspx

As a side note, either of these can be handy if you are developing service oriented Vista Gadgets...  Enjoy...

Tags:

May 16 2007

How to invoke a web service without a Web Reference

Category: Tips and TricksJoeGeeky @ 04:08

At some point in your career you will need or want to call a Web Service from either a class library, a server control, HTTPModule, etc... If your lucky, you will soon realize that making a "Web Reference" in these types of projects is; at the very least; problemattic.  So what if you could reflect a Web Service and then invoke it as you would with other object types, assemblies, and so forth...  Well...  You can.  Below you will find a link to a commented class that you can use to make late-bound calls to web services given there WSDL Path, Service Name, and Service Type Name (e.g. class name).  Once you are familiar with its inner workings it is pretty easy to extend to support custom SOAP Headers, Type Reflection, etc...

samplewsinvoker.htm (32.88 kb)

Once you have the invoker, making a web service call is pretty simple.

Dim wsInvoker As New WebServiceReflectedMethodInvoker(
    "http://localhost/service/service.asmx?WSDL", "service", "service")
Dim arguments As New OrderedDictionary
Dim user As Object
arguments.Add("username", Username)
arguments.Add("userIsOnline", True)
'Execute the WS 
user = wsInvoker.InvokeWebServiceMethod("GetUser", arguments)

Here is yet another side note...  There is a performance hit when you make this type of call as compared to a "Web Reference".  However, one benefit is that you do not have to keep a lot of extraneous proxy classes under source control for methods and classes you do not plan on using.  Additionally, you will not run into problems related to needed "Update Web Reference" just to keep your solution up to date.

Tags: ,

May 2 2007

How to make unit tests transactional in TFS

Category: Selfish MotivationJoeGeeky @ 17:01

At some point, all good developers make the realization that Unit Testing is not evil and is the best way to ensure your code works as you expect it to. With that said, the moment you start writing tests for methods that interact with a database you start to run into some really unique problems that can lead to a lot of unneeded code. 

Generally speaking you always want to leave the system as you found it when testing started. That means that any data you add/edit/delete during the test needs to be restored when the test has concluded.  For the longest time I would spend my time writing test rigs to manage all these functions for each data method being tested.  It didn't take me long to realize that this was a waste of time and that there had to be a way to make this easier.

With that in mind  I set out to make my unit tests transactional since transactions have rollback support. Stealing a trick from the COM world I was able to find a way to make my test transactional. Here is what you need to do. As I go though this, keep in mind that I am using TFS Unit Tests run against a Microsoft SQL Server. This same technique can be used with other technologies (Ex. NUnit) although the syntax will be different.

One last note... If you look at the line "config.TransactionTimeout = 900", this may seem like a really long time. This is set to this length to ensure you have plenty of time to step through code during tests. Adjust this as needed.

Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports System
Imports System.Configuration
Imports System.EnterpriseServices

''' <summary>
''' Abstract class defining a transactional baseline for database driven unit tests
''' </summary>
<TestClass()> _
Public MustInherit Class DatabaseTransactionTestClass
    ''' <summary>
    ''' Hold a defined in progress transaction
    ''' </summary>
    Private TestTransactionScope As TransactionScope
    ''' <summary>
    ''' Init method to setup transaction requirements
    ''' </summary>
    <ClassInitialize()> _
    Public Shared Sub TransactionSetup(ByVal testContext As TestContext)
        Dim config As ServiceConfig = New ServiceConfig()
        config.Transaction = TransactionOption.RequiresNew
        config.TransactionTimeout = 900
        config.IsolationLevel = TransactionIsolationLevel.RepeatableRead
        ServiceDomain.Enter(config)
    End Sub
    ''' <summary>
    ''' Cleanup method to roll-back all database changes
    ''' </summary>
    <ClassCleanup()> _
    Public Shared Sub TransactionTearDown()
        RollbackTransaction()
        ServiceDomain.Leave()
    End Sub
    ''' <summary>
    ''' Init method to define the start of a transaction on a per-test basis 
    ''' </summary>
    <TestInitialize()> _
    Public Sub TestSetup()
        TestTransactionScope = New TransactionScope
    End Sub
    ''' <summary>
    ''' Cleanup method to close and abort the transaction
    ''' </summary>
    <TestCleanup()> _
    Public Sub TestCleanup()
        If Not TestTransactionScope Is Nothing Then
            TestTransactionScope.Dispose()
        End If
    End Sub
    ''' <summary>
    ''' Rolls back and existing test level transactions as defined by the TestTransactionScope
    ''' </summary>
    Public Shared Sub RollbackTransaction()
        If ContextUtil.IsInTransaction Then
            ContextUtil.SetAbort()
        End If
    End Sub
End Class

Tags: ,