public void EngineShouldWriteXmlOfInstantWinResultXml(int gameId, int level) { var module = GetModule(gameId); var spinResult = GenerateWithBonusSpinResult(level); var instantWinBonus = InstantWinBonusEngine.CreateInstantWinBonus(spinResult); var instantWinMultiplier = InstantWinBonusEngine.GetInstantWinMultiplier(module.Configuration.BonusConfig.InstantWin.MultiplierWeights[level]); instantWinBonus.UpdateBonus(instantWinMultiplier); var instantWinBonusResult = InstantWinBonusEngine.CreateInstantWinBonusResult(instantWinBonus); var xElement = instantWinBonusResult.ToXElement(); Assert.DoesNotThrow(() => { var responseXml = new InstantWinXml(); 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 EngineShouldReadResponseXmlOfInstantWinResult(int gameId, int level) { var module = GetModule(gameId); var spinResult = GenerateWithBonusSpinResult(level); var instantWinBonus = InstantWinBonusEngine.CreateInstantWinBonus(spinResult); var instantWinMultiplier = InstantWinBonusEngine.GetInstantWinMultiplier(module.Configuration.BonusConfig.InstantWin.MultiplierWeights[level]); instantWinBonus.UpdateBonus(instantWinMultiplier); var instantWinBonusResult = InstantWinBonusEngine.CreateInstantWinBonusResult(instantWinBonus); var xElement = instantWinBonusResult.ToXElement(); Assert.DoesNotThrow(() => { using (var xmlReader = xElement.CreateReader()) { var responseXml = new InstantWinXml(); responseXml.ReadXml(xmlReader); } }); }
public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level) { var module = GetModule(gameId); var spinResult = GenerateWithBonusSpinResult(level); var instantWinBonus = InstantWinBonusEngine.CreateInstantWinBonus(spinResult); var instantWinMultiplier = InstantWinBonusEngine.GetInstantWinMultiplier(module.Configuration.BonusConfig.InstantWin.MultiplierWeights[level]); instantWinBonus.UpdateBonus(instantWinMultiplier); var instantWinBonusResult = InstantWinBonusEngine.CreateInstantWinBonusResult(instantWinBonus); var xElement = instantWinBonusResult.ToXElement(); var responseXml = new InstantWinXml(); using (var xmlReader = xElement.CreateReader()) { responseXml.ReadXml(xmlReader); } Assert.IsNull(responseXml.GetSchema()); Assert.AreEqual(instantWinBonusResult.Win, responseXml.Win); }