Example #1
0
        public void TestFromAssignmentSpecification()
        {
            var tax1 = new MunicipalityTaxDetails()
            {
                MunicipalitySchedule = new MunicipalityTaxSchedule("Copenhegan", ScheduleFrequency.Yearly, new DateTime(2016, 01, 01)), TaxAmount = 0.2
            };
            var tax2 = new MunicipalityTaxDetails()
            {
                MunicipalitySchedule = new MunicipalityTaxSchedule("Copenhegan", ScheduleFrequency.Monthly, new DateTime(2016, 05, 01)), TaxAmount = 0.4
            };
            var tax3 = new MunicipalityTaxDetails()
            {
                MunicipalitySchedule = new MunicipalityTaxSchedule("Copenhegan", ScheduleFrequency.Daily, new DateTime(2016, 01, 01)), TaxAmount = 0.1
            };
            var tax4 = new MunicipalityTaxDetails()
            {
                MunicipalitySchedule = new MunicipalityTaxSchedule("Copenhegan", ScheduleFrequency.Daily, new DateTime(2016, 12, 25)), TaxAmount = 0.1
            };

            var db = new InMemoryTaxStorageProvider();

            db.InsertTaxSchedule(tax1);
            db.InsertTaxSchedule(tax2);
            db.InsertTaxSchedule(tax3);
            db.InsertTaxSchedule(tax4);

            Assert.AreEqual(db.GetTax("Copenhegan", new DateTime(2016, 01, 01)).TaxAmount, 0.1);
            Assert.AreEqual(db.GetTax("Copenhegan", new DateTime(2016, 05, 02)).TaxAmount, 0.4);
            Assert.AreEqual(db.GetTax("Copenhegan", new DateTime(2016, 07, 10)).TaxAmount, 0.2);
            Assert.AreEqual(db.GetTax("Copenhegan", new DateTime(2016, 03, 16)).TaxAmount, 0.2);
        }