Exemplo n.º 1
0
        public void When2014_ShouldReturn80Percent()
        {
            //Arrange
            var taxRepo = new StubTaxRepository {TaxRate = 20};
            var taxHelper = new TaxHelper(TaxYear.Year2013, taxRepo);
            const int salaryExpected = 800;

            //Act
            var salaryResulted = taxHelper.Calculate(1000);

            //Assert
            Assert.That(salaryResulted, Is.EqualTo(salaryExpected));
        }
Exemplo n.º 2
0
        public void WhenSalaryIsZero_ShouldReturnZero(TaxYear taxYear)
        {
            //Arrange
            var taxRepo = new StubTaxRepository {TaxRate = 10};
            var taxHelper = new TaxHelper(TaxYear.Year2013, taxRepo);
            const int salaryExpected = 0;

            //Act
            var salaryResulted = taxHelper.Calculate(0);

            //Assert
            Assert.That(salaryResulted, Is.EqualTo(salaryExpected));
        }
Exemplo n.º 3
0
        public void When2013_ShouldReturn90Percent_UsingMoq()
        {
            //Arrange
            var taxRepo = new Mock<ITaxRepository>();
            taxRepo.Setup(x => x.GetTaxRate(It.IsAny<TaxYear>())).Returns(10);
            var taxHelper = new TaxHelper(TaxYear.Year2013, taxRepo.Object);
            const int salaryExpected = 900;

            //Act
            var salaryResulted = taxHelper.Calculate(1000);

            //Assert
            Assert.That(salaryResulted, Is.EqualTo(salaryExpected));
        }