Ejemplo n.º 1
0
        public void EngineShouldReturnInstantWinBonus(int level)
        {
            var config     = new Configuration();
            var spinResult = GenerateWinningSpinResult(level);

            var bonus = FeatureBonusEngine.GetBonus(Features.InstantWin, spinResult, config);

            Assert.AreSame(typeof(InstantWinBonus), bonus.GetType());
        }
Ejemplo n.º 2
0
        public void EngineShouldReturnNullOnInvalidBonus(int level)
        {
            var config     = new Configuration();
            var spinResult = GenerateWinningSpinResult(level);

            var bonus = FeatureBonusEngine.GetBonus(int.MaxValue, spinResult, config);

            Assert.AreSame(null, bonus);
        }
Ejemplo n.º 3
0
        public void SpinResultShouldCreateValidBonusElementOnUpdateWhenWin(string wheelString, int level, decimal bet)
        {
            var config  = new Configuration();
            var spinBet = MainGameEngine.GenerateSpinBet(new RequestContext <SpinArgs>("", "", PlatformType.Web)
            {
                GameSetting = new Model.Entity.GameSetting {
                    GameSettingGroupId = 0
                },
                Currency = new Model.Entity.Currency {
                    Id = 0
                },
                Parameters = new SpinArgs
                {
                    LineBet    = bet,
                    Multiplier = 1,
                },
            });

            var wheel        = new Wheel(Game.WheelWidth, Game.WheelHeight, wheelString);
            var winPositions = MainGameEngine.GenerateWinPositions(
                config.Payline,
                config.PayTable,
                wheel,
                spinBet.LineBet,
                spinBet.Lines,
                spinBet.Multiplier);

            var spinResult = new Games.NuwaAndTheFiveElements.Models.GameResults.Spins.SpinResult(level, spinBet, wheel, null, winPositions, null, null)
            {
                Level = level
            };
            var featureType = FeatureBonusEngine.GetFeatureType(spinResult, config.BonusConfig.TriggerWeights[spinResult.Level]);
            var bonus       = FeatureBonusEngine.GetBonus(featureType, spinResult, config);

            spinResult.UpdateBonus(bonus);

            Assert.IsTrue(spinResult.Bonus.Id > 0 && !string.IsNullOrWhiteSpace(spinResult.Bonus.Value));
        }