public void GermanyCalculateIncomeTax32Percent_GivenSalary_Returns_IncomeTaxContributionValue() { // Arrange var calculator = new GermanPayrollCalculator(); //Act var actual = calculator.CalculateIncomeTax(600); // Assert var expected = 192; actual.Should().Be(expected); }
public void GermanyCalculateIncomeTax_GivenSalaryLessThanZero_Returns_InvalidInputException() { // Arrange var germanSaleryCalculator = new GermanPayrollCalculator(); //Act Action calculateIncomeTax = () => germanSaleryCalculator.CalculateIncomeTax(-100); Action calculateTotalTaxDeductions = () => germanSaleryCalculator.CalculateTotalTaxDeductions(-200); // Assert string expectedMessage = "Given salary should be greater than zero, received value:"; calculateIncomeTax.Should().Throw <InvalidInputException>().Where(e => e.Message.StartsWith(expectedMessage)); calculateTotalTaxDeductions.Should().Throw <InvalidInputException>().Where(e => e.Message.StartsWith(expectedMessage)); }