public void TestSpin() { // Arrange var user = new UserGameKey(-1, 3); var requestContext = new RequestContext <SpinArgs>("simulation", "Bikini Beach", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; // Action var spin = module.ExecuteSpin(1, new UserGameSpinData(), requestContext); var result = spin.Value as BikiniBeachResult; // Assert Assert.AreEqual(1, result.Level); Assert.AreNotEqual(result.Wheel, default(BikiniBeachWheel)); Assert.IsTrue(result.Bet == 30); if (result.HasBonus) { switch (result.Bonus.ClientId) { case 2: Assert.AreEqual(4, result.Bonus.Count); break; case 3: Assert.AreEqual(1, result.Bonus.Count); break; case 4: Assert.AreEqual(3, result.Bonus.Count); break; } } }
public void TestSpin() { // Arrange var user = new UserGameKey(-1, 104); var requestContext = new RequestContext <SpinArgs>("simulation", "Dragon Riches", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; // Action var spin = module.ExecuteSpin(1, new UserGameSpinData(), requestContext); var result = spin.Value as Games.DragonRiches.DragonRichesResult; // Assert Assert.AreEqual(1, result.Level); Assert.AreNotEqual(result.Wheel, default(Games.DragonRiches.DragonRichesWheel)); Assert.IsTrue(result.Bet == 30); if (result.HasBonus) { if (result.Bonus.ClientId == 3) { Assert.AreEqual(6, result.Bonus.Count); } else { Assert.AreEqual(3, result.Bonus.ClientId); } } }
public void TestSpin() { // Arrange var user = new UserGameKey(-1, 51); var requestContext = new RequestContext <SpinArgs>("simulation", "Qixi", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; // Action var result = module.ExecuteSpin(1, new UserGameSpinData(), requestContext).Value as QixiSpinResult; var responseXml = xmlhelper.Serialize(result.ToResponseXml(ResponseXmlFormat.None)); var element = XElement.Parse(responseXml, LoadOptions.PreserveWhitespace); var xelement = result.ToXElement(); // Assert Assert.IsTrue(result.ToString() != null); Assert.IsTrue(result.XmlType == XmlType.SpinXml); Assert.IsTrue(result.GameResultType == GameResultType.SpinResult); Assert.IsNotNull(element); Assert.IsNotNull(xelement); Assert.IsTrue(element.Element("wheels") != null); Assert.IsTrue(element.Element("wheels").Attribute("val") != null); Assert.IsTrue(element.Element("wheels").Attribute("val").Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray().Length == 15); Assert.IsTrue(element.Element("win") != null); Assert.AreEqual(result.Win, decimal.Parse(element.Element("win").Value)); Assert.IsTrue(element.Element("winposition") != null); Assert.AreEqual(null, element.Element("bonus")); Assert.AreEqual(null, element.Element("bonusposition")); }
public void TestSpin() { // Arrange var user = new UserGameKey(-1, 32); var requestContext = new RequestContext <SpinArgs>("simulation", "FortuneKoi", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; // Action var spin = module.ExecuteSpin(1, new UserGameSpinData(), requestContext); var result = spin.Value as FortuneKoiSpinResult; // Assert Assert.AreEqual(1, result.Level); Assert.AreNotEqual(result.Wheel, default(FortuneKoiWheel)); Assert.IsTrue(result.Bet == 10); Assert.AreEqual(result.GameResultType, GameResultType.SpinResult); if (result.HasBonus) { Assert.NotNull(result.Bonus); Assert.AreEqual(1, result.Bonus.Count); } }
public void TestSpin() { // Arrange var user = new UserGameKey(-1, 14); var requestContext = new RequestContext <SpinArgs>("simulation", "God of Fortune", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; var userSession = new UserSession { SessionKey = "unittest" }; var spinArgs = new SpinArgs { LineBet = 1, Multiplier = 1 }; requestContext.Parameters = spinArgs; requestContext.UserSession = userSession; // Action var spin = module.ExecuteSpin(1, new UserGameSpinData(), requestContext); var result = spin.Value as Games.FortunePack.FortunePackResult; // Assert Assert.AreEqual(1, result.Level); Assert.AreNotEqual(result.Wheel, default(Wheel)); Assert.IsTrue(result.Bet == 8); }
public void Spin(int level, int numusers, int numItrPerUser, decimal spinBet) { var sdt = DateTime.Now; var spinArgs = new SpinArgs { LineBet = spinBet, Multiplier = 1 }; var users = Utilities.GenerateUsers(GameId, numusers, level); var summData = users.AsParallel().Select(user => { var data = new SummaryData(); var request = user.CreateRequestContext <SpinArgs>("wuxiatprincess"); request.Parameters = spinArgs; foreach (var iter in new byte[numItrPerUser]) { data.SpinCounter++; data.TotalBet += 25 * spinBet; var executeResult = module.ExecuteSpin(level, new UserGameSpinData(), request); var result = executeResult.Value as WuxiaPrincessResult; data.TotalWin += result.Win; if (result.HasBonus) { var bonusRequest = user.CreateRequestContext <BonusArgs>("wuxiatprincess"); var freeSpinResult = ExecuteFreeSpin(level, bonusRequest, result); data += freeSpinResult; data.MgFHit++; } } return(data); }).AsEnumerable() .Aggregate((s1, s2) => s1 + s2); var edt = DateTime.Now; var oldOut = Console.Out; var fileStream = new FileStream($@"..\..\..\Results\WuxiaPrincess\{TestContext.CurrentContext.Test.Name}.txt", FileMode.OpenOrCreate, FileAccess.Write); var writer = new StreamWriter(fileStream); Console.SetOut(writer); Console.WriteLine(String.Format("Test.Level : {0}", level)); Console.WriteLine(String.Format("Test.TimeStart : {0} {1}", sdt.ToShortDateString(), sdt.ToLongTimeString())); Console.WriteLine(String.Format("Test.TimeEnd : {0} {1}", edt.ToShortDateString(), edt.ToLongTimeString())); Console.WriteLine(String.Format("Test.SpinMode : {0}", "Random")); Console.WriteLine("----------------------------------------"); Console.WriteLine(String.Format("SpinCount : {0}", summData.SpinCounter)); Console.WriteLine(String.Format("TotalBet : {0,12:0.00}", summData.TotalBet)); Console.WriteLine(String.Format("Game Win : {0,12:0.00}", summData.TotalWin)); Console.WriteLine(String.Format("Free Spin Win : {0,12:0.00}", summData.FSTotalWin)); Console.WriteLine(String.Format("Free SpinCount : {0,12:0.00}", summData.FSpinCounter)); Console.WriteLine(String.Format("MG Feature Hit Rate : {0,12:0.00}", summData.MgFHitRate)); Console.WriteLine(String.Format("FG Feature Hit Rate : {0,12:0.00}", summData.FgFHitRate)); Console.WriteLine("----------------------------------------"); if (summData.TotalBet > 0) { Console.WriteLine(String.Format("Main Game RTP : {0,11:0.00}%", 100 * summData.TotalWin / summData.TotalBet)); Console.WriteLine(String.Format("Free Spin RTP : {0,11:0.00}%", 100 * summData.FSTotalWin / summData.TotalBet)); } Console.WriteLine("--- RTP.OverAll ------------------------"); Console.WriteLine(String.Format("RTP.Total (Over All) : {0,11:0.00}%", 100 * summData.RTPOverAll)); Console.SetOut(oldOut); writer.Close(); fileStream.Close(); Console.WriteLine("Done"); }
public void Spin(int level, int numusers, int numItrPerUser, decimal spinBet) { var sdt = DateTime.Now; var spinArgs = new SpinArgs { LineBet = spinBet, Multiplier = 1 }; var users = Utilities.GenerateUsers(GameId, numusers, level); var summData = users .AsParallel() .Select(user => { var data = new SummaryData(); var request = user.CreateRequestContext <SpinArgs>("monkeysmash"); request.Parameters = spinArgs; foreach (var iter in new byte[numItrPerUser]) { data.SpinCounter++; data.TotalBet += spinBet * 25; var executeResult = module.ExecuteSpin(level, new UserGameSpinData(), request); var result = executeResult.Value as ReelGemResult; data.TotalWin += result.Win; if (result.HasBonus) { var bonusRequest = user.CreateRequestContext <BonusArgs>("monkeysmash"); var freeSpinResult = ExecuteFreeSpin(level, bonusRequest, result); data.FSTotalWin += freeSpinResult.TotalWin; } else { var priorSpinResult = result.Copy(); for (int pr = 0; pr < 5; pr++) { var buyReelResult = BuyReel(level, pr, priorSpinResult); data.BuyReel += buyReelResult; } } } return(data); }) .AsEnumerable() .Aggregate((s1, s2) => s1 + s2); var edt = DateTime.Now; var oldOut = Console.Out; var fileStream = new FileStream($@"..\..\..\Results\MonkeySmash\{TestContext.CurrentContext.Test.Name}.txt", FileMode.OpenOrCreate, FileAccess.Write); var writer = new StreamWriter(fileStream); Console.SetOut(writer); Console.WriteLine(String.Format("Test.Level : {0}", level)); Console.WriteLine(String.Format("Test.TimeStart : {0} {1}", sdt.ToShortDateString(), sdt.ToLongTimeString())); Console.WriteLine(String.Format("Test.TimeEnd : {0} {1}", edt.ToShortDateString(), edt.ToLongTimeString())); Console.WriteLine(String.Format("Test.SpinMode : {0}", "Random")); Console.WriteLine("---NORMAL -------------------------------"); Console.WriteLine(String.Format("Test.SpinCount : {0}", summData.SpinCounter)); Console.WriteLine(String.Format("TotalBet : {0,12:0.00}", summData.TotalBet)); Console.WriteLine(String.Format("Game Win : {0,12:0.00}", summData.TotalWin)); Console.WriteLine(String.Format("Free Spin Win : {0,12:0.00}", summData.FSTotalWin)); if (summData.TotalBet > 0) { Console.WriteLine(String.Format("Main Game RTP : {0,12:0.00}", 100 * summData.TotalWin / summData.TotalBet)); Console.WriteLine(String.Format("Free Spin RTP : {0,12:0.00}", 100 * summData.FSTotalWin / summData.TotalBet)); Console.WriteLine(String.Format("Total RTP : {0,12:0.00}", 100 * (summData.TotalWin + summData.FSTotalWin) / summData.TotalBet)); } var buyReelSum = summData.BuyReel; Console.WriteLine("--- BUY REEL----------------------------"); Console.WriteLine(String.Format("Test.SpinCount : {0}", buyReelSum.SpinCounter)); Console.WriteLine(String.Format("TotalBet : {0,12:0.00}", buyReelSum.TotalBet)); Console.WriteLine(String.Format("Game Win : {0,12:0.00}", buyReelSum.TotalWin)); Console.WriteLine(String.Format("Free Spin Win : {0,12:0.00}", buyReelSum.FSTotalWin)); if (summData.BuyReel.TotalBet > 0) { Console.WriteLine(String.Format("Main Game RTP : {0,12:0.00}", 100 * buyReelSum.TotalWin / buyReelSum.TotalBet)); Console.WriteLine(String.Format("Free Spin RTP : {0,12:0.00}", 100 * buyReelSum.FSTotalWin / buyReelSum.TotalBet)); Console.WriteLine(String.Format("Total RTP : {0,12:0.00}", 100 * (buyReelSum.TotalWin + buyReelSum.FSTotalWin) / buyReelSum.TotalBet)); } Console.WriteLine("--- RTP.OverAll -------------------------"); Console.WriteLine(String.Format("RTP.Total (Over All) : {0,12:0.00}", 100 * summData.RTPOverAll)); Console.SetOut(oldOut); writer.Close(); fileStream.Close(); Console.WriteLine("Done"); }