public void CalculateSalary_ShouldReturnCorrectValue_WithFreeOfTaxInput()
        {
            var grossSalary     = 1000m;
            var mockTaxServices = new Mock <List <ITaxCalculator> >();
            var sut             = new SalaryService(mockTaxServices.Object);

            var result = sut.CalculateNetSalary(grossSalary);

            Assert.AreEqual(grossSalary, result);
        }
Esempio n. 2
0
        public void CalculateNetSalary_ShouldReturn_Correct()
        {
            var grossSalary    = 3400m;
            var expectedResult = 2860m;

            var servicesCollection = new List <ITaxCalculator>
            {
                new SocialTaxService(),
                new IncomeTaxService()
            };

            var salaryService = new SalaryService(servicesCollection);

            var result = salaryService.CalculateNetSalary(grossSalary);

            Assert.AreEqual(expectedResult, result);
        }
        public void CalculateSalary_ShouldReturnCorrectValue_WithAboveFreeOfTax()
        {
            var expectedResult   = 2860m;
            var grossSalaryAbove = 3400m;

            var mockIncomeTaxService = new Mock <IncomeTaxService>();
            var mockSocialTaxService = new Mock <SocialTaxService>();
            var taxServices          = new List <ITaxCalculator>
            {
                mockIncomeTaxService.Object,
                mockSocialTaxService.Object
            };

            var sut    = new SalaryService(taxServices);
            var result = sut.CalculateNetSalary(grossSalaryAbove);

            Assert.AreEqual(expectedResult, result);
        }