コード例 #1
0
        public void AddTaxEventCallsITaxesServiceAddAndReassignsToGridWithExtraRow()
        {
            _mockTaxesView.ShowTaxes += null;
            LastCall.IgnoreArguments();
            _mockTaxesView.AddTax += null;
            var                    addTaxEventRaiser = LastCall.IgnoreArguments().GetEventRaiser();
            const string           taxType           = "pstTax";
            DateTime?              startDate         = DateTime.Today;
            DateTime?              endDate           = DateTime.Today.AddYears(1);
            const JurisdictionEnum jurisdiction      = JurisdictionEnum.ProvinceState;
            const int              percent           = 5;

            Expect.Call(_mockTaxesView.TaxType).Return(taxType);
            Expect.Call(_mockTaxesView.StartDate).Return(startDate);
            Expect.Call(_mockTaxesView.EndDate).Return(endDate);
            Expect.Call(_mockTaxesView.Jurisdiction).Return(jurisdiction);
            Expect.Call(_mockTaxesView.Percent).Return(percent);
            var tax = new Tax(taxType, startDate, endDate, jurisdiction, percent);

            _mockTaxesService.AddTax(tax);
            var taxes = new List <Tax> {
                tax
            };

            Expect.Call(_mockTaxesService.Taxes).Return(taxes);
            _mockTaxesView.TaxesDisplay = taxes;

            _mockRepository.ReplayAll();

            var taxesPresenter = new TaxesPresenter(_mockTaxesService, _mockTaxesView);

            addTaxEventRaiser.Raise(_mockTaxesView, EventArgs.Empty);
        }
コード例 #2
0
 public List<Tax> TaxesByJurisdiction(JurisdictionEnum jurisdiction)
 {
     var taxesByJurisdiction = new List<Tax>();
     foreach (var tax in _taxes)
     {
         if (tax.Jurisdiction.Equals(jurisdiction))
             taxesByJurisdiction.Add(tax);
     }
     return taxesByJurisdiction;
 }
コード例 #3
0
ファイル: Tax.cs プロジェクト: dgadd/5-Day-TDD-Kata-Practise
        public Tax(string taxType, DateTime? startDate, DateTime? endDate, JurisdictionEnum jurisdiction)
        {
            _taxType = taxType;
            _startDate = startDate;
            _endDate = endDate;
            _jurisdiction = jurisdiction;

            ValidateAllParametersHaveNonNullValue();

            ValidateEndDateGreaterThanStartDate();
        }
コード例 #4
0
        public Tax(string taxType, DateTime?startDate, DateTime?endDate, JurisdictionEnum jurisdiction)
        {
            _taxType      = taxType;
            _startDate    = startDate;
            _endDate      = endDate;
            _jurisdiction = jurisdiction;

            ValidateAllParametersHaveNonNullValue();

            ValidateEndDateGreaterThanStartDate();
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JurisdictionsResponse" /> class.
 /// </summary>
 /// <param name="jurisdiction">jurisdiction (required).</param>
 public JurisdictionsResponse(JurisdictionEnum jurisdiction = default(JurisdictionEnum))
 {
     // to ensure "jurisdiction" is required (not null)
     if (jurisdiction == null)
     {
         throw new InvalidDataException("jurisdiction is a required property for JurisdictionsResponse and cannot be null");
     }
     else
     {
         this.Jurisdiction = jurisdiction;
     }
 }
コード例 #6
0
        public List <Tax> TaxesByJurisdiction(JurisdictionEnum jurisdiction)
        {
            var taxesByJurisdiction = new List <Tax>();

            foreach (var tax in _taxes)
            {
                if (tax.Jurisdiction.Equals(jurisdiction))
                {
                    taxesByJurisdiction.Add(tax);
                }
            }
            return(taxesByJurisdiction);
        }