-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmain.cpp
32 lines (28 loc) · 1.03 KB
/
main.cpp
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
#include <iostream>
#include "repositories/repository.h"
#include "services/service.h"
#include "gateways/gateway.h"
#include "interface/api.h"
#include "Hypodermic/ContainerBuilder.h"
using namespace repositories;
using namespace services;
using namespace gateways;
using namespace Hypodermic;
int main(int argc, char *argv[])
{
ContainerBuilder builder;
builder.registerType< CargoRepository >().singleInstance();
builder.registerType< CargoProviderImpl >().singleInstance().as< CargoProvider >();
builder.registerType< CargoService >().singleInstance();
builder.registerType<api::Api>().singleInstance();
auto container = builder.build();
std::shared_ptr<api::Api> api = container->resolve<api::Api>();
std::shared_ptr<CargoRepository> cargoRepo = container->resolve<CargoRepository>();
api::CreateCargoMsg* msg = new api::CreateCargoMsg();
msg->Id = 1;
msg->AfterDays = 10;
api->CreateCargo(msg);
std::cout<< "hello" << "\n";
std::cout<< cargoRepo->FindById(1)->getId()<<"\n";
return 0;
}