Пример #1
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);
                }
            });
        }
        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));
        }
        public void EngineShouldCreateFreeSpinSelectionBonusInstance(int level)
        {
            var config     = new Configuration();
            var spinResult = GenerateWithBonusSpinResult(level);

            Assert.IsNotNull(FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult));
        }
Пример #4
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);
        }
Пример #5
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);
        }
        public void EngineShouldCreateFreeSpinSelectionBonusWithValidGuid(int level)
        {
            var config                 = new Configuration();
            var spinResult             = GenerateWithBonusSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);

            Assert.IsTrue(!string.IsNullOrWhiteSpace(freeSpinSelectionBonus.Guid.ToString()));
        }
        public void EngineShouldCreateFreeSpinSelectionBonusWithTransactionId(int level)
        {
            var config                 = new Configuration();
            var spinResult             = GenerateWithBonusSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);

            Assert.IsTrue(freeSpinSelectionBonus.SpinTransactionId == spinResult.TransactionId);
        }
        public void EngineShouldCreateFreeSpinSelectionBonusWithGameResult(int level)
        {
            var config                 = new Configuration();
            var spinResult             = GenerateWithBonusSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);

            Assert.AreSame(spinResult, freeSpinSelectionBonus.GameResult);
            Assert.AreSame(spinResult, freeSpinSelectionBonus.SpinResult);
        }
        public void EngineShouldCreateFreeSpinBonus(int level)
        {
            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);

            Assert.DoesNotThrow(() => FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus));
        }
Пример #10
0
        public void EngineShouldCreateFreeSpinBonusInstance(int level)
        {
            var config                 = new Configuration();
            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);

            Assert.IsNotNull(FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus));
        }
        public void EngineShouldStartAndCompleteBonusOnCreateFreeSpinSelectionBonusResult(int level)
        {
            var config                 = new Configuration();
            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);

            Assert.IsTrue(freeSpinSelectionBonus.IsStarted);
            Assert.IsTrue(freeSpinSelectionBonus.IsCompleted);
        }
Пример #12
0
        public void EngineShouldCreateFreeSpinBonusWithTransactionId(int level)
        {
            var config                 = new Configuration();
            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);

            Assert.IsTrue(freeSpinBonus.SpinTransactionId == spinResult.TransactionId);
        }
Пример #13
0
        public void EngineShouldCreateFreeSpinBonusWithValidGuid(int level)
        {
            var config                 = new Configuration();
            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);

            Assert.IsTrue(!string.IsNullOrWhiteSpace(freeSpinBonus.Guid.ToString()));
        }
Пример #14
0
        public void EngineShouldCreateFreeSpinBonusResultWithSameGameResultAndBonus(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);

            var freeSpinSelectionBonusResult = FreeSpinBonusEngine.CreateFreeSpinSelectionBonusResult(freeSpinBonus);

            Assert.AreSame(freeSpinSelectionBonusResult.Bonus, freeSpinBonus);
        }
Пример #15
0
        public void EngineShouldIncompleteFreeSpinBonusIfWithCounter(int level)
        {
            var config                 = new Configuration();
            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);
            var initialCounter = freeSpinBonus.Counter;

            freeSpinBonus.UpdateBonus(freeSpinResult);

            Assert.IsTrue(!freeSpinBonus.IsCompleted);
        }
Пример #16
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);

            var freeSpinSelectionBonusResult = FreeSpinBonusEngine.CreateFreeSpinSelectionBonusResult(freeSpinBonus);

            Assert.IsTrue(freeSpinSelectionBonusResult.SpinTransactionId == freeSpinBonus.SpinTransactionId);
        }
Пример #17
0
        public void EngineShouldShouldDeductCounterOnFreeSpin(int level)
        {
            var config                 = new Configuration();
            var freeSpinResult         = GenerateNonWinningFreeSpinResult(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);
            var initialCounter = freeSpinBonus.Counter;

            freeSpinBonus.UpdateBonus(freeSpinResult);

            Assert.AreEqual(initialCounter - 1, freeSpinBonus.Counter);
        }
Пример #18
0
        public void SpinResultShouldHaveSameBonusDetailsOnResultUpdate(int level)
        {
            var spinResult             = GenerateWinningFreeSpinResult(level);
            var freeSpinSelectionBonus = FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult);
            var selection    = RandomNumberEngine.Next(FreeSpinMode.MinimumFreeSpinSelection, FreeSpinMode.MaximumFreeSpinSelection);
            var freeSpinMode = FreeSpinBonusEngine.GetFreeSpinMode(selection);

            freeSpinSelectionBonus.UpdateBonus(selection, freeSpinMode);
            var freeSpinBonus = FreeSpinBonusEngine.CreateFreeSpinBonus(freeSpinSelectionBonus);

            freeSpinBonus.UpdateBonus(spinResult);
            spinResult.UpdateBonus(freeSpinBonus);

            var isEqualBonusId   = spinResult.BonusElement.Id == freeSpinBonus.Id;
            var isEqualBonusGuid = spinResult.BonusElement.Value == freeSpinBonus.Guid.ToString("N");

            Assert.IsTrue(isEqualBonusId && isEqualBonusGuid);
        }
        public void FreeSpinResultShouldHaveSameCountersOnBonusElementOnResultUpdate(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 isEqualCurrentFreeSpinCounter = freeSpinResult.BonusElement.Count == freeSpinBonus.Counter;
            var isEqualFreeSpinCount          = freeSpinResult.BonusElement.NumberOfFreeSpin == freeSpinBonus.NumberOfFreeSpin;

            Assert.IsTrue(isEqualFreeSpinCount && isEqualCurrentFreeSpinCounter);
        }
Пример #20
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);

            var freeSpinSelectionBonusResult = FreeSpinBonusEngine.CreateFreeSpinSelectionBonusResult(freeSpinBonus);

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

            Assert.IsNotNull(responseXml);
        }
Пример #21
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);

            var freeSpinSelectionBonusResult = FreeSpinBonusEngine.CreateFreeSpinSelectionBonusResult(freeSpinBonus);

            var xElement = freeSpinSelectionBonusResult.ToXElement();

            Assert.IsNotNull(xElement);
        }
Пример #22
0
        public void EngineShouldCompleteFreeSpinBonusWithZeroCounter(int level)
        {
            var config                 = new Configuration();
            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);

            for (var count = 0; count < freeSpinBonus.NumberOfFreeSpin; count++)
            {
                var freeSpinResult = GenerateNonWinningNonBonusFreeSpinResult(level);
                freeSpinBonus.UpdateBonus(freeSpinResult);
            }

            Assert.IsTrue(freeSpinBonus.IsCompleted);
        }
Пример #23
0
        public void EngineShouldWriteXmlOfFreeSpinBonusResultXml(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(() =>
            {
                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);
                    }
            });
        }
        public void EngineShouldCreateFreeSpinSelectionBonus(int level)
        {
            var spinResult = GenerateSpinResult(level);

            Assert.DoesNotThrow(() => FreeSpinBonusEngine.CreateFreeSpinSelectionBonus(spinResult));
        }