コード例 #1
0
 public static TIterable ToIterable <TElem, TIterable>(this IBuilderFactory <IIterableBuilder <TElem, TIterable> > factory, IEnumerable <TElem> values)
 {
     using (var builder = factory.EmptyBuilder) {
         builder.AddRange(values);
         return(builder.Produce());
     }
 }
コード例 #2
0
        public static void Init(TestContext context)
        {
            var configuration = new SdkConfigurationInternal(new SdkConfiguration("user", "pass", "host", "vhost", false, "sslServerName", 5, 12, 17, "GBP", SenderChannel.Mobile), null);

            _builderFactory = new BuilderFactoryHelper(configuration).BuilderFactory;
            _endCustomer    = _builderFactory.CreateEndCustomerBuilder().SetId("customerId").SetIp(IPAddress.Loopback).SetDeviceId("deviceId").SetLanguageId("si").Build();
        }
コード例 #3
0
 public ColumnsBuilderTest()
 {
     _columnConfigs  = new Dictionary <string, ColumnConfig>();
     _sortConfig     = new SortingConfig();
     _builderFactory = Substitute.For <IBuilderFactory>();
     _builder        = new ColumnsBuilder <TableEntity>(_columnConfigs, _sortConfig, _builderFactory);
 }
 internal MvcCoreBootstrapTableColumnsBuilder(Dictionary <string, ColumnConfig> columnConfigs, SortingConfig sortConfig,
                                              IBuilderFactory builderFactory)
 {
     _columnConfigs  = columnConfigs;
     _sortConfig     = sortConfig;
     _builderFactory = builderFactory;
 }
コード例 #5
0
 public StateFluentBuilder(IBuilderFactory factory, TOuterBuilder outerBuilder, Action <IState> builtAction)
 {
     _factory      = factory ?? throw new ArgumentNullException(nameof(factory));
     _builder      = factory.CreateStateBuilder(null);
     _outerBuilder = outerBuilder;
     _builtAction  = builtAction;
 }
コード例 #6
0
 public BXinthPricingMonitorService(IAmAnApiService apiService, Exchange exchange, IBuilderFactory builderFactory, IServiceProvider serviceProvider)
 {
     _apiService      = apiService;
     _exchange        = exchange;
     _builderFactory  = builderFactory;
     _serviceProvider = serviceProvider;
 }
コード例 #7
0
        /// <summary>
        ///   Produces an SQL <c>CREATE TABLE</c> statement that declares a <see cref="Table"/>.
        /// </summary>
        /// <remarks>
        ///   To keep the <see cref="ITable"/> interface closed to assemblies outside of Kvasir, the
        ///   <see cref="ITable.GenerateDeclaration(IBuilderFactory)"/> method is marked as <c>internal</c>; this
        ///   requires that <see cref="Table"/> class implement the method explicitly. This extension method allows for
        ///   natural invocation of the interface method, encapsulating the cast-to-interface required to invoke an
        ///   explicit interface method.
        /// </remarks>
        /// <param name="self">
        ///   The <see cref="Table"/> on which the extension method is invoked.
        /// </param>
        /// <param name="builderFactory">
        ///   The <see cref="IBuilderFactory"/> with which to create the various Builders needed to compose the
        ///   <c>CREATE TABLE</c> statement for this Table.
        /// </param>
        /// <pre>
        ///   <paramref name="self"/> is not <see langword="null"/>
        ///     --and--
        ///   <paramref name="builderFactory"/> is not <see langword="null"/>
        /// </pre>
        /// <returns>
        ///   A <see cref="SqlSnippet"/> whose body is a <c>CREATE TABLE</c> statement that declares
        ///   <paramref name="self"/>.
        /// </returns>
        public static SqlSnippet GenerateSqlDeclaration(this Table self, IBuilderFactory builderFactory)
        {
            Debug.Assert(self is not null);
            Debug.Assert(builderFactory is not null);

            return((self as ITable).GenerateDeclaration(builderFactory));
        }
コード例 #8
0
 public ApiServiceInjectionFactory(IConfigService configService, ICryptoCompareDataService cryptoCompareDataService, IBuilderFactory builderFactory, IServiceProvider serviceProvider)
 {
     _configService            = configService;
     _cryptoCompareDataService = cryptoCompareDataService;
     _builderFactory           = builderFactory;
     _serviceProvider          = serviceProvider;
 }
コード例 #9
0
 public BitstampApiService(Exchange exchange, IConfigService configService, ICryptoCompareDataService cryptoCompareDataService, IServiceProvider serviceProvider, IBuilderFactory builderFactory)
     : base(configService, cryptoCompareDataService, serviceProvider)
 {
     _exchange        = exchange;
     _serviceProvider = serviceProvider;
     _builderFactory  = builderFactory;
 }
コード例 #10
0
 /// <summary>
 /// Clear down the test context.
 /// </summary>
 protected virtual void TidyUp()
 {
     // Ensure that we wipe down the core objects - NUnit re-uses the instance for all tests
     entityFactory    = null;
     checkerFactory   = null;
     container        = null;
     containerContext = null;
 }
コード例 #11
0
 public ColumnBuilderTest()
 {
     _columnConfig = new ColumnConfig {
         Filtering = new FilteringConfig()
     };
     _builderFactory = Substitute.For <IBuilderFactory>();
     _builder        = new ColumnBuilder(_columnConfig, _builderFactory);
 }
コード例 #12
0
 internal TableBuilder(TableModel <T> model, ITableRenderer <T> renderer, IBuilderFactory builderFactory,
                       ITableConfig <T> config)
 {
     _model          = model;
     _renderer       = renderer;
     _builderFactory = builderFactory;
     _config         = config;
 }
コード例 #13
0
 public MTSTicketsHandlers(IMtsSdk mtsSdk, IBuilderFactory builderFactory, ILog log)
 {
     _mtsSdk          = mtsSdk;
     _factory         = builderFactory;
     _log             = log;
     _ticketService   = new TicketService(_log);
     _ticketGenerator = new TicketGenerator(_factory, _log);
 }
コード例 #14
0
ファイル: PricingService.cs プロジェクト: chz160/CryptoKeeper
 public PricingService(ICryptoCompareDataService cryptoCompareDataService, IMathService mathService, IBuilderFactory builderFactory, IPricingContext pricingContext, IExchangeApiServiceFactory exchangeApiServiceFactory)
 {
     _threads                   = new List <Thread>();
     _builderFactory            = builderFactory;
     _pricingContext            = pricingContext;
     _exchangeApiServiceFactory = exchangeApiServiceFactory;
     _cryptoCompareDataService  = cryptoCompareDataService;
     _mathService               = mathService;
 }
コード例 #15
0
        public ScxmlDirector(XmlReader xmlReader, IBuilderFactory factory, ScxmlDirectorOptions?options = default)
            : base(GetReaderForXmlDirector(xmlReader, options), options?.ErrorProcessor ?? DefaultErrorProcessor.Instance, options?.Async ?? false)
        {
            _namespaceResolver     = options?.NamespaceResolver;
            _stateMachineValidator = options?.StateMachineValidator;
            _factory        = factory;
            _errorProcessor = options?.ErrorProcessor ?? DefaultErrorProcessor.Instance;
            _nameTable      = xmlReader.NameTable ?? new NameTable();

            FillNameTable(_nameTable);
        }
コード例 #16
0
ファイル: HostingEngine.cs プロジェクト: devoneonline/Hosting
 public HostingEngine(
     IServerManager serverManager,
     IStartupManager startupManager,
     IBuilderFactory builderFactory,
     IHttpContextFactory httpContextFactory)
 {
     _serverManager      = serverManager;
     _startupManager     = startupManager;
     _builderFactory     = builderFactory;
     _httpContextFactory = httpContextFactory;
 }
コード例 #17
0
        public TransitionFluentBuilder(IBuilderFactory factory, TOuterBuilder outerBuilder, Action <ITransition> builtAction)
        {
            if (factory is null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            _builder      = factory.CreateTransitionBuilder(null);
            _outerBuilder = outerBuilder;
            _builtAction  = builtAction;
        }
コード例 #18
0
        public static IBuilderFactory <TBuilder> WithBuilderConfiguration <TBuilder>(this IBuilderFactory <TBuilder> factory,
                                                                                     IBuilderConfiguration <TBuilder> configuration)
        {
            if (configuration == null)
            {
                return(factory);
            }

            factory.Configurations.Add(configuration);

            return(factory);
        }
コード例 #19
0
 public void Init()
 {
     _builderFactory = new BuilderFactoryHelper().BuilderFactory;
     _senderBuilder  = _builderFactory.CreateSenderBuilder().SetBookmakerId(9985).SetLimitId(90).SetCurrency("EUR").SetSenderChannel(SenderChannel.Internet);
     _sender         = _senderBuilder.SetEndCustomer(_builderFactory.CreateEndCustomerBuilder()
                                                     .SetId("customer-client-" + SR.I1000)
                                                     .SetConfidence(12039203)
                                                     .SetIp(IPAddress.Loopback)
                                                     .SetLanguageId("en")
                                                     .SetDeviceId("123")
                                                     .Build())
                       .Build();
 }
コード例 #20
0
 public void BuildFastComputer(IBuilderFactory factory, int level)
 {
     factory.MakeCPU(1000);
     if (level == 2)
     {
         factory.MakeHardDisk(3000);
     }
     else
     {
         factory.MakeHardDisk(1000);
     }
     factory.MakeVideo(12);
 }
コード例 #21
0
        public TableBuilderTest()
        {
            TableModel <TableEntity> model = new TableModel <TableEntity>(Enumerable.Empty <TableEntity>());

            _renderer = Substitute.For <ITableRenderer <TableEntity> >();
            _renderer.Render(Arg.Do <ITableConfig <TableEntity> >(tc => _config = tc), Arg.Any <int>());
            _builderFactory = Substitute.For <IBuilderFactory>();
            _tableConfig    = Substitute.For <ITableConfig <TableEntity> >();
            _tableConfig.Paging.Returns(new PagingConfig());
            _tableConfig.Update.Returns(new UpdateConfig());
            _tableConfig.Columns.Returns(new Dictionary <string, ColumnConfig>());
            _builder = new TableBuilder <TableEntity>(model, _renderer, _builderFactory, _tableConfig);
        }
コード例 #22
0
        public Fund(IBuilderFactory builderFactory, IStockRepository stockRepository)
        {
            if (builderFactory == null)
            {
                throw new ArgumentNullException(nameof(builderFactory));
            }

            if (stockRepository == null)
            {
                throw new ArgumentNullException(nameof(stockRepository));
            }

            this.builderFactory  = builderFactory;
            this.stockRepository = stockRepository;
        }
コード例 #23
0
        /// <summary>
        /// Starts the MTS Sdk Session
        /// </summary>
        public void Start()
        {
            try
            {
                _log.Info("Running the MTS SDK Non-Blocking mode.");

                _log.Info("Retrieving configuration from application configuration file.");
                var config = MtsSdk.GetConfiguration();

                _log.Info("Creating root MTS SDK instance.");
                _mtsSdk = new MtsSdk(config);

                #region Testing Section

                ////handles database related operations
                //_ticketService = new TicketService(_log);
                ////handles all MTS events
                //_factory = _mtsSdk.BuilderFactory;
                //_ticketHandler = new MTSTicketsHandlers(_mtsSdk, _factory, _log);
                //TestSendTicket();

                #endregion

                _log.Info("Attaching to events.");
                AttachToFeedEvents(_mtsSdk);

                _log.Info("Opening the sdk instance (creating and opening connection to the AMPQ broker)");
                _mtsSdk.Open();
                _factory = _mtsSdk.BuilderFactory;

                //handles database related operations
                _ticketService = new TicketService(_log);
                //handles all MTS events
                _ticketHandler = new MTSTicketsHandlers(_mtsSdk, _factory, _log);

                //starting timer to get ticket updates from database
                _timer = new Timer(TicketUpdatesTimer_Tick, null, _updateInterval, _updateInterval);

                _log.Info("MTS SDK started successfully. Hit <enter> to quit if in console mode.");
                Console.WriteLine(string.Empty);
                Console.ReadLine();
            }
            catch (Exception error)
            {
                EventLog.WriteEntry("Service ", error.ToString(), EventLogEntryType.Error);
            }
        }
コード例 #24
0
 public ProjectEnvironmentConfigConverter(IBuilderFactory builderFactory, ICache cache)
 {
     _Cache          = cache;
     _BuilderFactory = builderFactory;
 }
コード例 #25
0
 internal MvcCoreBootstrapTableBuilder(TableModel <T> model, IBuilderFactory builderFactory, ITableConfig config)
 {
     _model          = model;
     _builderFactory = builderFactory;
     _config         = config;
 }
コード例 #26
0
 public BittrexPricingMonitorService(IAmAnApiService apiService, IBuilderFactory builderFactory, IServiceProvider serviceProvider)
 {
     _apiService      = apiService;
     _builderFactory  = builderFactory;
     _serviceProvider = serviceProvider;
 }
 public void GivenIHaveAnInstanceOfTheBuilderFactory()
 {
     Factory = new BuilderFactory();
 }
コード例 #28
0
 internal ColumnBuilder(ColumnConfig config, IBuilderFactory builderFactory)
 {
     _config         = config;
     _builderFactory = builderFactory;
 }
コード例 #29
0
 public void Init()
 {
     _builderFactory = new BuilderFactoryHelper().BuilderFactory;
     Assert.IsNotNull(_builderFactory);
 }
コード例 #30
0
 public BitTrexApiService(IConfigService configService, ICryptoCompareDataService cryptoCompareDataService, IServiceProvider serviceProvider, IBuilderFactory builderFactory)
     : base(configService, cryptoCompareDataService, serviceProvider)
 {
     _serviceProvider = serviceProvider;
     _builderFactory  = builderFactory;
 }
コード例 #31
0
        public void Run()
        {
            _log.LogInformation("Running the MTS SDK cashout example");

            _log.LogInformation("Retrieving configuration from application configuration file");
            var config = MtsSdk.GetConfiguration();

            _log.LogInformation("Creating root MTS SDK instance");
            _mtsSdk = new MtsSdk(config, _loggerFactory);

            _log.LogInformation("Attaching to events");
            AttachToFeedEvents(_mtsSdk);

            _log.LogInformation("Opening the sdk instance (creating and opening connection to the AMPQ broker)");
            _mtsSdk.Open();
            _factory = _mtsSdk.BuilderFactory;

            // create ticket (in order to be accepted, correct values must be entered)
            // values below are just for demonstration purposes and will not be accepted

            //cashout ticket is available only for live events
            var r = new Random();

            _originalTicket = _factory.CreateTicketBuilder()
                              .SetTicketId("ticketId-" + r.Next())
                              .SetSender(_factory.CreateSenderBuilder()
                                         .SetCurrency("EUR")
                                         .SetEndCustomer(_factory.CreateEndCustomerBuilder()
                                                         .SetId("customerClientId-" + r.Next())
                                                         .SetConfidence(1)
                                                         .SetIp(IPAddress.Loopback)
                                                         .SetLanguageId("en")
                                                         .SetDeviceId("UsersDevice-" + r.Next())
                                                         .Build())
                                         .Build())
                              .AddBet(_factory.CreateBetBuilder()
                                      .SetBetId("betId-" + r.Next())
                                      .SetBetBonus(1)
                                      .SetStake(123450000, StakeType.Total)
                                      .AddSelectedSystem(1)
                                      .AddSelection(_factory.CreateSelectionBuilder()
                                                    .SetEventId("1")
                                                    .SetIdUof(1, $"sr:match:{r.Next()}", 1, "1", string.Empty, null)
                                                    .SetOdds(11000)
                                                    .Build())
                                      .Build())
                              .BuildTicket();

            // send ticket to the MTS. Since this is a non-blocking way of sending, the response will raise the event TicketResponseReceived
            _log.LogInformation("Send ticket to the MTS.");
            _mtsSdk.SendTicket(_originalTicket);

            _log.LogInformation("Example successfully executed. Hit <enter> to quit");
            Console.WriteLine(string.Empty);
            Console.ReadLine();

            _log.LogInformation("Detaching from events");
            DetachFromFeedEvents(_mtsSdk);

            _log.LogInformation("Closing the connection and disposing the instance");
            _mtsSdk.Close();

            _log.LogInformation("Example stopped");
        }