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);
        }
        void TaxesViewAddTax(object sender, System.EventArgs e)
        {
            var tax = new Tax(_taxesView.TaxType, _taxesView.StartDate, _taxesView.EndDate, _taxesView.Jurisdiction,
                              _taxesView.Percent);

            _taxesService.AddTax(tax);
            DisplayAllTaxes();
        }
        public async Task <IHttpActionResult> AddTax([FromBody] TaxDto taxDto)
        {
            var addTax = await _taxesService.AddTax(taxDto);

            if (addTax == null)
            {
                return(BadRequest("Something wrong data to allow it to add"));
            }

            return(Ok(addTax));
        }
        public void CountryDelegatesAddedTaxesToInjectedTaxesService()
        {
            // expectations
            var pstTax = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.Country, 5);

            _mockTaxesService.AddTax(pstTax);

            _mockRepository.ReplayAll();

            var country = new Country("MB", _mockTaxesService);

            country.AddTax(pstTax);
        }
        public void ProvinceStateDelegatesAddedTaxesToInjectedTaxesService()
        {
            // expectations
            var pstTax = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.ProvinceState);

            _mockTaxesService.AddTax(pstTax);

            _mockRepository.ReplayAll();

            var provinceState = new ProvinceState("MB", _mockTaxesService);

            provinceState.AddTax(pstTax);
        }
Beispiel #6
0
        public void CityDelegatesAddedTaxesToInjectedTaxesService()
        {
            // expectations
            var pstTax = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.City);

            _mockTaxesService.AddTax(pstTax);

            _mockRepository.ReplayAll();

            var city = new City("Winnipeg", _mockTaxesService);

            city.AddTax(pstTax);
        }
 public void AddTax(Tax tax)
 {
     _taxesService.AddTax(tax);
 }