public void TaxCodeDetermination() { var taxCode = TaxCode.Parse("S1100L"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(true, taxCode.IsScotlandTax); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("D0"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(false, taxCode.IsScotlandTax); Assert.AreEqual(true, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("K666"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(false, taxCode.IsScotlandTax); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(true, taxCode.IsPrefixCode); TaxCode.TryParse("!", out taxCode); Assert.AreEqual(false, taxCode.IsValidTaxCode); Assert.AreEqual(false, taxCode.IsScotlandTax); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); }
public void ErroneousCodeHandling() { // Test TryParse Assert.AreEqual(false, TaxCode.TryParse("ABC", out var failedTaxCode)); Assert.AreEqual(false, TaxCode.TryParse("!", out failedTaxCode)); Assert.AreEqual(false, TaxCode.TryParse(null, out failedTaxCode)); // Test Parse try { TaxCode.Parse("ABC"); Assert.Fail(); } catch { } try { TaxCode.Parse("!"); Assert.Fail(); } catch { } try { TaxCode.Parse(null); Assert.Fail(); } catch { } }
public void TaxCodeDetermination() { var taxCode = TaxCode.Parse("S1100L"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.Scottish, taxCode.Regime); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("C1250L"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.Welsh, taxCode.Regime); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("D0"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.rUK, taxCode.Regime); Assert.AreEqual(true, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("0T"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.rUK, taxCode.Regime); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("K666"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.rUK, taxCode.Regime); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(true, taxCode.IsPrefixCode); TaxCode.TryParse("!", out taxCode); Assert.AreEqual(false, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.rUK, taxCode.Regime); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); TaxCode.TryParse("D2", out taxCode); Assert.AreEqual(false, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.rUK, taxCode.Regime); Assert.AreEqual(false, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); taxCode = TaxCode.Parse("SD2"); Assert.AreEqual(true, taxCode.IsValidTaxCode); Assert.AreEqual(TaxRegime.Scottish, taxCode.Regime); Assert.AreEqual(true, taxCode.IsNoAdjustmentCode); Assert.AreEqual(false, taxCode.IsPrefixCode); }