|
using NUnit.Framework;
namespace BusinessRules.Evolution_Five.Tests
{
[TestFixture]
public class TaxBandFixture
{
private TaxBand m_band;
/// <summary>
/// The Setup method is called before each test method is called.
/// So we recreate a new TaxBand object before each test.
/// </summary>
[SetUp]
public void Setup()
{
m_band = new TaxBand(0.0, 20000.00, 0.1);
}
/// <summary>
/// Validates the tax rate is correct after creating a new tax band.
/// </summary>
[Test]
public void ValidateTaxRateCorrectAfterCreatingNewTaxBand()
{
double expectedTaxRate = 0.1;
Assert.AreEqual(expectedTaxRate, m_band.TaxRate);
}
/// <summary>
/// Validates the calculate tax portion method behaves as expected.
/// </summary>
[Test]
public void ValidateCalculateTaxPortion()
{
Assert.AreEqual(0.0, m_band.CalculateTaxPortion(0.0));
Assert.AreEqual(1000.0, m_band.CalculateTaxPortion(10000.0));
Assert.AreEqual(500.0, m_band.CalculateTaxPortion(5000.0));
Assert.AreEqual(2000.0, m_band.CalculateTaxPortion(20000.0));
Assert.AreEqual(2000.0, m_band.CalculateTaxPortion(20001.0));
Assert.AreEqual(1254.6, m_band.CalculateTaxPortion(12546.0), 2.0);
Assert.AreEqual(2000.0, m_band.CalculateTaxPortion(12021541.0));
}
}
}
|
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.