コード例 #1
0
 public void CityRejectsOverlappingTaxesPerTaxType()
 {
     var city = new City("Winnipeg");
     var pstTax1 = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6));
     var pstTax2 = new Tax("PST", DateTime.Today.AddMonths(6), DateTime.Today.AddYears(1));
     city.AddTax(pstTax1);
     city.AddTax(pstTax2);
 }
コード例 #2
0
 public void CityRejectsDuplicateTaxes()
 {
     var city = new City("Winnipeg");
     var pstTax1 = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6));
     var pstTax2 = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6));
     city.AddTax(pstTax1);
     city.AddTax(pstTax2);
 }
コード例 #3
0
        public void CityCanAccumulateTaxes()
        {
            var city = new City("Winnipeg");
            var pstTax = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6));
            city.AddTax(pstTax);

            Assert.IsTrue(city.Taxes.Contains(pstTax));
        }
コード例 #4
0
        public void CityDelegatesAddedTaxesToInjectedTaxesService()
        {
            // expectations
            var pstTax = new Tax("PST", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.City);
            _mockTaxesService.AddTax(pstTax);

            _mockRepository.ReplayAll();

            var city = new City("Winnipeg", _mockTaxesService);
            city.AddTax(pstTax);
        }
コード例 #5
0
        public void TaxesServiceDistinguishesCorrectlyEachJurisdiction()
        {
            var taxesService = new TaxesService();

            var city = new City("CityTax", taxesService);
            var cityTax = new Tax("CityTax", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.City);
            city.AddTax(cityTax);

            var provinceState = new City("ProvStateTax", taxesService);
            var provStateTax = new Tax("ProvStateTax", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.ProvinceState);
            provinceState.AddTax(provStateTax);

            var country = new City("CountryTax", taxesService);
            var countryTax = new Tax("CountryTax", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.Country);
            country.AddTax(countryTax);

            Assert.AreEqual(1, city.Taxes.Count);
            Assert.AreEqual(1, provinceState.Taxes.Count);
            Assert.AreEqual(1, country.Taxes.Count);
        }
コード例 #6
0
        public void Setup()
        {
            _mockRepository = new MockRepository();
            _mockTaxesService = _mockRepository.Stub<ITaxesService>();

            _city = new City("CityTax", _mockTaxesService);
            var cityTax = new Tax("CityTax", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.City, 2);
            _mockTaxesService.Taxes.Add(cityTax);

            _provinceState = new ProvinceState("ProvStateTax", _mockTaxesService);
            var provStateTax = new Tax("ProvStateTax", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.ProvinceState, 3);
            _mockTaxesService.Taxes.Add(provStateTax);

            _country = new Country("CountryTax", _mockTaxesService);
            var countryTax = new Tax("CountryTax", DateTime.Today, DateTime.Today.AddMonths(6), JurisdictionEnum.Country, 4);
            _mockTaxesService.Taxes.Add(countryTax);
        }