示例#1
0
        public void IsFreeOfTax_ShouldReturn_Correct_False()
        {
            var grossSalary    = 1000.1m;
            var expectedResult = false;

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

            var salaryService = new SalaryService(servicesCollection);

            var result = salaryService.IsFreeOfTax(grossSalary);

            Assert.AreEqual(expectedResult, result);
        }
        public void IsFreeOfTax_ShouldReturn_True()
        {
            var grossFreeOfTax = 1000m;
            var expectedResult = true;

            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.IsFreeOfTax(grossFreeOfTax);

            Assert.AreEqual(expectedResult, result);
        }