Example #1
0
        public void EngineShouldWriteXmlOfRevealBonusResultXml(int gameId, int level)
        {
            var module      = GetModule(gameId);
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(module.Configuration.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItem  = RandomNumberEngine.Next(Reveal.RandomWeightMinRange, Reveal.RandomWeightMaxRange);

            revealBonus.UpdateBonus(revealItems, revealItem);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);
            var xElement          = revealBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                var responseXml = new RevealBonusXml();
                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);
                    }
            });
        }
Example #2
0
        public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level)
        {
            var module      = GetModule(gameId);
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(module.Configuration.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItem  = RandomNumberEngine.Next(Reveal.RandomWeightMinRange, Reveal.RandomWeightMaxRange);

            revealBonus.UpdateBonus(revealItems, revealItem);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);
            var xElement          = revealBonusResult.ToXElement();
            var responseXml       = new RevealBonusXml();

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

            Assert.IsNull(responseXml.GetSchema());
            Assert.AreEqual(revealBonusResult.Win, responseXml.Win);
            Assert.AreEqual(revealBonusResult.Multiplier, responseXml.Multiplier);
            Assert.AreEqual(revealBonusResult.RevealItem, responseXml.RevealItem);
            Assert.AreEqual(string.Join(',', revealBonusResult.RevealItems), string.Join(',', responseXml.RevealItems));
        }
Example #3
0
        public void EngineShouldThrowExceptionOnInvalidRevealSelectionIndex(int level, int revealItem)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);

            Assert.Throws(typeof(ArgumentException), () => revealBonus.UpdateBonus(revealItems, revealItem));
        }
Example #4
0
        public void EngineShouldIncompleteRevealBonusOnUpdateWithoutSelectedIndex(int level)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);

            Assert.IsTrue(!revealBonus.IsCompleted);
        }
Example #5
0
        public void EngineShouldContinueBonusOnWinBonusResult(int level)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);

            revealBonus.UpdateBonus(revealItems, 1);

            Assert.IsTrue(revealBonus.IsCompleted);
        }
Example #6
0
        public void EngineShouldNotThrowExceptionOnValidRevealSelectionIndex(int level, int revealItem)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);

            revealBonus.UpdateBonus(revealItems, revealItem);

            Assert.DoesNotThrow(() => RevealBonusEngine.CreateRevealBonusResult(revealBonus));
        }
Example #7
0
        public void EngineShouldCreateRevealBonusResultWithSameSpinTransactionId(int level, int revealItem)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);

            revealBonus.UpdateBonus(revealItems, revealItem);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);

            Assert.IsTrue(revealBonusResult.SpinTransactionId == revealBonus.SpinTransactionId);
        }
Example #8
0
        public void EngineShouldCreateRevealBonusResultWithSameGameResultAndBonus(int level, int revealItem)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);

            revealBonus.UpdateBonus(revealItems, revealItem);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);

            Assert.AreSame(revealBonusResult.Bonus, revealBonus);
        }
Example #9
0
        public void EngineShouldCreateBonusResponseXmlOfRevealBonusResult(int gameId, int level)
        {
            var module      = GetModule(gameId);
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(module.Configuration.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItem  = RandomNumberEngine.Next(Reveal.RandomWeightMinRange, Reveal.RandomWeightMaxRange);

            revealBonus.UpdateBonus(revealItems, revealItem);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);
            var responseXml       = revealBonusResult.ToResponseXml(ResponseXmlFormat.History);

            Assert.IsNotNull(responseXml);
        }
Example #10
0
        public void EngineShouldCreateBonusResponseXmlOfRevealBonusResult(int level)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);

            revealBonus.UpdateBonus(revealItems, 0);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);

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

            Assert.IsNotNull(responseXml);
        }
Example #11
0
        public void EngineShouldCreateBonusXElementOfRevealBonusResult(int level)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);

            revealBonus.UpdateBonus(revealItems, 0);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);

            var xElement = revealBonusResult.ToXElement();

            Assert.IsNotNull(xElement);
        }
Example #12
0
        public void EngineShouldReadResponseXmlOfRevealBonusResult(int gameId, int level)
        {
            var module      = GetModule(gameId);
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(module.Configuration.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);
            var revealItem  = RandomNumberEngine.Next(Reveal.RandomWeightMinRange, Reveal.RandomWeightMaxRange);

            revealBonus.UpdateBonus(revealItems, revealItem);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);
            var xElement          = revealBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new RevealBonusXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
Example #13
0
        public void EngineShouldReadResponseXmlOfRevealBonusResult(int level)
        {
            var config      = new Configuration();
            var spinResult  = GenerateWithBonusSpinResult(level);
            var revealItems = RevealBonusEngine.CreateRevealItems(config.BonusConfig.Reveal.ItemWeights);
            var revealBonus = RevealBonusEngine.CreateRevealBonus(spinResult);

            revealBonus.UpdateBonus(revealItems, 0);

            var revealBonusResult = RevealBonusEngine.CreateRevealBonusResult(revealBonus);

            var xElement = revealBonusResult.ToXElement();

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