public ScriptingWelfareService(UnemploymentDbContext database) { this.database = database; scriptOptions = ScriptOptions.Default.AddReferences( typeof(object).GetTypeInfo().Assembly) .AddImports("System"); }
static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var configuration = builder.Build(); using (var unemployment = new UnemploymentDbContext(configuration["unemployment"])) { var welfareService = new ScriptingWelfareService(unemployment); Console.WriteLine($"Welfare for 0 months, unmarried, no handicap, no kids, wage:500, age:19"); Console.WriteLine($"{welfareService.GetWelfare(0, 1, 1, 0, 500, 19)}"); Console.WriteLine($""); Console.WriteLine($"Welfare for 5 months, unmarried, no handicap, no kids, wage:500, age:19"); Console.WriteLine($"{welfareService.GetWelfare(5, 1, 1, 0, 500, 19)}"); Console.WriteLine($""); Console.WriteLine($"Welfare for 16 months, unmarried, no handicap, no kids, wage:500, age:19"); Console.WriteLine($"{welfareService.GetWelfare(16, 1, 1, 0, 500, 19)}"); Console.WriteLine($""); Console.WriteLine($"Welfare for 0 months, unmarried, no handicap, no kids, wage:1600, age:19"); Console.WriteLine($"{welfareService.GetWelfare(0, 1, 1, 0, 1600, 19)}"); Console.WriteLine($""); Console.WriteLine($"Welfare for 5 months, unmarried, no handicap, no kids, wage:1600, age:19"); Console.WriteLine($"{welfareService.GetWelfare(5, 1, 1, 0, 1600, 19)}"); Console.WriteLine($""); Console.WriteLine($"Welfare for 16 months, unmarried, no handicap, no kids, wage:1600, age:19"); Console.WriteLine($"{welfareService.GetWelfare(16, 1, 1, 0, 1600, 19)}"); Console.WriteLine($""); Console.WriteLine($"Terminated"); Console.Read(); } }