-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
83 lines (69 loc) · 3.04 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using static System.Console;
// using DesignPatterns.Facade.AuthenticationComponent;
// using DesignPatterns.Facade.AuthorizationComponent;
// using DesignPatterns.Facade.ValidationComponent;
using DesignPatterns.Facade;
using DesignPatterns.CreationalPatterns;
using System;
using DesignPatterns.StructuralPatterns.Composite;
using DesignPatterns.StructuralPatterns.Decorator;
namespace DesignPatterns
{
class Program
{
static void Main(string[] args)
{
//string userName = "";
//string password = "";
//// without FACADE design pattern
//// ---------------------------------------------------------------------
//// var validationService = new ValidationService();
//// if(validationService.ISValidated(userName,password))
//// {
//// var authenticationService = new AuthenticationService();
//// if(authenticationService.IsAuthenticated(userName,password))
//// {
//// var authorizationService = new AuthorizationService();
//// if(authorizationService.IsAuthorized(userName,password))
//// System.Console.WriteLine("User loged in !");
//// }
//// }
////------------------------------------------------------------------------
////FACADE solution
//var loginFacade = new LoginFacade();
//if(loginFacade.CanLogin(userName,password))
// WriteLine("user loged in !");
//var firstCustomer = new Customer()
//{
// Name = "Alireza",
// LastName = "Mori",
// PhoneNumber = "+9890122222222"
//};
//var firstCustomerClone = firstCustomer.Clone();
//var modernHouse = new HouseDirector().CreateModernHouse();
//WriteLine(modernHouse.WallType);
//var xml = new StructuralPatterns.Adapter(new StructuralPatterns.XML());
//var x = xml.Convert();
//var box = new Box();
//var product = new Product() { Price = 10 };
//var productTwo = new Product() { Price = 20 };
//box.Add(product);
//box.Add(productTwo);
//var boxTwo = new Box();
//var productThree = new Product() { Price = 30 };
//boxTwo.Add(box);
//boxTwo.Add(productThree);
//var priceOfProducts = boxTwo.GetPrice();
//Console.WriteLine(priceOfProducts);
// var baseNotify = new BaseNotify();
// var firstDecorator = new FirstDecorator(baseNotify);
// var secondDecorator = new SecondDecorator(firstDecorator);
// secondDecorator.Notify();
var button = new BehavioralPatterns.Button(){ Name = "Babak" };
var authDialog = new BehavioralPatterns.AuthenticatoinDialog(button);
button.SetMediator(authDialog);
button.Click();
ReadLine();
}
}
}