-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
35 lines (24 loc) · 1.09 KB
/
Program.cs
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
using concepts_poc.services.mock;
using System.Text.Json;
var serializerOpts = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true,
};
var serialize = (object data) => JsonSerializer.Serialize(data, serializerOpts);
var context = DummyConceptDataMocker.BuildPayrollContext();
var conceptsFromDB = DummyConceptDataMocker.GenerateDummyData();
var conceptsMapperFactory = DummyConceptDataMocker.BuildConceptMapperFactory();
Console.WriteLine($"context: {serialize(context)}");
Console.WriteLine($"concepts from db: {serialize(conceptsFromDB)}");
Console.WriteLine("\nmapping concetps...");
var mappedConcepts = DummyConceptDataMocker.BuildDepedencyTree(conceptsFromDB);
Console.WriteLine($"mapped concepts to business: {mappedConcepts} -> {serialize(mappedConcepts)}");
Console.WriteLine("Calculating concepts");
foreach (var concept in mappedConcepts)
{
Console.WriteLine($"calculating concept {concept.Code}");
concept.Value = concept.Calculate(context);
Console.WriteLine(serialize(concept));
}
Console.WriteLine("\ncompleted!");