public void TestCreateFreeSpinBonus()
        {
            // Arrange
            var user   = new UserGameKey(-1, 80);
            var result = new GeniesLuckResult()
            {
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 1, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 2, 2, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 3)
                {
                    Count = 10
                }
            };
            // action
            var bonus = module.CreateBonus(result);
            var state = ((GeniesLuckBonus)bonus.Value).State;

            // Assert
            Assert.AreEqual(result.Bonus.Guid, bonus.Value.Guid);
            Assert.AreEqual(true, state is FreeSpin);
            Assert.AreEqual(true, ((FreeSpin)state).Count == 10);
        }
        public void TestCreateFreeGameBonus()
        {
            // Arrange
            var user    = new UserGameKey(-1, 3);
            var result1 = new CleopatraSpinResult(user)
            {
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 1, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 2, 2, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 2)
                {
                    Count = 4
                }
            };

            // action
            var bonus1 = module.CreateBonus(result1);
            var state1 = ((CleopatraBonus)bonus1.Value).State;

            // Assert
            Assert.AreEqual(result1.Bonus.Guid, bonus1.Value.Guid);
            Assert.AreEqual(true, state1 is FreeSpinState);
            Assert.AreEqual(true, ((FreeSpinState)state1).Count == 4);
        }
Esempio n. 3
0
        public void TestCreateFreeGameBonus()
        {
            // Arrange
            var user    = new UserGameKey(-1, 109);
            var result1 = new FortuneChimesSpinResult(user)
            {
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 0, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 2, 2, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 3)
                {
                    Count = 4
                },
                Wheel = new FortuneChimesWheel
                {
                    Reels = new List <int[]>
                    {
                        new int[] { 1, 1, 1 },
                        new int[] { 2, 2, 2 },
                        new int[] { 10, 10, 10 },
                        new int[] { 4, 4, 4 },
                        new int[] { 5, 5, 5 }
                    },
                    Indices = new int[] { 0, 0, 0, 0, 0 }
                }
            };

            // action
            var bonus1 = module.CreateBonus(result1);
            var state1 = ((FortuneChimesBonus)bonus1.Value).State;

            // Assert
            Assert.AreEqual(result1.Bonus.Guid, bonus1.Value.Guid);
            Assert.AreEqual(true, state1 is FreeSpinState);
            Assert.AreEqual(true, ((FreeSpinState)state1).Count == 4);
        }
Esempio n. 4
0
        public void TestCreateFreeGameBonus()
        {
            // Arrange
            var user    = new UserGameKey(-1, 32);
            var result1 = new FortuneKoiSpinResult(user)
            {
                Wheel = new FortuneKoiWheel
                {
                    Reels = new List <int[]>
                    {
                        new int[] { },
                        new int[] { 7, 7, 7 },
                        new int[] { },
                        new int[] { },
                        new int[] { }
                    }
                },
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 1, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 0, 0, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 3)
                {
                    Count = 1
                }
            };

            // action
            var bonus1 = module.CreateBonus(result1);
            var state1 = ((FortuneKoiBonus)bonus1.Value).State;

            // Assert
            Assert.AreEqual(result1.Bonus.Guid, bonus1.Value.Guid);
            Assert.AreEqual(true, state1 is ReSpinState);
            Assert.AreEqual(true, ((ReSpinState)state1).Count == 1);
        }
        public void TestCreateFreeSpinBonus()
        {
            // Arrange
            var user   = new UserGameKey(-1, 104);
            var result = new Games.DragonRiches.DragonRichesResult();
            var reels  = new List <int[]>
            {
                new[] { 0, 6, 10 },
                new[] { 6, 11, 12 },
                new[] { 6, 11, 13 },
                new[] { 9, 11, 12, },
                new[] { 12, 10, 13 }
            };

            result.Bonus = new Stake(Guid.NewGuid(), 3)
            {
                Count = 6
            };
            result.Wheel          = new Games.DragonRiches.DragonRichesWheel();
            result.BonusPositions = new List <BonusPosition> {
                new BonusPosition {
                    Line = 1, Multiplier = 1, RowPositions = new List <int> {
                        0, 2, 2, 2, 0
                    }
                }
            };

            // action
            var bonus = module.CreateBonus(result);
            var state = ((Games.DragonRiches.DragonRichesBonus)bonus.Value).State;

            // Assert
            Assert.AreEqual(result.Bonus.Guid, bonus.Value.Guid);
            Assert.AreEqual(true, state is Games.DragonRiches.FreeSpin);
            Assert.AreEqual(false, state is Games.DragonRiches.HoldSpin);
            Assert.AreEqual(false, state is Games.DragonRiches.HoldFreeSpin);
            Assert.AreEqual(6, ((Games.DragonRiches.FreeSpin)state).State.Count);
        }
Esempio n. 6
0
        public decimal TestFreeSpin(string freeSpinStripsString, int replaceBy)
        {
            // arrange
            var request = CreateRequestContext <SpinArgs>(user);

            request.Parameters = new SpinArgs
            {
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var bonusRequest = CreateRequestContext <BonusArgs>(user);
            var reelStrips   = ParsheetTests.Encoding("0,18,18,3,4,15,5,8,14,7,8,14,4,2,14".Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
            var wheel        = CreateWheel(reelStrips, replaceBy);

            wheel.Replace = replaceBy;

            // action
            var result        = Engine.DoSpin(1, request, wheel);
            var bonus         = module.CreateBonus(result);
            var freeSpinBonus = bonus.Value as FreeSpinBonus;

            reelStrips    = ParsheetTests.Encoding(freeSpinStripsString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
            wheel         = CreateWheel(reelStrips, replaceBy);
            wheel.Replace = replaceBy;
            var freeSpinResult = Engine.ClaimBonus(1, freeSpinBonus, bonusRequest, wheel) as FuDaoLeFreeSpinResult;

            // assert
            Assert.AreEqual(freeSpinResult.Counter, 7);
            Assert.AreEqual(freeSpinResult.CumulativeWin, freeSpinResult.Win);
            Assert.AreEqual(freeSpinResult.IsCompleted, false);

            Assert.AreEqual(freeSpinBonus.CurrentStep, 2);
            Assert.AreEqual(freeSpinBonus.Counter, 7);
            Assert.AreEqual(freeSpinBonus.IsCompleted, false);
            Assert.AreEqual(string.Join(',', result.BonusPositions[0].RowPositions), "0,0,3,3,3");
            return(freeSpinResult.Win);
        }
Esempio n. 7
0
        private static SummaryData ExecuteFreeSpin(int level, RequestContext <BonusArgs> bonusRequestcontext, ReelGemResult result)
        {
            var bonus         = module.CreateBonus(result);
            var summData      = new SummaryData();
            var freeSpinBonus = bonus.Value as FreeSpinBonus;

            do
            {
                var freeSpinResult = ReelGemsEngine.ClaimBonus(level, freeSpinBonus, bonusRequestcontext);
                summData.TotalWin += freeSpinResult.Win;
                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
            } while (true);
            return(summData);
        }
Esempio n. 8
0
        private static SummaryData ExecuteFreeSpin(int level, RequestContext <BonusArgs> bonusRequestcontext, WuxiaPrincessResult result)
        {
            var bonus         = module.CreateBonus(result);
            var summData      = new SummaryData();
            var freeSpinBonus = bonus.Value as FreeSpinBonus;

            do
            {
                summData.FSpinCounter++;
                var freeSpinResult = WuxiaPrincessEngine.ClaimBonus(level, freeSpinBonus, bonusRequestcontext) as WuxiaPrincessFreeSpinResult;
                summData.FSTotalWin += freeSpinResult.Win;
                if (freeSpinResult.SpinResult.HasBonus)
                {
                    summData.FgFHit++;
                }

                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
            } while (true);
            return(summData);
        }
        public void TestCreateFreeGameBonus()
        {
            // Arrange
            var user    = new UserGameKey(-1, 3);
            var result1 = new BikiniBeachResult()
            {
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 1, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 2, 2, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 2)
                {
                    Count = 4
                }
            };
            var result2 = new BikiniBeachResult()
            {
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 1, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 2, 2, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 3)
                {
                    Count = 1
                }
            };
            var result3 = new BikiniBeachResult()
            {
                BonusPositions = new List <BonusPosition> {
                    new BonusPosition {
                        Line = 1, Multiplier = 1, RowPositions = new List <int> {
                            0, 2, 2, 2, 0
                        }
                    }
                },
                Bonus = new Stake(Guid.NewGuid(), 4)
                {
                    Count = 3
                }
            };

            // action
            var bonus1 = module.CreateBonus(result1);
            var bonus2 = module.CreateBonus(result2);
            var bonus3 = module.CreateBonus(result3);
            var state1 = ((BikiniBeachBonus)bonus1.Value).State;
            var state2 = ((BikiniBeachBonus)bonus2.Value).State;
            var state3 = ((BikiniBeachBonus)bonus3.Value).State;

            // Assert
            Assert.AreEqual(result1.Bonus.Guid, bonus1.Value.Guid);
            Assert.AreEqual(result2.Bonus.Guid, bonus2.Value.Guid);
            Assert.AreEqual(result3.Bonus.Guid, bonus3.Value.Guid);
            Assert.AreEqual(true, state1 is FreeSpin);
            Assert.AreEqual(true, state2 is SwimWear);
            Assert.AreEqual(true, state3 is BodyPart);
            Assert.AreEqual(true, ((FreeSpin)state1).Count == 4);
            Assert.AreEqual(true, ((SwimWear)state2).Count == 1);
            Assert.AreEqual(true, ((BodyPart)state3).Count == 3);
        }
Esempio n. 10
0
        public void TestExecuteBonus()
        {
            // Arrange
            var spinResult = new BearResult("s");
            var user       = new UserGameKey(-1, 103);
            var reels      = new List <int[]>
            {
                new[] { 0, 6, 10 },
                new[] { 6, 11, 12 },
                new[] { 6, 11, 13 },
                new[] { 9, 11, 12, },
                new[] { 12, 10, 13 }
            };

            spinResult.Bonus          = new Stake(Guid.NewGuid(), 3);
            spinResult.Bonus.Count    = 15;
            spinResult.Wheel          = new BearWheel(1, ArrayModule.OfSeq(reels));
            spinResult.BonusPositions = new List <BonusPosition> {
                new BonusPosition {
                    Line = 1, Multiplier = 1, RowPositions = new List <int> {
                        0, 2, 2, 2, 0
                    }
                }
            };
            spinResult.SpinBet = new SpinBet(user, PlatformType.None)
            {
                Lines   = 25,
                LineBet = 1.0m
            };
            var userSession = new UserSession
            {
                SessionKey = "unittest",
                UserId     = -1
            };
            var requestContext = new RequestContext <SpinArgs>("simulation", "Bonus Bear", PlatformType.None)
            {
                GameSetting = new GameSetting {
                    GameSettingGroupId = 1
                },
                Query = new QueryCollection {
                },
                Game  = new Game {
                    Id = 103
                }
            };
            var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Bonus Bear", PlatformType.None)
            {
                GameSetting = new GameSetting {
                    GameSettingGroupId = 1
                },
                Query = new QueryCollection {
                },
            };

            requestBonusContext.UserSession = userSession;
            requestBonusContext.UserGameKey = user;
            var bonus = module.CreateBonus(spinResult).Value;

            var entity = new BonusEntity
            {
                UserId       = userSession.UserId,
                GameId       = requestContext.Game.Id,
                Guid         = bonus.Guid.ToString("N"),
                Data         = Model.Utility.Extension.ToByteArray(bonus),
                BonusType    = bonus.GetType().Name,
                Version      = 3,
                IsOptional   = bonus.IsOptional,
                IsStarted    = bonus.IsStarted,
                RoundId      = 1,
                BetReference = ""
            };

            // action
            var result = module.ExecuteBonus(1, entity, requestBonusContext).Value as BearSeqFreeSpinResult;

            // assert
            Assert.NotNull(result);
            Assert.AreEqual(true, ((Domain.BearBonus)result.Bonus).State.IsFreeSpin);
            Assert.IsTrue(result.Type == "fs");
        }