public void BeregnAkkumuleretReserveTil67AarMedInterpolationShouldMatchDataFromSpreadsheet()
        {
            var dbAdapter = new DbAdapter(Program.DbConnectionString);
            dbAdapter.ReadFromDb();
            var e = new RenteReserveBeregner(dbAdapter);

            var foedselsDato = new DateTime(1980, 6, 30);
            var udloebsDato = new DateTime(2013, 1, 1);

            /* Ydelse pr maaned er hentet fra kolonne E benævnt fakturasum
             * i regnearket "beregning af rentereserver" i panelet "dataark"
             * */
            const int ydelsePrMaaned = 6554;
            var renteReserve = e.BeregnReserve(foedselsDato, udloebsDato, Koen.Kvinde,
                                                                                  ydelsePrMaaned, 0);

            /* rentereserven er hentet fra kolonne O som Olsen benævnt fakturasum
             * i regnearket "beregning af rentereserver" i panelet "dataark"
             * */
            const decimal expectedRenteReserve = (decimal) 1997696.35904207;
            Expect(renteReserve, Is.EqualTo(expectedRenteReserve).Within(10));
        }
 public void CanCalulateOrderedDataFromSpreadsheet()
 {
     var dbAdapter = new DbAdapter(Program.DbConnectionString);
     dbAdapter.ReadFromDb();
     foreach (var e in ReadErhvervsSkaderFromFile().
         Select(skade => new {AkkumuleretReserve = BeregnSkade(dbAdapter, skade), Skade = skade}).OrderBy(
             x => (x.AkkumuleretReserve - x.Skade.Reserve)))
     {
         Expect(e.AkkumuleretReserve, Is.EqualTo(e.Skade.Reserve).Within(26));
         var message = string.Format("Udbetalinger (år): {0}\t Fakturasum: {1}\t og forskel {2}",
                                     Math.Round(67 - e.Skade.Alder, 2), e.Skade.Fakturasum,
                                     Math.Round(e.AkkumuleretReserve - e.Skade.Reserve, 2));
         Debug.Print(message);
     }
 }
 public void CanCalulateDataFromSpreadsheet()
 {
     var dbAdapter = new DbAdapter(Program.DbConnectionString);
     dbAdapter.ReadFromDb();
     foreach (
         var erhvervsSkade in ReadErhvervsSkaderFromFile().OrderBy(x => 67 - x.Alder).ThenBy(x => x.Fakturasum))
     {
         AssertSkade(erhvervsSkade, dbAdapter);
     }
 }
 public void BeregnReserveWithDiskontoFrom10Oktober2012Other()
 {
     //150182-xxx6
     var db = new DbAdapter(Program.DbConnectionString);
     db.ReadFromDb();
     db.SetDiskontoSatser(TestConstants.DiskonteringsRente10Oktober2012);
     var e = new RenteReserveBeregner(db);
     var foedselsDato = new DateTime(1982, 1, 15);
     var beregningsDato = new DateTime(2012, 12, 31);
     var age = new InsuranceAgeCalculator().CalculateAge(foedselsDato, beregningsDato);
     Expect(age, Is.EqualTo(30.9166666666667).Within(0.001));
     const int comsumerPriceIndexInPercent = 1;
     var reserve = e.BeregnReserve(foedselsDato, beregningsDato, Koen.Kvinde, 10034, comsumerPriceIndexInPercent);
     const double expectedReserveFromSpreadsheet = 3719302.94806157;
     Expect(reserve, Is.EqualTo(expectedReserveFromSpreadsheet).Within(10));
 }
 public void BeregnReserveWithDiskontoFrom10Oktober2012()
 {
     //cpr: 160680-xxx6
     var db = new DbAdapter(Program.DbConnectionString);
     db.ReadFromDb();
     db.SetDiskontoSatser(TestConstants.DiskonteringsRente10Oktober2012);
     var e = new RenteReserveBeregner(db);
     var foedselsDato = new DateTime(1980,6,16);
     var beregningsDato = new DateTime(2012,12,31);
     var age = new InsuranceAgeCalculator().CalculateAge(foedselsDato, beregningsDato);
     Expect(age, Is.EqualTo(32.5).Within(0.001));
     const int comsumerPriceIndexInPercent = 1;
     var reserve = e.BeregnReserve(foedselsDato, beregningsDato, Koen.Kvinde, 6554, comsumerPriceIndexInPercent);
     Expect(reserve, Is.EqualTo(2347852.93480205).Within(10));
 }
 public void ReadFromDb()
 {
     var e = new DbAdapter(Program.DbConnectionString);
     e.ReadFromDb();
 }