-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
36 lines (30 loc) · 1.1 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
36
using System;
using System.Linq;
namespace event_sourcing
{
class MainClass
{
public static void Main()
{
var account = new BankAccount(startingBalance: -25.0m);
account.GetCurrentBalance().Subscribe(x =>
{
Console.WriteLine($"Currently: {x}");
});
for (var i = 0; i < 100; i++)
{
account.AddTransaction(Randomizer.CreateTransaction());
}
//Console.WriteLine("Last 5 transactions:");
//foreach (var balance in account.GetHistory().TakeLast(5))
//{
// Console.WriteLine($"Before: {balance.Before}");
// Console.WriteLine($"After: {balance.After}");
// Console.WriteLine();
//}
Console.WriteLine($"Current balance: {account.GetBalances().Last()}");
Console.WriteLine($"Maximum balance: {account.GetBalances().Max()}");
Console.WriteLine($"Minimum balance: {account.GetBalances().Min()}");
}
}
}