Пример #1
0
        public DITests()
        {
            var mockLog = new Mock <ILog>();

            var settings = new APIv2Settings
            {
                GlobalSettings   = new GlobalSettings(),
                FeeSettings      = new FeeSettings(),
                IcoSettings      = new IcoSettings(),
                KycServiceClient = new KycServiceClientSettings(),
                WalletApiv2      = new BaseSettings
                {
                    Db       = new DbSettings(),
                    Services = new ServiceSettings
                    {
                        OperationsRepositoryClient = new OperationsRepositoryServiceClientSettings {
                            ServiceUrl = MockUrl, RequestTimeout = 300
                        },
                        AffiliateServiceClient = new AffiliateServiceClientSettings {
                            ServiceUrl = MockUrl
                        }
                    },
                    DeploymentSettings = new DeploymentSettings(),
                    CacheSettings      = new CacheSettings(),
                },
                ClientDictionariesServiceClient = new ClientDictionariesServiceClientSettings()
                {
                    ServiceUrl = MockUrl
                },
                OperationsHistoryServiceClient = new OperationsHistoryServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                FeeCalculatorServiceClient = new FeeCalculatorSettings {
                    ServiceUrl = MockUrl
                },
                PersonalDataServiceSettings = new PersonalDataServiceClientSettings {
                    ServiceUri = MockUrl
                },
                MatchingEngineClient = new MatchingEngineSettings {
                    IpEndpoint = new IpEndpointSettings {
                        Host = "127.0.0.1", Port = 80
                    }
                }
            };

            settings.WalletApiv2.Services.GetType().GetProperties().Where(p => p.PropertyType == typeof(string)).ToList().ForEach(p => p.SetValue(settings.WalletApiv2.Services, MockUrl));

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new Api2Module(ConstantReloadingManager.From(settings), mockLog.Object));
            containerBuilder.RegisterModule(new ClientsModule(ConstantReloadingManager.From(settings), mockLog.Object));
            containerBuilder.RegisterModule(new AspNetCoreModule());

            containerBuilder.RegisterType <AssetsController>();

            //register your controller class here to test
            _container = containerBuilder.Build();
        }
Пример #2
0
 public CqrsModule(APIv2Settings settings, ILog log)
 {
     _settings = settings;
     _log      = log;
 }
Пример #3
0
        public void Init()
        {
            var mockLog = new Mock <ILog>();

            var settings = new APIv2Settings
            {
                GlobalSettings   = new GlobalSettings(),
                FeeSettings      = new FeeSettings(),
                IcoSettings      = new IcoSettings(),
                KycServiceClient = new KycServiceClientSettings(),
                WalletApiv2      = new BaseSettings
                {
                    Db       = new DbSettings(),
                    Services = new ServiceSettings
                    {
                        AffiliateServiceClient = new AffiliateServiceClientSettings {
                            ServiceUrl = MockUrl
                        },
                        MyNoSqlServer = new MyNoSqlSettings()
                        {
                            ReaderServiceUrl = MockUrl
                        }
                    },
                    DeploymentSettings = new DeploymentSettings(),
                    CacheSettings      = new CacheSettings(),
                    SessionCheck       = new SessionCheckSettings(),
                },
                ClientDictionariesServiceClient = new ClientDictionariesServiceClientSettings()
                {
                    ServiceUrl = MockUrl
                },
                FeeCalculatorServiceClient = new FeeCalculatorSettings {
                    ServiceUrl = MockUrl
                },
                PersonalDataServiceSettings = new PersonalDataServiceClientSettings {
                    ServiceUri = MockUrl
                },
                MatchingEngineClient = new MatchingEngineSettings {
                    IpEndpoint = new IpEndpointSettings {
                        Host = "127.0.0.1", Port = 80
                    }
                },
                AssetDisclaimersServiceClient = new AssetDisclaimersServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                PaymentSystemServiceClient = new PaymentSystemServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                LimitationServiceClient = new LimitationServiceSettings {
                    ServiceUrl = MockUrl
                },
                ClientDialogsServiceClient = new ClientDialogsServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                SwiftCredentialsServiceClient = new SwiftCredentialsServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                BlockchainCashoutPreconditionsCheckServiceClient =
                    new BlockchainCashoutPreconditionsCheckServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                BlockchainSettingsServiceClient = new BlockchainSettingsServiceClientSettings()
                {
                    ServiceUrl = MockUrl, ApiKey = "123"
                },
                PushNotificationsServiceClient = new PushNotificationsServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                TierServiceClient = new TierServiceClientSettings {
                    ServiceUrl = MockUrl
                },
                MarketDataServiceClient = new MarketDataServiceClientSettings {
                    ServiceUrl = MockUrl, GrpcServiceUrl = MockUrl
                },
                SiriusApiServiceClient = new SiriusApiServiceClientSettings {
                    GrpcServiceUrl = MockUrl, ApiKey = "123", BrokerAccountId = 123
                },
                BlockedWithdrawalSettings = new BlockedWithdawalSettings()
            };

            settings.WalletApiv2.Services.GetType().GetProperties().Where(p => p.PropertyType == typeof(string)).ToList().ForEach(p => p.SetValue(settings.WalletApiv2.Services, MockUrl));

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new Api2Module(ConstantReloadingManager.From(settings), mockLog.Object));
            containerBuilder.RegisterModule(new ClientsModule(ConstantReloadingManager.From(settings), mockLog.Object));
            containerBuilder.RegisterModule(new AspNetCoreModule());

            containerBuilder.RegisterType <AssetsController>();

            //register your controller class here to test
            _container = containerBuilder.Build();
        }