-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathApp.cs
More file actions
44 lines (37 loc) · 1.47 KB
/
App.cs
File metadata and controls
44 lines (37 loc) · 1.47 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
43
44
using System;
using System.Threading.Tasks;
using DomainEventsConsole.Interfaces;
using DomainEventsConsole.Model;
using DomainEventsConsole.Services;
namespace DomainEventsConsole
{
public class App
{
private readonly AppointmentSchedulingService _appointmentService;
private readonly IRepository<Appointment> _appointmentRepository;
public App(AppointmentSchedulingService appointmentService,
IRepository<Appointment> appointmentRepository)
{
_appointmentService = appointmentService;
_appointmentRepository = appointmentRepository;
}
public async Task Run()
{
var testDate = new DateTime(2030, 9, 9, 14, 0, 0);
Console.WriteLine("App running.");
Console.WriteLine("Scheduling an appointment with a service.");
await _appointmentService.ScheduleAppointment("steve@test1.com");
Console.WriteLine();
Console.WriteLine("Creating an appointment with a repository.");
var appointment = Appointment.Create("steve@test2.com");
await _appointmentRepository.Save(appointment);
Console.WriteLine();
Console.WriteLine("Confirming an appointment.");
appointment.Confirm(testDate);
await _appointmentRepository.Save(appointment);
Console.WriteLine();
Console.WriteLine("Application done.");
Console.ReadLine();
}
}
}