Exemple #1
0
        public void EngineShouldCreateWheel(int wheelWidth, int wheelHeight)
        {
            var spinResult = new MagicPaperSpinResult()
                             .CreateWheel(wheelWidth, wheelHeight);

            Assert.IsNotNull(spinResult.Wheel);
        }
Exemple #2
0
        public void EngineShouldCreateCorrectWheelDimensions(int wheelWidth, int wheelHeight)
        {
            var spinResult = new MagicPaperSpinResult()
                             .CreateWheel(wheelWidth, wheelHeight);

            Assert.AreEqual(wheelWidth, spinResult.Wheel.Width);
            Assert.AreEqual(wheelHeight, spinResult.Wheel.Height);
        }
Exemple #3
0
        public int EngineShouldCreateWinPositionLineNumber(string wheelString, int level, decimal bet, int betLevel)
        {
            var wheelValues  = Array.ConvertAll(wheelString.Split(','), Convert.ToInt32);
            var encodedWheel = EncodeWheel(Wheel.Width, Wheel.Height, wheelValues);

            var spinResult = new MagicPaperSpinResult()
            {
                Wheel = encodedWheel
            }.CalculateWin(bet, betLevel);

            return(spinResult.WinPositions.FirstOrDefault().Line);
        }
Exemple #4
0
        public void EngineShouldNotCreateWinPositionsOnLose(string wheelString, int level, decimal bet, int betLevel)
        {
            var wheelValues  = Array.ConvertAll(wheelString.Split(','), Convert.ToInt32);
            var encodedWheel = EncodeWheel(Wheel.Width, Wheel.Height, wheelValues);

            var spinResult = new MagicPaperSpinResult()
            {
                Wheel = encodedWheel
            }.CalculateWin(bet, betLevel);

            Assert.IsNull(spinResult.WinPositions.FirstOrDefault());
        }
Exemple #5
0
        public decimal EngineShouldReturnCorrectPayout(string wheelString, int level, decimal bet, int betLevel)
        {
            var wheelValues  = Array.ConvertAll(wheelString.Split(','), Convert.ToInt32);
            var encodedWheel = EncodeWheel(Wheel.Width, Wheel.Height, wheelValues);

            var spinResult = new MagicPaperSpinResult()
            {
                Wheel = encodedWheel
            }
            .CalculateWin(bet, betLevel);

            return(spinResult.Win);
        }
        public void TestFullCycle(int level, int betLines)
        {
            var timeStart        = DateTime.Now;
            var module           = GetModule();
            var targetRtpLevel   = Math.Round(Config.RtpLevels.FirstOrDefault(rl => rl.Level == level && rl.Multiplier == betLines).Rtp, 2);
            var totalSummaryData = new SummaryData();

            var ugk = new UserGameKey()
            {
                UserId = -1,
                GameId = module.GameId,
                Level  = 888
            };

            var reelStrip = Config.LevelReels
                            .FirstOrDefault(lr => lr.Level == level)
                            .ReelStrips
                            .FirstOrDefault(rs => rs.BetLines == betLines);

            reelStrip.Symbols[0].ForEach(sym1 =>
            {
                reelStrip.Symbols[1].ForEach(sym2 =>
                {
                    reelStrip.Symbols[2].ForEach(sym3 =>
                    {
                        var spinResult = new MagicPaperSpinResult()
                        {
                            SpinBet = new SpinBet(ugk, PlatformType.None)
                            {
                                Lines      = Config.Lines,
                                Multiplier = betLines,
                                LineBet    = 1
                            },
                            Wheel = GetFullCycleWheel(Config.Lines, new List <int> {
                                sym1, sym2, sym3
                            })
                        }
                        .CalculateWin(1, betLines);

                        totalSummaryData.Update(spinResult);
                    });
                });
            });

            totalSummaryData.DisplayData(level, timeStart, targetRtpLevel);
            var resultOverallRtp = Math.Round(totalSummaryData.RtpData.OverallRtp, 2);

            var isRtpEquivalent = resultOverallRtp == targetRtpLevel;

            Assert.True(isRtpEquivalent, $"RTP not matching. The result is {resultOverallRtp}.");
        }
        public void TestBets(int gameId, int level, string currencyCode, int numOfUsers, int numItrPerUser, decimal bet, int lines, int mp)
        {
            var timeStart        = DateTime.Now;
            var module           = GetModule();
            var targetRtpLevel   = Config.RtpLevels.FirstOrDefault(rl => rl.Level == level && rl.Multiplier == mp).Rtp;
            var totalSummaryData = new SummaryData();

            var users    = GenerateUsers(gameId, numOfUsers, level);
            var spinBets = GenerateUserBets(users, bet, 0, lines, mp);

            Parallel.ForEach(users,
                             () => new SummaryData(),
                             (key, state, summaryData) =>
            {
                var spinBet = spinBets[key.UserId];
                for (var i = 0; i < numItrPerUser; i++)
                {
                    var spinResult = new MagicPaperSpinResult()
                    {
                        SpinBet = spinBet
                    }
                    .CreateWheel(Config.Wheel.Width, Config.Wheel.Height)
                    .GenerateRandomWheel(Config.Wheels, level, mp)

                    .CalculateWin(bet, mp);

                    summaryData.Update(spinResult);
                }

                return(summaryData);
            },
                             sdata => { lock (totalSummaryData) { totalSummaryData.Sum(sdata); } });

            totalSummaryData.DisplayData(level, timeStart, targetRtpLevel);
            totalSummaryData.DisplayPayoutsData(bet, lines);

            var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 1 && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 1;

            Assert.True(isWithinRtp, $"RTP not matching. The result is {totalSummaryData.RtpData.OverallRtp}.");
        }