-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTestComposite.cs
31 lines (26 loc) · 909 Bytes
/
TestComposite.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructuralPatterns.Composite
{
class TestComposite
{
public static void Run()
{
Folder mainFolder = new Folder("Main Folder");
Folder subFolder1 = new Folder("Sub Folder 1");
Folder subFolder2 = new Folder("Sub Folder 2");
mainFolder.Add(subFolder1);
mainFolder.Add(subFolder2);
mainFolder.Add(new File("File 1 in Main Folder"));
subFolder1.Add(new File("File 1 in Sub Folder 1"));
subFolder1.Add(new File("File 2 in Sub Folder 1"));
subFolder2.Add(new File("File 1 in Sub Folder 2"));
subFolder2.Add(new Folder("Empty folder in Sub Folder 2"));
mainFolder.PrintName();
Console.ReadKey();
}
}
}