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); }
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; }
public Tax(string taxType, DateTime? startDate, DateTime? endDate, JurisdictionEnum jurisdiction) { _taxType = taxType; _startDate = startDate; _endDate = endDate; _jurisdiction = jurisdiction; ValidateAllParametersHaveNonNullValue(); ValidateEndDateGreaterThanStartDate(); }
public Tax(string taxType, DateTime?startDate, DateTime?endDate, JurisdictionEnum jurisdiction) { _taxType = taxType; _startDate = startDate; _endDate = endDate; _jurisdiction = jurisdiction; ValidateAllParametersHaveNonNullValue(); ValidateEndDateGreaterThanStartDate(); }
/// <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; } }
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); }