Thursday, 20 November 2014

Testing for Exceptions with NUnit

I’ve been aware for a long time usual way of writing a unit test with NUnit that expects an Exception to be thrown is to use the ExpectedExceptionAttribute on the test method.

[ExpectedException(typeof(ArgumentException)]
[Test]
public void Test()
{
    var sut = new ThrowUp();

    sut.DodgyMethod(3);
}

I hadn’t noticed that around the release of NUnit 2.5, an alternative was added. The Assert.Throws method allows you to be specific about which bit of code in the test should be throwing an exception.

public void Test()
{
    var sut = new ThrowUp();

    Assert.Throws<ArgumentException>( () => sut.DodgyMethod(3) );
}

I think it’s a good improvement, and makes it a bit clearer where the exception should be coming from.

Tuesday, 11 November 2014

ADNUG November–Azure for Developers

With the recent announcement that Azure now has two data centres located in Australia, I thought it was appropriate for the Adelaide .NET User Group (ADNUG) to spend some time looking at what’s involved in hosting your applications in the ‘cloud’.

The session will review what features Azure offers, and then we’ll step through hosting a simple web application and then scaling it up and out.

Register at http://www.acs.org.au/branches/south-australia/events/upcoming-events/event-details?eveID=10310633303016

Wednesday 12th November 2014 at 6.00 pm at Marcellina Adelaide (273 Hindley Street, Adelaide)

6.00 Pizzas and Networking
6.20 What’s New (Ryan Spears)
6.40 A Developer's guide to Microsoft Azure (David Gardiner)

Look forward to seeing you there!