forked from tk-codes/DesignPatterns.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestAdapter.cs
More file actions
29 lines (26 loc) · 703 Bytes
/
Copy pathTestAdapter.cs
File metadata and controls
29 lines (26 loc) · 703 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructuralPatterns.Adapter
{
public class TestAdapter
{
public static void Run()
{
// Class Adapter
TurkeyClassAdapter classAdapter = new TurkeyClassAdapter();
testDuck(classAdapter);
// Object Adapter
WildTurkey turkey = new WildTurkey();
TurkeyObjectAdapter objectAdapter = new TurkeyObjectAdapter(turkey);
testDuck(objectAdapter);
}
static void testDuck(IDuck duck)
{
duck.Quack();
duck.Fly();
}
}
}