Пример #1
0
        public void Given_AnnumIncome(double annualIncome, double expectedTax)
        {
            //----------Setup---------------------------
            var progressiveTaxCalculator = new ProgressiveTaxCalculator(new Mock <IIncomeValidator>().Object);
            //--------Execute---------------------------
            var tax = progressiveTaxCalculator.Calculate(annualIncome);

            //--------Assert----------------------------
            Assert.AreEqual(expectedTax, tax);
        }
Пример #2
0
        public void Given_Calculate_Should_Call_IncomeValidator_Validate()
        {
            //----------Setup---------------------------
            var mockValidator = new Mock <IIncomeValidator>();

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

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