public void EngineShouldWriteXmlOfFreeSpinBonusResultXml(int gameId, int level)
        {
            var module         = GetModule(gameId);
            var spinResult     = GenerateWithBonusSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(spinResult);
            var freeSpinResult = GenerateFreeSpinResult(level);

            freeSpinBonus.UpdateBonus(freeSpinResult);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var xElement            = freeSpinBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                var responseXml = new FreeSpinBonusXml();
                using (var xmlReader = xElement.CreateReader())
                {
                    responseXml.ReadXml(xmlReader);
                }

                using (var memStream = new MemoryStream())
                    using (var xmlWriter = XmlWriter.Create(memStream, new XmlWriterSettings()
                    {
                        ConformanceLevel = ConformanceLevel.Auto
                    }))
                    {
                        xmlWriter.WriteStartElement("bonus");
                        responseXml.WriteXml(xmlWriter);
                    }
            });
        }
Esempio n. 2
0
        public void EngineShouldReadResponseXmlOfFreeSpinBonusResult(int gameId, int level)
        {
            var module     = GetModule(gameId);
            var spinResult = GenerateWithBonusSpinResult(level);

            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);
            var freeSpinResult = GenerateFreeSpinResult(level);

            freeSpinBonus.UpdateBonus(freeSpinResult);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var xElement            = freeSpinBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new FreeSpinBonusXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
Esempio n. 3
0
        public void EngineShouldCreateFreeSpinBonusResultFromFreeSpinCollapsingResult(int level)
        {
            var config         = new Configuration();
            var requestContext = new RequestContext <BonusArgs>("", "", PlatformType.Web)
            {
                GameSetting = new Model.Entity.GameSetting {
                    GameSettingGroupId = 0
                },
                Currency = new Model.Entity.Currency {
                    Id = 0
                },
                Parameters = new BonusArgs(),
                Platform   = PlatformType.All
            };

            Assert.DoesNotThrow(() =>
            {
                var freeSpinResult           = FreeSpinBonusEngine.CreateFreeSpinResult(level, requestContext, config);
                var freeSpinBonus            = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);
                var targetWheel              = MainGameEngine.GetTargetWheel(level, config, freeSpinResult.Wheel.ReelStripsId);
                var freeSpinCollapsingResult = FreeSpinBonusEngine.CreateFreeSpinCollapsingResult(freeSpinResult, targetWheel, config.BonusConfig.FreeSpin.Multipliers, config.Payline, config.PayTable);

                var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinCollapsingResult);
            });
        }
        public void EngineShouldCreateFreeSpinBonusResultFromFreeSpinResult(int level)
        {
            var config         = new Configuration();
            var requestContext = new RequestContext <BonusArgs>("", "", PlatformType.Web)
            {
                GameSetting = new Model.Entity.GameSetting {
                    GameSettingGroupId = 0
                },
                Currency = new Model.Entity.Currency {
                    Id = 0
                },
                Parameters = new BonusArgs(),
                Platform   = PlatformType.All
            };

            var spinResult             = GenerateSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);
            var freeSpinResult = FreeSpinBonusEngine.CreateFreeSpinResult(level, requestContext, freeSpinMode, spinResult, config);

            Assert.DoesNotThrow(() => FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult));
        }
Esempio n. 5
0
        public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level)
        {
            var module     = GetModule(gameId);
            var spinResult = GenerateWithBonusSpinResult(level);

            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);
            var freeSpinResult = GenerateFreeSpinResult(level);

            freeSpinBonus.UpdateBonus(freeSpinResult);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var xElement            = freeSpinBonusResult.ToXElement();
            var responseXml         = new FreeSpinBonusXml();

            using (var xmlReader = xElement.CreateReader())
            {
                responseXml.ReadXml(xmlReader);
            }

            Assert.IsNull(responseXml.GetSchema());
            Assert.AreEqual(freeSpinBonusResult.TotalWin, responseXml.TotalWin);
            Assert.AreEqual(freeSpinBonusResult.Counter, responseXml.Counter);
            Assert.AreEqual(freeSpinBonusResult.NumberOfFreeSpin, responseXml.NumberOfFreeSpin);
        }
Esempio n. 6
0
        public void EngineShouldCompleteFreeSpinBonusResultOnBonusCompletion(int level)
        {
            var freeSpinResult         = GenerateWinningFreeSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(freeSpinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            freeSpinResult.UpdateBonus(freeSpinBonus);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            while (!freeSpinBonus.IsCompleted)
            {
                freeSpinResult = GenerateNonWinningFreeSpinResult(level);
                freeSpinBonus.UpdateBonus(freeSpinResult);
                freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            }

            Assert.IsTrue(freeSpinBonusResult.IsCompleted);
        }
Esempio n. 7
0
        public void EngineShouldCreateFreeSpinBonusResultWithSameGameResultAndBonus(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            Assert.AreSame(freeSpinBonusResult.Bonus, freeSpinBonus);
        }
Esempio n. 8
0
        public void EngineShouldCreateFreeSpinBonusResultWithSameSpinTransactionId(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            Assert.IsTrue(freeSpinBonusResult.SpinTransactionId == freeSpinBonus.SpinTransactionId);
        }
Esempio n. 9
0
        public void EngineShouldContinueFreeSpinBonusResultOnWinSpin(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            Assert.IsTrue(!freeSpinBonusResult.IsCompleted);
        }
Esempio n. 10
0
        public void EngineShouldCreateBonusXElementOfFreeSpinBonusResult(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            var xElement = freeSpinBonusResult.ToXElement();

            Assert.IsNotNull(xElement);
        }
Esempio n. 11
0
        public void EngineShouldCreateBonusResponseXmlOfFreeSpinBonusResult(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            var responseXml = freeSpinBonusResult.ToResponseXml(Model.ResponseXmlFormat.History);

            Assert.IsNotNull(responseXml);
        }
        public void EngineShouldCreateBonusXElementOfFreeSpinBonusResult(int gameId, int level)
        {
            var module         = GetModule(gameId);
            var spinResult     = GenerateWithBonusSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(spinResult);
            var freeSpinResult = GenerateFreeSpinResult(level);

            freeSpinBonus.UpdateBonus(freeSpinResult);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var xElement            = freeSpinBonusResult.ToXElement();

            Assert.IsNotNull(xElement);
        }
        public void EngineShouldCreateBonusResponseXmlOfFreeSpinBonusResult(int gameId, int level)
        {
            var module         = GetModule(gameId);
            var spinResult     = GenerateWithBonusSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(spinResult);
            var freeSpinResult = GenerateFreeSpinResult(level);

            freeSpinBonus.UpdateBonus(freeSpinResult);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var responseXml         = freeSpinBonusResult.ToResponseXml(ResponseXmlFormat.History);

            Assert.IsNotNull(responseXml);
        }
        public void EngineShouldCreateCollapsingResultSameRoundId(int level)
        {
            var config = new Configuration();

            var spinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinCollapsingResult = GenerateWinningFreeSpinCollapsingResult(level);
            var freeSpinBonus            = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinCollapsingResult);

            freeSpinBonus.UpdateBonus(freeSpinCollapsingResult);

            var spinResultCollapsingResult = CollapsingBonusEngine.CreateCollapsingSpinResult(spinResult, config.Wheels[level], config.SymbolCollapsePairs, config.Payline, config.PayTable);
            var freeSpinCollapsingResultCollapsingResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinCollapsingResult);

            Assert.IsTrue(spinResult.RoundId == spinResultCollapsingResult.RoundId);
            Assert.IsTrue(freeSpinCollapsingResultCollapsingResult.RoundId == freeSpinCollapsingResult.RoundId);
        }
Esempio n. 15
0
        public void EngineShouldCreateCollapsingResultSameRoundId(int level)
        {
            var config = new Configuration();

            var spinResult               = GenerateWinningFreeSpinResult(level);
            var referenceWheel           = MainGameEngine.GetTargetWheel(level, config, spinResult.Wheel.ReelStripsId);
            var freeSpinCollapsingResult = GenerateWinningFreeSpinCollapsingResult(level);
            var freeSpinBonus            = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinCollapsingResult);

            freeSpinBonus.UpdateBonus(freeSpinCollapsingResult);

            var spinResultCollapsingResult = CollapsingBonusEngine.CreateCollapsingSpinResult(spinResult, referenceWheel, config.BonusConfig.FreeSpin.Multipliers, config.Payline, config.PayTable);
            var freeSpinCollapsingResultCollapsingResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinCollapsingResult);

            Assert.IsTrue(spinResult.RoundId == spinResultCollapsingResult.RoundId);
            Assert.IsTrue(freeSpinCollapsingResultCollapsingResult.RoundId == freeSpinCollapsingResult.RoundId);
        }
Esempio n. 16
0
        public void EngineShouldCompleteFreeSpinBonusResultOnBonusCompletion(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult, 0);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            while (!freeSpinBonus.IsCompleted)
            {
                freeSpinResult = GenerateNonWinningFreeSpinResult(level);
                freeSpinBonus.UpdateBonus(freeSpinResult, 0);
                freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            }

            Assert.IsTrue(freeSpinBonusResult.IsCompleted);
        }
Esempio n. 17
0
        public void EngineShouldCreateFreeSpinBonusResultWithSameSpinTransactionId(int level)
        {
            var freeSpinResult         = GenerateWinningFreeSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(freeSpinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            freeSpinResult.UpdateBonus(freeSpinBonus);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            Assert.IsTrue(freeSpinBonusResult.SpinTransactionId == freeSpinBonus.SpinTransactionId);
        }
Esempio n. 18
0
        public void EngineShouldReadResponseXmlOfFreeSpinBonusResult(int level)
        {
            var freeSpinResult = GenerateWinningFreeSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            var xElement = freeSpinBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new BonusXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
Esempio n. 19
0
        public void EngineShouldCreateBonusResponseXmlOfFreeSpinBonusResult(int level)
        {
            var freeSpinResult         = GenerateWinningFreeSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(freeSpinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            freeSpinResult.UpdateBonus(freeSpinBonus);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            var responseXml = freeSpinBonusResult.ToResponseXml(ResponseXmlFormat.History);

            Assert.IsNotNull(responseXml);
        }
Esempio n. 20
0
        public void EngineShouldCreateBonusXElementOfFreeSpinBonusResult(int level)
        {
            var freeSpinResult         = GenerateWinningFreeSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(freeSpinResult);
            var freeSpinSelection      = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode           = FreeSpinBonusEngine.GetFreeSpinMode(freeSpinSelection);

            freeSpinSelectionBonus.UpdateBonus(freeSpinSelection, freeSpinMode);

            var freeSpinBonus = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);

            freeSpinBonus.UpdateBonus(freeSpinResult);
            freeSpinResult.UpdateBonus(freeSpinBonus);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);

            var xElement = freeSpinBonusResult.ToXElement();

            Assert.IsNotNull(xElement);
        }
Esempio n. 21
0
        public void EngineShouldReadResponseXmlOfFreeSpinBonusResult(int gameId, int level)
        {
            var module         = GetModule(gameId);
            var spinResult     = GenerateWithBonusSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(spinResult);
            var freeSpinResult = GenerateFreeSpinResult(level);
            var freeSpinResultAdditionalSpins = FreeSpinBonusEngine.GetAdditionalFreeSpinCount(freeSpinResult, module.Configuration);

            freeSpinBonus.UpdateBonus(freeSpinResult, freeSpinResultAdditionalSpins);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var xElement            = freeSpinBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new FreeSpinBonusXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
Esempio n. 22
0
        public void EngineShouldCreateFreeSpinBonusResultFromFreeSpinResult(int level)
        {
            var config         = new Configuration();
            var requestContext = new RequestContext <BonusArgs>("", "", PlatformType.Web)
            {
                GameSetting = new Model.Entity.GameSetting {
                    GameSettingGroupId = 0
                },
                Currency = new Model.Entity.Currency {
                    Id = 0
                },
                Parameters = new BonusArgs(),
                Platform   = PlatformType.All
            };

            Assert.DoesNotThrow(() =>
            {
                var freeSpinResult = FreeSpinBonusEngine.CreateFreeSpinResult(level, requestContext, config);
                var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinResult);

                var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            });
        }
Esempio n. 23
0
        public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level)
        {
            var module         = GetModule(gameId);
            var spinResult     = GenerateWithBonusSpinResult(level);
            var freeSpinBonus  = FreeSpinBonusEngine.CreateFreeSpinBonus(spinResult);
            var freeSpinResult = GenerateFreeSpinResult(level);
            var freeSpinResultAdditionalSpins = FreeSpinBonusEngine.GetAdditionalFreeSpinCount(freeSpinResult, module.Configuration);

            freeSpinBonus.UpdateBonus(freeSpinResult, freeSpinResultAdditionalSpins);

            var freeSpinBonusResult = FreeSpinBonusEngine.CreateFreeSpinBonusResult(freeSpinBonus, freeSpinResult);
            var xElement            = freeSpinBonusResult.ToXElement();
            var responseXml         = new FreeSpinBonusXml();

            using (var xmlReader = xElement.CreateReader())
            {
                responseXml.ReadXml(xmlReader);
            }

            Assert.IsNull(responseXml.GetSchema());
            Assert.AreEqual(freeSpinBonusResult.TotalWin, responseXml.TotalWin);
            Assert.AreEqual(freeSpinBonusResult.Counter, responseXml.Counter);
            Assert.AreEqual(freeSpinBonusResult.NumberOfFreeSpin, responseXml.NumberOfFreeSpin);
        }