Ejemplo n.º 1
0
 public void ProcessResults(DateTime now)
 {
     UpdateResultsBasedOnSetDates();
     UpdatePersonResults();
     TimeToRetirement    = new DateAmount(now, FinancialIndependenceDate);
     TargetRetirementAge = TargetRetirementDate.HasValue ? AgeCalc.Age(PrimaryPerson.Person.Dob, TargetRetirementDate.Value) : (int?)null;
 }
        public static int CalculateContributingYearsSoFar(Person person, Money monthlySalary, DateTime now, ITaxSystem taxSystem)
        {
            int contributingYearsFromEmployment = 0;
            int contributingYearsFromChildren   = 0;

            if (person.NiContributingYears.HasValue)
            {
                return(person.NiContributingYears.Value);
            }
            else
            {
                if (monthlySalary * 12 <= taxSystem.LowerEarningsLimit)
                {
                    contributingYearsFromEmployment = 0;
                }
                else
                {
                    contributingYearsFromEmployment = AgeCalc.Age(person.Dob, now) - 21;
                }

                if (person.Children.Count > 0)
                {
                    var age = EldestChildAge(person, now);
                    contributingYearsFromChildren = Math.Max(12, age);
                }
            }

            return(Math.Max(contributingYearsFromEmployment, contributingYearsFromChildren));
        }
Ejemplo n.º 3
0
 public void CanCalculateAgeInYears()
 {
     Assert.That(AgeCalc.Age(new DateTime(2019, 05, 30), new DateTime(2020, 5, 30)), Is.EqualTo(1));
     Assert.That(AgeCalc.Age(new DateTime(2019, 05, 30), new DateTime(2020, 5, 31)), Is.EqualTo(1));
     Assert.That(AgeCalc.Age(new DateTime(2019, 05, 30), new DateTime(2020, 5, 29)), Is.EqualTo(0));
     Assert.That(AgeCalc.Age(new DateTime(2019, 05, 30), new DateTime(2020, 1, 31)), Is.EqualTo(0));
     Assert.That(AgeCalc.Age(new DateTime(2019, 05, 30), new DateTime(2020, 6, 1)), Is.EqualTo(1));
 }
Ejemplo n.º 4
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#line 1 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"

            ViewData["Title"] = "Home Page";

#line default
#line hidden
            BeginContext(45, 297, true);
            WriteLiteral(@"

<div class=""top_bar"">
    <a class=""bigbutton"" style=""border-right:3px black solid"">Chefs</a>
    <a class=""bigbutton"" href=""Dishes"">Dishes</a>
    <a class=""button"" href=""/newchef"">Add a Chef</a>
</div>

<h2 style=""border-bottom: 3px solid black"">Check out our roster of Chefs!</h2>

");
            EndContext();
            BeginContext(361, 115, true);
            WriteLiteral("\r\n\r\n<table class=\"chef_table\">\r\n  <tr>\r\n    <th>Name</th>\r\n    <th>Age</th> \r\n    <th># of Dishes</th>\r\n  </tr>\r\n\r\n");
            EndContext();
#line 24 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"
            foreach (var chef in Model)
            {
#line default
#line hidden
                BeginContext(510, 22, true);
                WriteLiteral("    <tr>\r\n        <td>");
                EndContext();
                BeginContext(533, 14, false);
#line 27 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"
                Write(chef.FirstName);

#line default
#line hidden
                EndContext();
                BeginContext(547, 1, true);
                WriteLiteral(" ");
                EndContext();
                BeginContext(549, 13, false);
#line 27 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"
                Write(chef.LastName);

#line default
#line hidden
                EndContext();
                BeginContext(562, 19, true);
                WriteLiteral("</td>\r\n        <td>");
                EndContext();
                BeginContext(582, 26, false);
#line 28 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"
                Write(AgeCalc.Age(chef.Birthday));

#line default
#line hidden
                EndContext();
                BeginContext(608, 20, true);
                WriteLiteral("</td> \r\n        <td>");
                EndContext();
                BeginContext(629, 22, false);
#line 29 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"
                Write(chef.ChefsDishes.Count);

#line default
#line hidden
                EndContext();
                BeginContext(651, 18, true);
                WriteLiteral("</td>\r\n    </tr>\r\n");
                EndContext();
#line 31 "/Users/momo/Desktop/ChefDishes/Views/Home/Index.cshtml"
            }

#line default
#line hidden
            BeginContext(674, 10, true);
            WriteLiteral("\r\n</table>");
            EndContext();
        }