Exemplo n.º 1
0
    public void ThrowIfContextIsNotHttpContext()
    {
        var context  = new Object();
        var strategy = new BasePathStrategy();

        Assert.Throws <AggregateException>(() => strategy.GetIdentifierAsync(context).Result);
    }
Exemplo n.º 2
0
    [InlineData("/initech/ignore/ignore", "initech")] // multiple path segments
    public async void ReturnExpectedIdentifier(string path, string expected)
    {
        var httpContext = CreateHttpContextMock(path);
        var strategy    = new BasePathStrategy();

        var identifier = await strategy.GetIdentifierAsync(httpContext);

        Assert.Equal(expected, identifier);
    }
Exemplo n.º 3
0
 protected void PrepareCalculationData(PathModel path)
 {
     this.savingsStrategy = BasePathStrategy.GetStragery(path.Savings.Type);
     if (path?.Salary?.SalaryPeriods?.Any() ?? false)
     {
         path.Salary.SalaryPeriods.Aggregate((f, s) => { f.To = s.From; return(s); });
         path.Salary.SalaryPeriods.Last().To = path.RetirementAge;
     }
     if (path?.Education?.EducationDegrees?.Any() ?? false)
     {
         path.Education.EducationDegrees.Aggregate((f, s) => { f.To = s.From; return(s); });
         path.Education.EducationDegrees.Last().To = path.LifeExpectancy;
     }
 }