Using AutoMoq

This is an example of using AutoMoq.

It requires the use of NUnit and the AutoMoq NuGet packages.

As far as I can see there is no difference between the Create and Resolve methods.

ILSpy confirms that the generic resolve calls the generic create method.

using AutoMoq;
using Moq;
using NUnit.Framework;

namespace TestLib
{
public interface IFoo
{
string Execute();
}

public class Class1
{
private IFoo _foo;

public Class1(IFoo foo)
{
_foo = foo;
}

public string Write()
{
return string.Format(“>{0}<“, _foo.Execute());
}
}

[TestFixture]
public class TestMe
{
AutoMoqer _autoMoqer;

[SetUp]
public void Setup()
{
_autoMoqer = new AutoMoqer();
}

[Test]
public void A()
{
Mock<IFoo> mockFoo = _autoMoqer.GetMock<IFoo>();
mockFoo.Setup(a => a.Execute()).Returns(“Hello”);
Class1 c = _autoMoqer.Create<Class1>();

//Act and Assert
Assert.That(c.Write(), Is.EqualTo(“>Hello<“));
}

[Test]
public void B()
{
var c = _autoMoqer.Resolve<Class1>();

//Act and Assert
Assert.That(c.Write(), Is.EqualTo(“><“));
}
}

}

Powershell and TFS

I have been experimenting with controlling tfs with powershell.
Mostly this consists of creating wrappers for the command-line tools.

Here is the github repo: https://github.com/chriseyre2000/Powershell/tree/master/Posh-Tfs

It can perform checkin and checkouts.
More usefully it can inform you that you have files in your tfs mapped folders that are not checked in or excluded – Get-tfsStatus(). This can greatly help in avoiding broken builds. Visual Studio’s tfs integration while better than it has been can still be a little problematic.

The posh-tfpt library is a wrapper around the tfs power tools.
The tf command line is great for checkins, changeset and version queries.

The tfpt adds the ability to query work items. I have not been able to reliably update work items.
Not sure if I am doing something wrong or if the cloud version of tfs that I am using is somewhat limited.

These will provide useful examples:

get-help select-tfsworkitemquery -Examples

These queries have been based upon:

http://msdn.microsoft.com/en-us/library/bb130306%28v=vs.90%29.aspx

Why can't I write to the Emulated Cloud Table Storage with the latest storage api?

http://blogs.msdn.com/b/windowsazurestorage/archive/2013/11/27/windows-azure-storage-release-introducing-cors-json-minute-metrics-and-more.aspx

It seems that microsoft have failed to keep the emulator in line with the storage account api.

I am trying to use the nuget package WindowsAzure.Storage.3.0.2.0

I have an attempt at creating a powershell script to query table storage.

It can be found on https://github.com/chriseyre2000/Powershell/tree/master/Azure

I plan on using the previous version windowsazure.storage 2.1.0.4 to see if that works against the emulator.

When working in Azure you need to keep up with versions before they are disabled, but if you go too far then it will hurt.