-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
45 lines (38 loc) · 1.71 KB
/
Program.cs
File metadata and controls
45 lines (38 loc) · 1.71 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
namespace Example
{
using System;
using System.Linq;
using ServiceDemo;
using StarWarsApiCSharp;
public class Program
{
public static void Main(string[] args)
{
IRepository<Planet> planetsRepo = new Repository<Planet>();
IRepository<Vehicle> vehicleRepo = new Repository<Vehicle>();
IRepository<Specie> speciesRepo = new Repository<Specie>();
ConsoleColor backgroundColor = ConsoleColor.DarkBlue;
string template = "Press [Enter] to process with {0} example";
ProcessExecuteCommand(new FilmsFromFileDemo(), template, "Another service", backgroundColor);
ProcessExecuteCommand(new FilmsExample(), template, "Films", backgroundColor);
ProcessExecuteCommand(new StarshipsExample(), template, "Starhips", backgroundColor);
ProcessExecuteCommand(new PeopleExample(), template, "People", backgroundColor);
ProcessExecuteCommand(new PlanetsExample(), template, "Planets", backgroundColor);
ProcessExecuteCommand(new SpeciesExample(), template, "Species", backgroundColor);
ProcessExecuteCommand(new VehiclesExample(), template, "Vehicles", backgroundColor);
}
private static void ProcessExecuteCommand(
IExecutor executor,
string template,
string typeName,
ConsoleColor backgroundColor)
{
ConsoleColor defaultColor = Console.BackgroundColor;
Console.BackgroundColor = backgroundColor;
Console.WriteLine(template, typeName);
Console.BackgroundColor = defaultColor;
Console.ReadLine();
executor.Execute();
}
}
}