Exemplo n.º 1
0
        public void Given_AnnumIncome_100000_ShouldReturn_17500()
        {
            //----------Setup---------------------------
            const double annualIncome          = 100000d;
            var          flatRateTaxCalculator = new FlatRateTaxCalculator(new Mock <IIncomeValidator>().Object);
            //--------Execute---------------------------
            var tax = flatRateTaxCalculator.Calculate(annualIncome);

            //--------Assert----------------------------
            Assert.AreEqual(17500d, tax);
        }
Exemplo n.º 2
0
        public void Given_AnnumIncome_63900_ShouldReturn_PercentageBasedValue()
        {
            //----------Setup---------------------------
            const double annualIncome          = 63900d;
            var          flatRateTaxCalculator = new FlatRateTaxCalculator(new Mock <IIncomeValidator>().Object);
            //--------Execute---------------------------
            var tax = flatRateTaxCalculator.Calculate(annualIncome);

            //--------Assert----------------------------
            Assert.AreEqual(11182.50d, tax);
        }
Exemplo n.º 3
0
        public void Given_Calculate_Should_Call_IncomeValidator_Validate()
        {
            //----------Setup---------------------------
            var mockValidator = new Mock <IIncomeValidator>();

            mockValidator.Setup(m => m.Validate(It.IsAny <double>()));
            var flatRateTaxCalculator = new FlatRateTaxCalculator(mockValidator.Object);

            //--------Execute---------------------------
            flatRateTaxCalculator.Calculate(-12547d);
            //--------Assert----------------------------
            mockValidator.Verify(m => m.Validate(-12547d), Times.Once);
        }