|
/*
* Created by: Maruis Marais
* Created: Saturday, 11 November 2006
*/
using NMock2;
using NUnit.Framework;
namespace BusinessRules.Evolution_Five.Tests
{
[TestFixture]
public class IncomeTaxBandGeneratorFixture
{
private Mockery mocks = null;
private ICurrentCultureInfo currentCulture = null;
/// <summary>
/// The Setup method is called before each test method is called.
/// </summary>
[SetUp]
public void Setup()
{
mocks = new Mockery();
currentCulture = mocks.NewMock<ICurrentCultureInfo>();
}
[Test]
public void ShouldReturnNewZealandTaxBandGenerator()
{
// Setup expectations for our mock.
Expect.Once.On(currentCulture).GetProperty("CurrentCultureName").Will(Return.Value("en-NZ"));
// Execute the behavior
ITaxBandGenerator generator = TaxBandGenerator.CreateInstance(currentCulture);
// Validate the results is as expected
Assert.IsNotNull(generator);
Assert.IsInstanceOfType(typeof (NewZealandTaxBandGenerator), generator);
}
[Test]
public void ShouldReturnAustralianTaxBandGenerator()
{
// Setup expectations for our mock.
Expect.Once.On(currentCulture).GetProperty("CurrentCultureName").Will(Return.Value("en-AU"));
// Execute the behavior
ITaxBandGenerator generator = TaxBandGenerator.CreateInstance(currentCulture);
// Validate the results is as expected
Assert.IsNotNull(generator);
Assert.IsInstanceOfType(typeof (AustralianTaxBandGenerator), generator);
}
[Test]
public void ShouldReturnUsaTaxBandGenerator()
{
// Setup expectations for our mock.
Expect.Once.On(currentCulture).GetProperty("CurrentCultureName").Will(Return.Value("en-US"));
// Execute the behavior
ITaxBandGenerator generator = TaxBandGenerator.CreateInstance(currentCulture);
// Validate the results is as expected
Assert.IsNotNull(generator);
Assert.IsInstanceOfType(typeof (UsaTaxBandGenerator), generator);
}
[Test]
public void ShouldReturnNullTaxBandGenerator()
{
// Setup expectations for our mock.
Expect.Once.On(currentCulture).GetProperty("CurrentCultureName").Will(Return.Value("en-ZA"));
// Execute the behavior
ITaxBandGenerator generator = TaxBandGenerator.CreateInstance(currentCulture);
// Validate the results is as expected
Assert.IsNotNull(generator);
Assert.IsInstanceOfType(typeof (NullTaxBandGenerator), generator);
}
/// <summary>
/// The Teardown method is called after each test method is called.
/// So we validate all the expectations have been met.
/// </summary>
[TearDown]
public void Teardown()
{
mocks.VerifyAllExpectationsHaveBeenMet();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.