コード例 #1
0
 public GamesTestHelper(IGameCommands gameCommands, IGameRepository gameRepository, IGameManagement gameManagement, IGameQueries gameQueries)
 {
     _gameCommands    = gameCommands;
     _gameManagement  = gameManagement;
     _gameQueries     = gameQueries;
     _gamesRepository = gameRepository;
 }
コード例 #2
0
        public override void BeforeEach()
        {
            base.BeforeEach();
            _queries    = Container.Resolve <IGameQueries>();
            _commands   = Container.Resolve <IGameCommands>();
            _repository = Container.Resolve <IGameRepository>();
            _gsiHelper  = Container.Resolve <GamesTestHelper>();

            _gsiHelper.CreateGameServer();
        }
コード例 #3
0
 public CommonGameActionsProvider(
     IUnityContainer container,
     IGameCommands gameCommands,
     IGameQueries gameQueries,
     ITransactionScopeProvider transactionScope,
     IErrorManager errors)
 {
     _container        = container;
     _gameCommands     = gameCommands;
     _gameQueries      = gameQueries;
     _transactionScope = transactionScope;
     _errors           = errors;
 }
コード例 #4
0
 public CommonGameActionsProvider(
     IUnityContainer container,
     IGameCommands gameCommands,
     IGameQueries gameQueries,
     ITransactionScopeProvider transactionScope,
     IErrorManager errors,
     FrozenStatusValidator frozenStatusValidator)
 {
     _container             = container;
     _gameCommands          = gameCommands;
     _gameQueries           = gameQueries;
     _transactionScope      = transactionScope;
     _errors                = errors;
     _frozenStatusValidator = frozenStatusValidator;
 }
コード例 #5
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _repository   = new FakeGameRepository();
            _eventBusMock = new Mock <IEventBus>();
            _gameWalletsOperationsMock = new Mock <IGameWalletOperations>();

            _gameWalletsOperationsMock.Setup(
                t => t.PlaceBetAsync(It.IsAny <Guid>(), It.IsAny <Guid>(), It.IsAny <Guid>(), It.IsAny <decimal>(), It.IsAny <string>()))
            .Returns(Task.FromResult(Guid.NewGuid()));
            _commands = new GameCommands(_repository, _gameWalletsOperationsMock.Object, _eventBusMock.Object);

            _gameId   = Guid.NewGuid();
            _gpId     = Guid.NewGuid();
            _gpCode   = Guid.NewGuid().ToString();
            _brandId  = Guid.NewGuid();
            _playerId = Guid.NewGuid();

            _repository.GameProviders.Add(new GameProvider
            {
                Id   = _gpId,
                Code = _gpCode
            });
            _repository.Games.Add(new Core.Game.Interface.Data.Game
            {
                Id             = _gameId,
                GameProviderId = _gpId,
                ExternalId     = "TEST-GAME"
            });

            _repository.Brands.Add(new Core.Game.Interface.Data.Brand
            {
                Id         = _brandId,
                TimezoneId = TimeZoneInfo.Utc.Id
            });

            _repository.Players.Add(new Core.Game.Interface.Data.Player()
            {
                Id      = _playerId,
                BrandId = _brandId
            });
        }
コード例 #6
0
        public CommonGameActionsProvider(
            IUnityContainer container,
            IGameCommands gameCommands,
            IGameQueries gameQueries,
            ITransactionScopeProvider transactionScope,
            IErrorManager errors,
            IModeSwitch modeSwitch,
            IFlycowApiClientProvider flycowApiClientProvider
            )
        {
            _container               = container;
            _gameCommands            = gameCommands;
            _gameQueries             = gameQueries;
            _transactionScope        = transactionScope;
            _errors                  = errors;
            _flycowApiClientProvider = flycowApiClientProvider;

            _useRealUgs = modeSwitch.IsUsingRealUgs();
        }
コード例 #7
0
        public UgsGameCommandsAdapter(IGameCommands gameCommands)
        {
            _gameCommands = gameCommands;

            _gameEventsMap =
                new Dictionary <BusEventType, Action <UgsGameEvent> >
            {
                {
                    BusEventType.BetPlaced, @event =>
                    {
                        @event.amount = (@event.amount < 0) ? [email protected] : @event.amount;
                        _gameCommands.PlaceBetAsync(GetGameActionData(@event), GetGameActionContext(@event),
                                                    Guid.Parse(@event.userid)).GetAwaiter().GetResult();
                    }
                },
                {
                    BusEventType.BetWon, @event =>
                    {
                        _gameCommands.WinBetAsync(GetGameActionData(@event), GetGameActionContext(@event))
                        .GetAwaiter()
                        .GetResult();
                    }
                },
                {
                    BusEventType.BetLost, @event =>
                    {
                        _gameCommands.LoseBetAsync(GetGameActionData(@event), GetGameActionContext(@event))
                        .GetAwaiter()
                        .GetResult();
                    }
                },
                {
                    BusEventType.BetFree, @event =>
                    {
                        _gameCommands.FreeBetAsync(GetGameActionData(@event), GetGameActionContext(@event),
                                                   Guid.Parse(@event.userid)).GetAwaiter().GetResult();
                    }
                },
                {
                    BusEventType.BetTied, @event =>
                    {
                        _gameCommands.TieBetAsync(GetGameActionData(@event), GetGameActionContext(@event))
                        .GetAwaiter()
                        .GetResult();
                    }
                },
                {
                    BusEventType.BetAdjusted, @event =>
                    {
                        _gameCommands.AdjustTransaction(GetGameActionData(@event), GetGameActionContext(@event));
                    }
                },
                {
                    BusEventType.GameActionCancelled, @event =>
                    {
                        _gameCommands.CancelTransactionAsync(GetGameActionData(@event), GetGameActionContext(@event))
                        .GetAwaiter()
                        .GetResult();
                    }
                }
            };
        }