public void EngineShouldWriteXmlOfRevealBonusResultXml(int gameId, int level) { var config = new Configuration(); var requestContext = GetMockBonusRequestContext(0, gameId); var spinResult = GenerateWithMultiplierSpinResult(level); var bonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); var totalWin = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config); bonus.UpdateBonus(multiplier); var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin); var xElement = multiplierBonusResult.ToXElement(); Assert.DoesNotThrow(() => { var responseXml = new MultiplierBonusXml(); 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 EngineShouldCreateMultiplierBonusInstance(int level) { var config = new Configuration(); var spinResult = GenerateWithMultiplierSpinResult(level); Assert.IsNotNull(MultiplierBonusEngine.CreateMultiplierBonus(spinResult)); }
public void EngineShouldCreateMultiplierBonusWithTransactionId(int level) { var config = new Configuration(); var spinResult = GenerateWithBonusSpinResult(level); var multiplierBonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); Assert.IsTrue(multiplierBonus.SpinTransactionId == spinResult.TransactionId); }
public void EngineShouldCreateMultiplierBonusWithValidGuid(int level) { var config = new Configuration(); var spinResult = GenerateWithMultiplierSpinResult(level); var multiplierBonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); Assert.IsTrue(!string.IsNullOrWhiteSpace(multiplierBonus.Guid.ToString())); }
public void EngineShouldCreateMultiplierBonusWithGameResult(int level) { var config = new Configuration(); var spinResult = GenerateWithBonusSpinResult(level); var multiplierBonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); Assert.AreSame(spinResult, multiplierBonus.GameResult); Assert.AreSame(spinResult, multiplierBonus.SpinResult); }
public void EngineShouldCompleteMultiplierBonusWithZeroCounter(int gameId, int level) { var config = new Configuration(); var spinResult = GenerateWithMultiplierSpinResult(level); var requestContext = GetMockBonusRequestContext(0, gameId); var multiplierBonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); multiplierBonus.UpdateBonus(multiplier); Assert.IsTrue(multiplierBonus.IsCompleted); }
public void EngineShouldCreateMultiplierBonusResult(int gameId, int level) { var config = new Configuration(); var spinResult = GenerateWithMultiplierSpinResult(level); var symbol = spinResult.BonusPositions.First().Symbol; var requestContext = GetMockBonusRequestContext(0, gameId); var bonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); bonus.UpdateBonus(multiplier); var totalWin = MultiplierBonusEngine.CalculateWin(symbol, bonus.TotalBet, multiplier, config); Assert.DoesNotThrow(() => MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin)); }
public void EngineShouldCompleteMultiplierBonusResultOnBonusCompletion(int gameId, int level) { var config = new Configuration(); var requestContext = GetMockBonusRequestContext(0, gameId); var spinResult = GenerateWithMultiplierSpinResult(level); var bonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); var totalWin = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config); bonus.UpdateBonus(multiplier); var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin); Assert.IsTrue(multiplierBonusResult.IsCompleted); }
public void EngineShouldCreateBonusResponseXmlOfRevealBonusResult(int gameId, int level) { var config = new Configuration(); var requestContext = GetMockBonusRequestContext(0, gameId); var spinResult = GenerateWithMultiplierSpinResult(level); var bonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); var totalWin = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config); bonus.UpdateBonus(multiplier); var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin); var responseXml = multiplierBonusResult.ToResponseXml(ResponseXmlFormat.History); Assert.IsNotNull(responseXml); }
public void EngineShouldReadResponseXmlOfRevealBonusResult(int gameId, int level) { var config = new Configuration(); var requestContext = GetMockBonusRequestContext(0, gameId); var spinResult = GenerateWithMultiplierSpinResult(level); var bonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); var totalWin = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config); bonus.UpdateBonus(multiplier); var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin); var xElement = multiplierBonusResult.ToXElement(); Assert.DoesNotThrow(() => { using (var xmlReader = xElement.CreateReader()) { var responseXml = new MultiplierBonusXml(); responseXml.ReadXml(xmlReader); } }); }
public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level) { var config = new Configuration(); var requestContext = GetMockBonusRequestContext(0, gameId); var spinResult = GenerateWithMultiplierSpinResult(level); var bonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult); var multiplier = MultiplierBonusEngine.GetMultiplier(config); var totalWin = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config); bonus.UpdateBonus(multiplier); var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin); var xElement = multiplierBonusResult.ToXElement(); var responseXml = new MultiplierBonusXml(); using (var xmlReader = xElement.CreateReader()) { responseXml.ReadXml(xmlReader); } Assert.IsNull(responseXml.GetSchema()); Assert.AreEqual(multiplierBonusResult.Win, responseXml.Win); Assert.AreEqual(multiplierBonusResult.Multiplier, responseXml.Multiplier); }
public void EngineShouldCreateMultiplierBonus(int level) { var spinResult = GenerateWithMultiplierSpinResult(level); Assert.DoesNotThrow(() => MultiplierBonusEngine.CreateMultiplierBonus(spinResult)); }