public async Task IllegalScheduleOfTypeDay() { var request = new UpdateMunicipalityTaxRequest { MunicipalityTaxSchedule = new UpdateMunicipalityTaxScheduleModel { Municipality = "Vaerloese", ValidFrom = new DateTime(2020, 1, 1), ValidTo = new DateTime(2020, 1, 2), Tax = 0.4M, TaxScheduleType = TaxScheduleType.DAY } }; var response = await businessMunicipalityTaxScheduleuUpdaterEngine.UpdateMunicipalityTax(request); Assert.Equal(UpdateMunicipalityTaxStatus.ILLEGAL_INPUT, response.Status); request.MunicipalityTaxSchedule.ValidTo = new DateTime(2019, 1, 1); response = await businessMunicipalityTaxScheduleuUpdaterEngine.UpdateMunicipalityTax(request); Assert.Equal(UpdateMunicipalityTaxStatus.ILLEGAL_INPUT, response.Status); request.MunicipalityTaxSchedule.ValidTo = new DateTime(2020, 2, 1); response = await businessMunicipalityTaxScheduleuUpdaterEngine.UpdateMunicipalityTax(request); Assert.Equal(UpdateMunicipalityTaxStatus.ILLEGAL_INPUT, response.Status); }
public async Task ValidScheduleOfTypeDay() { var request = new UpdateMunicipalityTaxRequest { MunicipalityTaxSchedule = new UpdateMunicipalityTaxScheduleModel { Municipality = "Vaerloese", ValidFrom = new DateTime(2020, 1, 1, 12, 12, 12), ValidTo = new DateTime(2020, 1, 1, 17, 15, 13), Tax = 0.4M, TaxScheduleType = TaxScheduleType.DAY } }; var response = await businessMunicipalityTaxScheduleuUpdaterEngine.UpdateMunicipalityTax(request); Assert.Equal(UpdateMunicipalityTaxStatus.OK, response.Status); }
public async Task ValidScheduleOfTypeMonth() { var request = new UpdateMunicipalityTaxRequest { MunicipalityTaxSchedule = new UpdateMunicipalityTaxScheduleModel { Municipality = "Vaerloese", ValidFrom = new DateTime(2020, 2, 1), ValidTo = new DateTime(2020, 2, 29), Tax = 0.2M, TaxScheduleType = TaxScheduleType.MONTH } }; var response = await businessMunicipalityTaxScheduleuUpdaterEngine.UpdateMunicipalityTax(request); Assert.Equal(UpdateMunicipalityTaxStatus.OK, response.Status); }
public async Task IllegalValidScheduleWithEmptyMunicipality() { var request = new UpdateMunicipalityTaxRequest { MunicipalityTaxSchedule = new UpdateMunicipalityTaxScheduleModel { Municipality = "", ValidFrom = new DateTime(2020, 1, 1), ValidTo = new DateTime(2020, 1, 1), Tax = 0.4M, TaxScheduleType = TaxScheduleType.DAY } }; var response = await businessMunicipalityTaxScheduleuUpdaterEngine.UpdateMunicipalityTax(request); Assert.Equal(UpdateMunicipalityTaxStatus.ILLEGAL_INPUT, response.Status); }
public async Task <ActionResult> Put([FromBody] UpdateMunicipalityTaxScheduleModel request) { // TODO implmement ExceptionHandlerFilter try { var updateRequest = new UpdateMunicipalityTaxRequest { MunicipalityTaxSchedule = request }; IUpdateMunicipalityTaxResponse response = await businessMunicipalityTaxScheduleUpdaterEngine.UpdateMunicipalityTax(updateRequest); if (response.Status == UpdateMunicipalityTaxStatus.ILLEGAL_INPUT) { return(BadRequest()); } return(Ok()); } catch (Exception) { return(Problem()); } }