-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
31 lines (30 loc) · 1.23 KB
/
Program.cs
File metadata and controls
31 lines (30 loc) · 1.23 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
using FluentValidator.Validation;
using Student.NotificationPattern.Validations;
using Student.NotificationPattern.ValueObjects;
using System;
namespace Student
{
class Program
{
static void Main(string[] args)
{
Console.Write("Type your first name: ");
string firstName = Console.ReadLine();
Console.Write("Type your last name: ");
string lastName = Console.ReadLine();
Console.Write("Type your email name: ");
string email = Console.ReadLine();
Name name = new Name(firstName, lastName);
Email emailObj = new Email(email);
NameValidationContract nameValidation = new NameValidationContract(name);
EmailValidationContract emailValidation = new EmailValidationContract(emailObj);
ValidationContract validation = new ValidationContract();
validation.AddNotifications(nameValidation.Contract.Notifications);
validation.AddNotifications(emailValidation.Contract.Notifications);
foreach (var notification in validation.Notifications)
{
Console.WriteLine($"{notification.Property} : {notification.Message}");
}
}
}
}