-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
44 lines (34 loc) · 1.22 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
// See https://aka.ms/new-console-template for more information
// Single Reponsibility OK
using Lsp.Ok;
using SingleResponsibility.Ok;
using CharacterSingleR = SingleResponsibility.Ok.Character;
using CharacterOc = OpenClose.Ok.Character;
using OpenClose.Ok;
using Microsoft.Extensions.DependencyInjection;
using DependencyInversion.Ok;
using DragonDI = DependencyInversion.Ok.Dragon;
using IDragonDI = DependencyInversion.Ok.IDragon;
using FireDragonIs = InterfaceSegregation.Ok.FireDragon;
// Dependencies
var serviceProvider = new ServiceCollection()
.AddSingleton<IDragonDI, DragonDI>()
.AddTransient<Player>()
.BuildServiceProvider();
var combat = new Combat();
var characterOne = new CharacterSingleR(){Name = "", Race = "", Class = ""};
var characterTwo = new CharacterSingleR(){Name = "", Race = "", Class = ""};
combat.Attack(characterOne, characterTwo);
// Lsp
var dragonController = new DragonController();
dragonController.UnleashDragons();
// OC
var character = new CharacterOc();
var weapon = new Sword();
character.Attack(weapon);
// IS
var fireDragon = new FireDragonIs();
fireDragon.BreathFire();
// DI
var player = serviceProvider.GetService<Player>();
player?.FightDragon();