~nunit-core/nunitv2/2.5

« back to all changes in this revision

Viewing changes to addins/RowTest/NUnitExtension.RowTest.Sample/VatCalculatorApp/VatCalculator.cs

  • Committer: charliepoole
  • Date: 2008-05-05 22:17:22 UTC
  • Revision ID: vcs-imports@canonical.com-20080505221722-7bdjujqed8pk6al3
Add back RowTestExtension as a separately compiled assembly, bundled
with NUnit, and modify build script to handle addins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// *********************************************************************
 
2
// Copyright 2007, Andreas Schlapsi
 
3
// This is free software licensed under the MIT license. 
 
4
// *********************************************************************
 
5
using System;
 
6
 
 
7
namespace NUnitExtension.RowTest.Sample.VatCalculatorApp
 
8
{
 
9
        public class VatCalculator
 
10
        {
 
11
                public VatCalculator()
 
12
                {
 
13
                }
 
14
                
 
15
                public decimal CalculateVat(decimal amount, VatCategoryType categoryType)
 
16
                {
 
17
                        return amount * GetTaxRate(categoryType);
 
18
                }
 
19
                
 
20
                private decimal GetTaxRate(VatCategoryType categoryType)
 
21
                {
 
22
                        switch(categoryType)
 
23
                        {
 
24
                                case VatCategoryType.CategoryA:
 
25
                                        return 0.2m;
 
26
                                        
 
27
                                case VatCategoryType.CategoryB:
 
28
                                        return 0.15m;
 
29
                                        
 
30
                                case VatCategoryType.CategoryC:
 
31
                                        return 0.1m;
 
32
                                        
 
33
                                default:
 
34
                                        throw new ArgumentException(string.Format("Invalid VatCategoryType '{0}'.", categoryType));
 
35
                        }
 
36
                }
 
37
        }
 
38
}