예제 #1
0
        public async Task AltersguthabenEndeJahrTest(int gemeldeterLohnAsInt, string dateOfBirthAsString,
                                                     string dateOfEintrittAsString, int einlageAsDouble, double expectedEndaltersguthabenAsDouble)
        {
            // given
            decimal  gemeldeterLohn = gemeldeterLohnAsInt;
            decimal  einlage        = Convert.ToDecimal(einlageAsDouble);
            DateTime dateOfBirth    = DateTime.Parse(dateOfBirthAsString, CultureInfo.InvariantCulture);
            DateTime dateOfEintritt = DateTime.Parse(dateOfEintrittAsString, CultureInfo.InvariantCulture);

            decimal expectedEndaltersguthaben = Convert.ToDecimal(expectedEndaltersguthabenAsDouble);

            var input = new BvgCalculationInput
            {
                Lohn           = gemeldeterLohn,
                DateOfEintritt = dateOfEintritt,
                DateOfBirth    = dateOfBirth,
                Altersguthaben = einlage,
                Geschlecht     = Geschlecht.Mann,
            };

            // when
            var plan   = new BvgPlan();
            var result = await _calculator.CalculateAsync(plan, input).ConfigureAwait(false);

            // then
            result.AlterguthabenEndeJahr.Should().Be(expectedEndaltersguthaben);
        }
예제 #2
0
        private static void CalculateHelper(BvgCalculationInput input, BvgPlan plan, IBvgCalculator engine, List <BvgTestData> resultList)
        {
            var result =
                Task.Factory.StartNew(s => engine.CalculateAsync(plan, input), engine, CancellationToken.None,
                                      TaskCreationOptions.None, TaskScheduler.Default)
                .Unwrap().GetAwaiter().GetResult();


            resultList.Add(new BvgTestData()
            {
                Input  = input,
                Result = result,
            });
        }