static void Main(string[] args)
        {
            var retriever = new StubRetriever(GetStubbedClients(), GetStubbedJournalEntries());
            // var retriever = new DynamoRetriever();


            var clientsService      = new ClientService(retriever);
            var journalEntryService = new JournalEntryService(retriever);

            var generalClientsController       = new GeneralClientsController(clientsService);
            var specificClientsController      = new SpecificClientsController(clientsService);
            var generalJournalEntryController  = new GeneralJournalEntryController(journalEntryService);
            var specificJournalEntryController = new SpecificJournalEntryController(journalEntryService);


            var router = new Router(
                generalJournalEntryController,
                specificJournalEntryController,
                generalClientsController,
                specificClientsController);

            var server = new Server(Uri, router);

            Console.WriteLine($"\n\nServer listening on port: {Port}");

            server.Run();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 public Router(
     GeneralJournalEntryController generalJournalEntryController,
     SpecificJournalEntryController specificJournalEntryController,
     GeneralClientsController generalClientsController,
     SpecificClientsController specificClientsController)
 {
     _generalJournalEntryController  = generalJournalEntryController;
     _specificJournalEntryController = specificJournalEntryController;
     _generalClientsController       = generalClientsController;
     _specificClientsController      = specificClientsController;
 }
Ejemplo n.º 3
0
        public void Setup()
        {
            var client1 = new Client(1, "John", "Smith");
            var client2 = new Client(2, "Bobby", "Brown");


            _clients = new List <Client> {
                client1, client2
            };


            var journalEntry1 = new JournalEntry(
                1,
                1,
                new DateTime(2020, 1, 1),
                "Today I am grateful for...");

            var journalEntry2 = new JournalEntry(
                2,
                1,
                new DateTime(2020, 1, 2),
                "Today I am grateful for something else.");

            _journalEntries = new List <JournalEntry> {
                journalEntry1, journalEntry2
            };


            var retriever = new StubRetriever(_clients, _journalEntries);

            var clientsService      = new ClientService(retriever);
            var journalEntryService = new JournalEntryService(retriever);

            var generalClientsController       = new GeneralClientsController(clientsService);
            var specificClientsController      = new SpecificClientsController(clientsService);
            var generalJournalEntryController  = new GeneralJournalEntryController(journalEntryService);
            var specificJournalEntryController = new SpecificJournalEntryController(journalEntryService);

            var router = new Router(
                generalJournalEntryController,
                specificJournalEntryController,
                generalClientsController,
                specificClientsController);

            _server = new Server(ServerUri, router);

            _server.RunAsync();

            _client = new HttpClient();
        }