예제 #1
0
        public void TestDefinedInterface()
        {
            var serviceRegistration = new TestServiceRegistration();
            var busBuilder          = new SyncUseCaseBusBuilder(serviceRegistration);

            busBuilder.RegisterUseCase <InputData, DefinedInterfaceInteractor>();
            var bus      = busBuilder.Build();
            var request  = new InputData();
            var response = bus.Handle(request);
        }
예제 #2
0
        private static void setupProduct()
        {
            var services = ServiceProvider.ServiceCollection;

            services.AddTransient <IUserRepository, UserRepository>();

            services.AddTransient <IUserCreatePresenter, ConsolePresenter>();

            var busBuilder = new SyncUseCaseBusBuilder(services);

            busBuilder.RegisterUseCase <UserCreateRequest, MockUserCreateInteractor>();
            var bus = busBuilder.Build();

            services.AddSingleton(bus);
        }
        public void Launch(IServiceCollection services)
        {
            services.AddSingleton <IUserRepository, UserRepository>();
            var nonActionPresenter = new NonActionPresenter();

            services.AddSingleton <IUserCreatePresenter>(nonActionPresenter);

            var busBuilder = new SyncUseCaseBusBuilder(services);

            busBuilder.RegisterUseCase <UserCreateRequest, UserCreateInteractor>();
            busBuilder.RegisterUseCase <UserGetListRequest, UserGetListInteractor>();

            var usecaseBus = busBuilder.Build();

            services.AddSingleton(usecaseBus);
        }
예제 #4
0
        private static void setupDebug()
        {
            var services = ServiceProvider.ServiceCollection;

            services.AddTransient <IUserRepository, InMemoryUserRepository>();

            services.AddTransient <IUserCreatePresenter, ConsolePresenter>();
            // ファイルに出力してみたい場合は↑をコメントアウトして↓のコメントを外す
//            services.AddTransient<IUserCreatePresenter, FilePresenter>();

            var busBuilder = new SyncUseCaseBusBuilder(services);

            busBuilder.RegisterUseCase <UserCreateRequest, MockUserCreateInteractor>();
            var bus = busBuilder.Build();

            services.AddSingleton(bus);
        }
예제 #5
0
        public void TestThrowsException()
        {
            var serviceRegistration = new TestServiceRegistration();
            var busBuilder          = new SyncUseCaseBusBuilder(serviceRegistration);

            busBuilder.RegisterUseCase <InputData, ThrowsExceptionInteractor>();
            var bus     = busBuilder.Build();
            var request = new InputData();

            try
            {
                var response = bus.Handle(request);
                Assert.Fail();
            }
            catch (Exception)
            {
                // ignored
            }
        }
        public void Launch(IServiceCollection services)
        {
            services.AddTransient <IUserRepository, InMemoryUserRepository>();

            var nonActionPresenter = new NonActionPresenter();

            services.AddSingleton <IUserCreatePresenter>(nonActionPresenter);
            var debugDataDirectory = Path.Combine(Environment.CurrentDirectory, "bin", "Debug", "netcoreapp2.0", "Data");
            var jsonsLoader        = new JsonsLoader(debugDataDirectory);

            services.AddSingleton(jsonsLoader);

            var busBuilder = new SyncUseCaseBusBuilder(services);

            busBuilder.RegisterUseCase <UserCreateRequest, MockUserCreateInteractor>();
            busBuilder.RegisterUseCase <UserGetListRequest, MockUserGetListInteractor>();

            var usecaseBus = busBuilder.Build();

            services.AddSingleton(usecaseBus);
        }
예제 #7
0
        private void SetupUseCases(IServiceCollection services)
        {
            var busBuilder = new SyncUseCaseBusBuilder(services);

            busBuilder.RegisterUseCase <CircleCreateInputData, CircleCreateInteractor>();
            busBuilder.RegisterUseCase <CircleDeleteInputData, CircleDeleteInteractor>();
            busBuilder.RegisterUseCase <CircleGetInputData, CircleGetInteractor>();
            busBuilder.RegisterUseCase <CircleGetAllInputData, CircleGetAllInteractor>();
            busBuilder.RegisterUseCase <CircleGetCandidatesInputData, SqlCircleGetCandidatesInteractor>();
            busBuilder.RegisterUseCase <CircleGetSummariesInputData, SqlCircleGetSummariesInteractor>();
            busBuilder.RegisterUseCase <CircleJoinInputData, CircleJoinInteractor>();
            busBuilder.RegisterUseCase <CircleUpdateInputData, CircleUpdateInteractor>();

            busBuilder.RegisterUseCase <UserDeleteInputData, UserDeleteInteractor>();
            busBuilder.RegisterUseCase <UserGetInputData, UserGetInteractor>();
            busBuilder.RegisterUseCase <UserGetAllInputData, UserGetAllInteractor>();
            busBuilder.RegisterUseCase <UserRegisterInputData, UserRegisterInteractor>();
            busBuilder.RegisterUseCase <UserUpdateInputData, UserUpdateInteractor>();

            var bus = busBuilder.Build();

            services.AddSingleton(bus);
        }