Пример #1
0
        public void EngineShouldCopySpinValuesFromSpinToXml(int level)
        {
            var spinResult  = GenerateWinningSpinResult(level);
            var xElement    = spinResult.ToXElement();
            var responseXml = new SpinXml();

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

            Assert.IsNull(responseXml.GetSchema());

            Assert.AreEqual(spinResult.BonusElement.Id, responseXml.BonusElement.Id);
            Assert.AreEqual(spinResult.BonusElement.FreeSpinAwardCount, responseXml.BonusElement.FreeSpinAwardCount);
            Assert.AreEqual(spinResult.BonusElement.AdditionalFreeSpinCount, responseXml.BonusElement.AdditionalFreeSpinCount);
            Assert.AreEqual(spinResult.BonusElement.Count, responseXml.BonusElement.Count);
            Assert.AreEqual(spinResult.BonusElement.NumberOfFreeSpin, responseXml.BonusElement.NumberOfFreeSpin);
            Assert.AreEqual(spinResult.BonusElement.Selection, responseXml.BonusElement.Selection);
            Assert.AreEqual(spinResult.SpinBet.UserGameKey.GameId, responseXml.GameIdXml);
            Assert.AreEqual(spinResult.Type, responseXml.Type);
            Assert.AreEqual(spinResult.Bet, responseXml.Bet);
            Assert.AreEqual(spinResult.Win, responseXml.WinElement.Value);
            Assert.AreEqual(spinResult.XmlType, responseXml.XmlType);
            Assert.AreEqual(spinResult.Multiplier, responseXml.Multiplier);
            Assert.AreEqual(spinResult.TransactionId, responseXml.TransactionId);
        }
Пример #2
0
        public void EngineShouldReadResponseXmlOfSpinResult(int level)
        {
            var spinResult = GenerateWinningSpinResult(level);
            var xElement   = spinResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new SpinXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
Пример #3
0
        public void EngineShouldCopyWheelReelsFromSpinToXml(int level)
        {
            var spinResult  = GenerateWinningSpinResult(level);
            var xElement    = spinResult.ToXElement();
            var responseXml = new SpinXml();

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

            var expectedReels = string.Join(',', spinResult.Wheel.Reels.SelectMany(reel => reel));
            var actualReels   = string.Join(',', responseXml.Wheel.Reels.SelectMany(reel => reel));

            Assert.AreEqual(expectedReels, actualReels);
        }
Пример #4
0
        public void EngineShouldCopyBonusPositionsFromSpinToXml(int level)
        {
            var spinResult  = GenerateWithBonusSpinResult(level);
            var xElement    = spinResult.ToXElement();
            var responseXml = new SpinXml();

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

            for (var bonusPositionIndex = 0; bonusPositionIndex < spinResult.BonusPositions.Count; bonusPositionIndex++)
            {
                var expectedObject = spinResult.BonusPositions[bonusPositionIndex];
                var actualObject   = responseXml.BonusPositions[bonusPositionIndex];

                Assert.AreEqual(expectedObject.Symbol, actualObject.Symbol);
                Assert.AreEqual(expectedObject.Count, actualObject.Count);
                Assert.AreEqual(string.Join(',', expectedObject.RowPositions), string.Join(',', actualObject.RowPositions));
            }
        }
Пример #5
0
        public void EngineShouldCopyWinPositionsFromSpinToXml(int level)
        {
            var spinResult  = GenerateWinningSpinResult(level);
            var xElement    = spinResult.ToXElement();
            var responseXml = new SpinXml();

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

            for (var winPositionIndex = 0; winPositionIndex < spinResult.WinPositions.Count; winPositionIndex++)
            {
                var expectedObject = spinResult.WinPositions[winPositionIndex];
                var actualObject   = responseXml.WinPositions[winPositionIndex];

                Assert.AreEqual(expectedObject.Line, actualObject.Line);
                Assert.AreEqual(expectedObject.Multiplier, actualObject.Multiplier);
                Assert.AreEqual(expectedObject.Symbol, actualObject.Symbol);
                Assert.AreEqual(expectedObject.Win, actualObject.Win);
                Assert.AreEqual(string.Join(',', expectedObject.RowPositions), string.Join(',', actualObject.RowPositions));
            }
        }
Пример #6
0
        public void EngineShouldWriteXmlOfSpinResultXml(int level)
        {
            var spinResult = GenerateWinningSpinResult(level);
            var xElement   = spinResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                var responseXml = new SpinXml();
                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("spin");
                        responseXml.WriteXml(xmlWriter);
                    }
            });
        }