-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (37 loc) · 1.29 KB
/
Program.cs
File metadata and controls
42 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using ConsoleApp1.Models;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
//SNIP - collect input (risk data from the user)
var request = new PriceRequest()
{
RiskData = new RiskData() //hardcoded here, but would normally be from user input above
{
DOB = DateTime.Parse("1980-01-01"),
FirstName = "John",
LastName = "Smith",
Make = "Cool New Phone",
Value = 500
}
};
var priceEngine = new PriceEngine();
var error = string.Empty;
var priceResponse = priceEngine.GetPrice(request, out error);
if (priceResponse.Price == Decimal.MaxValue)
{
Console.WriteLine(String.Format("There was an error - {0}", error));
}
else
{
Console.WriteLine(String.Format("You price is {0}, from insurer: {1}. This includes tax of {2}",
priceResponse.Price, priceResponse.InsurerName, priceResponse.Tax));
}
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
}