public void ReelsBusiness_ShouldCallMethodUpdateReel_AndUpdateReel() { Reel reel = new Reel() { Name = "The Show Reel", Standard = "PAL", Definition = "SD", Clips = new List <Clip> { new Clip { ClipId = 1, Name = "Bud Light", Description = "A factory is working on the new Bud Light Platinum.", Standard = "PAL", Definition = "SD", StartTime = new Timecode(), EndTime = new Timecode { Seconds = 30, Frames = 12 } } } }; _reelData.Setup(m => m.UpdateReel(It.IsAny <Reel>())).Returns(It.IsAny <int>()); var result = _reelBusiness.UpdateReel(reel); _reelData.Verify(m => m.UpdateReel(reel), Times.Once()); Assert.IsNotNull(result); }
protected override DataRow GetGridRow(object obj) { Reel reel = (Reel)obj; //return new Infragistics.WebUI.UltraWebGrid.UltraGridRow( // new object[]{"false", // reel.ReelNo, // reel.PartNo, // reel.Qty, // reel.LotNo, // reel.DateCode, // reel.Qty - reel.UsedQty, // FormatHelper.StringToBoolean(reel.UsedFlag).ToString(), // reel.MOCode, // reel.StepSequenceCode, // FormatHelper.StringToBoolean(reel.IsSpecial).ToString(), // reel.Memo, // ""}); DataRow row = this.DtSource.NewRow(); row["ReelNo"] = reel.ReelNo; row["PartNo"] = reel.PartNo; row["Qty"] = String.Format("{0:#,#}", reel.Qty); row["LotNo"] = reel.LotNo; row["DateCode"] = reel.DateCode; row["ReelLeftQty"] = String.Format("{0:#,#}", reel.Qty - reel.UsedQty); row["UseFlag"] = FormatHelper.StringToBoolean(reel.UsedFlag).ToString(); row["MOCode"] = reel.MOCode; row["sscode"] = reel.StepSequenceCode; row["IsSpecial"] = FormatHelper.StringToBoolean(reel.IsSpecial).ToString(); row["Memo"] = reel.Memo; return(row); }
public void Spinner_Create_Lines_AdvancedTest() { const int initialRno = 3; int[] reel1 = new int[] { 4, 5, 6 }; int[] reel2 = new int[] { 7, 9 }; int[] reel3 = new int[] { 10, 11, 12, 15 }; Reel[] reels = new Reel[] { new Reel(reel1, 1), new Reel(reel2, 1), new Reel(reel3, 1) }; Spinner spinner = new Spinner(new SpinnerConfig(reels, new RnoConfig(initialRno), Defs.PayLines)); Assert.AreEqual(initialRno, spinner.Rno, "Invalid rno."); // ilośc kombinacji dla danego symbolu s1: liczba symboli walca 2 x ... x liczba symboli walca n // int[][] reelsArray = this.ReelsToArray(reels); for (int currentReel = 0; currentReel < reelsArray.Length; currentReel++) { this.AssertSymbolsCombinationExceptCurrentOne(reelsArray, spinner.Lines, currentReel); } }
public async Task <IActionResult> Edit(int id, [Bind("ReelId,Brand,Type,Line")] Reel reel) { if (id != reel.ReelId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(reel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReelExists(reel.ReelId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(reel)); }
public void ReelData_ShouldCallMethodUpdateReel_AndUpdateReel() { Reel reel = new Reel { ReelId = 10, Name = "The Best Show Reel", Standard = "NTSC", Definition = "HD", Clips = new List <Clip> { new Clip { Name = "Volkswagen \"Black Beetle\"", Description = "A computer-generated black beetle runs fast, as it is referencing the new Volkswagen model.", Standard = "NTSC", Definition = "HD", StartTime = new Timecode(), EndTime = new Timecode { Seconds = 30 } } } }; var result = _reelData.UpdateReel(reel); _dbContext.Verify(m => m.SaveChanges(), Times.Once()); Assert.IsNotNull(result); }
private void UpdateReel(Reel reel) { var index = MyReels.IndexOf(reel); MyReels.Remove(reel); MyReels.Insert(index, reel); }
void Update() { if (Input.GetKeyDown(KeyCode.Mouse0)) { // Todo: determine whether to start all based on // the current enumerator value if (AllStopped()) { StartAll(); enumerator.MoveNext(); } else { Reel reel = enumerator.Current as Reel; reel.ToggleState(); enumerator.MoveNext(); if (reel.Equals(reels[reels.Length - 1])) { enumerator.Reset(); onReelsStopped?.Invoke(SymbolsMatch()); } } } }
public void ReelsBusiness_ShouldThrowAnArgumentException_IfUpdatingAndDefinitionsAreDifferent() { Reel reel = new Reel() { Name = "The Show Reel", Standard = "PAL", Definition = "SD", Clips = new List <Clip> { new Clip { ClipId = 8, Name = "Captain America: The First Avenger", Description = "Video Promo", Standard = "PAL", Definition = "HD", StartTime = new Timecode(), EndTime = new Timecode { Seconds = 30, Frames = 12 } } } }; _reelData.Setup(m => m.UpdateReel(It.IsAny <Reel>())).Returns(It.IsAny <int>()); var result = _reelBusiness.UpdateReel(reel); _reelData.Verify(m => m.UpdateReel(reel), Times.Once()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(ArgumentException)); }
protected override object GetEditObject() { if (_facade == null) { _facade = new SMTFacadeFactory(base.DataProvider).Create(); } Reel reel = this._facade.CreateNewReel(); reel.ReelNo = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtReelNoEdit.Text, 40)); Reel reelTmp = (Reel)_facade.GetReel(reel.ReelNo); if (reelTmp != null) { reel = reelTmp; } reel.PartNo = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPartNoEdit.Text, 40)); reel.Qty = Convert.ToDecimal(this.txtQtyEdit.Text); reel.LotNo = this.txtLotNoEdit.Text.Trim().ToUpper(); reel.DateCode = this.txtDateCodeEdit.Text.Trim().ToUpper(); reel.MaintainUser = this.GetUserCode(); reel.MaintainDate = FormatHelper.TODateInt(DateTime.Today); reel.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); return(reel); }
public void ReelData_ShouldCallMethodSaveReel_AndCreateNewReel() { Reel reel = new Reel() { Name = "The Show Reel", Standard = "PAL", Definition = "SD", Clips = new List <Clip> { new Clip { ClipId = 1, Name = "Bud Light", Description = "A factory is working on the new Bud Light Platinum.", Standard = "PAL", Definition = "SD", StartTime = new Timecode(), EndTime = new Timecode { Seconds = 30, Frames = 12 } } } }; var result = _reelData.SaveReel(reel); _dbContext.Verify(m => m.SaveChanges(), Times.Once()); Assert.IsNotNull(result); }
public void ReelsBusiness_ShouldThrowAnArgumentException_IfUpdatingAndStandardsAreDifferent() { Reel reel = new Reel() { Name = "The Show Reel", Standard = "PAL", Definition = "SD", Clips = new List <Clip> { new Clip { ClipId = 6, Name = "Pepsi", Description = "People in the Middles Ages try to entertain their king (Elton John) for a Pepsi. While the first person fails, a mysterious person (Season 1 X Factor winner Melanie Amaro) " + "wins the Pepsi by singing Aretha Franklin's \"Respect\". After she wins, she overthrows the king and gives Pepsi to all the town.", Standard = "NTSC", Definition = "SD", StartTime = new Timecode(), EndTime = new Timecode { Seconds = 30, Frames = 12 } } } }; _reelData.Setup(m => m.UpdateReel(It.IsAny <Reel>())).Returns(It.IsAny <int>()); var result = _reelBusiness.UpdateReel(reel); _reelData.Verify(m => m.UpdateReel(reel), Times.Once()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(ArgumentException)); }
public void Spinner_Spin_One() { const int spinForAll = 1; int[] reel1 = new int[] { 1, 2, 3 }; int[] reel2 = new int[] { 4, 5, 6 }; int[] reel3 = new int[] { 7, 8, 9 }; Reel[] reels = new Reel[] { new Reel(reel1, spinForAll), new Reel(reel2, spinForAll), new Reel(reel3, spinForAll), }; const int initialRno = 0; // rno ustawiamy na 0 - pierwszy element Spinner spinner = new Spinner(new SpinnerConfig(reels, new RnoConfig(initialRno), Defs.PayLines)); Assert.AreEqual(initialRno, spinner.Rno); Assert.AreEqual(9, spinner.Lines.Length, "Invalid number of lines provided to the spinner."); // TODO wynik danego spina mozna jakoś stestować + wyniki drugiego spina }
void OnReelRenderUpdated(Reel reel, int reelIndex, SpriteRenderer renderer, int cursor) { cursor = cursor < 0 ? reelData.Count + cursor : cursor; var symbol = symbols[reelData[cursor % reelData.Count]]; renderer.sprite = symbol; }
private Reel GetTestObject() { Reel reel = new Reel() { Name = "The Show Reel", Standard = "PAL", Definition = "SD", Clips = new List <Clip> { new Clip { ClipId = 6, Name = "Pepsi", Description = "People in the Middles Ages try to entertain their king (Elton John) for a Pepsi. While the first person fails, a mysterious person (Season 1 X Factor winner Melanie Amaro) " + "wins the Pepsi by singing Aretha Franklin's \"Respect\". After she wins, she overthrows the king and gives Pepsi to all the town.", Standard = "NTSC", Definition = "SD", StartTime = new Timecode(), EndTime = new Timecode { Seconds = 30, Frames = 12 } } } }; return(reel); }
protected void ValidateReelObject(Reel reel) { if (reel == null) { throw new ArgumentNullException("Reel cannot be null."); } foreach (Clip clip in reel.Clips) { if (clip == null) { throw new ArgumentNullException("Clip cannot be null"); } if (reel.Standard != clip.Standard) { throw new ArgumentException("Clip standard does not match the Reel standard."); } if (reel.Definition != clip.Definition) { throw new ArgumentException("Clip definition does not match the Reel definition."); } } }
public void ConstructorCheckAbove() { Reel testReel = new Reel(rando); int symbol = testReel.getAboveSymbol(); Assert.AreEqual(symbol, 2); }
public void ConstructorCheckBelow() { Reel testReel = new Reel(rando); int symbol = testReel.getBelowSymbol(); Assert.AreEqual(symbol, 10); }
public void ConstructorCheckStartingSymbol() { Reel testReel = new Reel(rando); int symbol = testReel.getCurrentSymbol(); Assert.AreEqual(symbol, 1); }
IEnumerator stopReel(Reel reel, int position) { float delay = UnityEngine.Random.Range(1, 2.0f); yield return(new WaitForSeconds(delay)); reel.StopPosition(position); }
public void SpinCheckSymbolsAreInRange() { Reel testReel = new Reel(rando); testReel.spin(); int symbol = testReel.getCurrentSymbol(); Assert.IsTrue(1 <= symbol && symbol <= 10); }
public static void Initialize(TestContext ct) { ct.WriteLine("Class Initialize"); strip = new List <ESlotSymbol> { ESlotSymbol.Ace, ESlotSymbol.King, ESlotSymbol.Queen, ESlotSymbol.Jack, ESlotSymbol.Ten, ESlotSymbol.Nine }; reelWindow = 3; reelObj = new Reel(reelWindow, strip); }
// Helper method to check the current moving status of reels private bool CheckStatus() { for (int i = 0; i < reels.Length; i++) { currentReel = reels[i]; stopped = currentReel.HasStopped(); } return stopped; }
public async Task <IActionResult> Create([Bind("ReelId,Brand,Type,Line")] Reel reel) { if (ModelState.IsValid) { _context.Add(reel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(reel)); }
public int DeleteReelById(int id) { Reel reel = _db.Reels.Find(id); if (reel != null) { reel.Clips.Clear(); _db.Reels.Remove(reel); } return(_db.SaveChanges()); }
public void Spinner_Create_Lines() { const int initialRno = 3; int[] reel1 = new int[] { 4, 5, 6 }; int[] reel2 = new int[] { 7, 9 }; int[] reel3 = new int[] { 10, 11, 12, 15 }; Reel[] reels = new Reel[] { new Reel(reel1, 1), new Reel(reel2, 1), new Reel(reel3, 1) }; // Takich linii się spodziewamy - dokładnie w tej kolejności int[][] linesExpected = new int[][] { new int[] { 4, 7, 10 }, new int[] { 4, 7, 11 }, new int[] { 4, 7, 12 }, new int[] { 4, 7, 15 }, new int[] { 4, 9, 10 }, new int[] { 4, 9, 11 }, new int[] { 4, 9, 12 }, new int[] { 4, 9, 15 }, new int[] { 5, 7, 10 }, new int[] { 5, 7, 11 }, new int[] { 5, 7, 12 }, new int[] { 5, 7, 15 }, new int[] { 5, 9, 10 }, new int[] { 5, 9, 11 }, new int[] { 5, 9, 12 }, new int[] { 5, 9, 15 }, new int[] { 6, 7, 10 }, new int[] { 6, 7, 11 }, new int[] { 6, 7, 12 }, new int[] { 6, 7, 15 }, new int[] { 6, 9, 10 }, new int[] { 6, 9, 11 }, new int[] { 6, 9, 12 }, new int[] { 6, 9, 15 }, }; Spinner spinner = new Spinner(new SpinnerConfig(reels, new RnoConfig(initialRno), Defs.PayLines)); Assert.AreEqual(initialRno, spinner.Rno, "Invalid rno."); for (int i = 0; i < linesExpected.Length; i++) { CollectionAssert.AreEqual(linesExpected[i], spinner.Lines[i], $"Invalid line {i}"); } }
public int SaveReel(Reel reel) { _db.Reels.Add(reel); if (reel.Clips != null) { foreach (Clip clip in reel.Clips) { _db.Clips.Attach(clip); } } return(_db.SaveChanges()); }
private void SyncReels(Reel[] target) { if (target.Length == 0) { return; } lock (Reels) { // Remove existing reels that are not in the target for (int i = 0; i < Reels.Count; i++) { var existingReel = Reels[i]; if (target.All(x => x.Id != existingReel.Id)) { Reels.RemoveAt(i); i--; } } // Add new reels from target and also update existing ones for (int i = 0; i < target.Length; i++) { var reel = target[i]; Reel equivalent = null; var equivalentIndex = -1; for (int j = 0; j < Reels.Count; j++) { if (Reels[j].Id == reel.Id) { equivalent = Reels[j]; equivalentIndex = j; break; } } if (equivalent != null) { PropertyCopier <Reel, Reel> .Copy(reel, equivalent); if (i == equivalentIndex) { continue; } Reels.RemoveAt(equivalentIndex); Reels.Insert(i > Reels.Count ? Reels.Count : i, new ReelWrapper(equivalent)); } else { Reels.Insert(i > Reels.Count ? Reels.Count : i, new ReelWrapper(reel)); } } } }
// Initialize Reels components void Awake() { reel1 = reels[0]; reel2 = reels[1]; reel3 = reels[2]; // Add Stop handlers to the event of each reel reel1.OnFullStop += CompleteStopHandler; reel2.OnFullStop += CompleteStopHandler; reel3.OnFullStop += CompleteStopHandler; stopped = true; }
// Helper method to check the current moving status of reels private bool CheckStatus() { for (int i = 0; i < reels.Length; i++) { currentReel = reels[i]; if (currentReel.isSpinning) { return(false); } } return(true); }
internal void HideorShowReelDetails(Reel reel) { if (!reel.IsVisible) { reel.IsVisible = true; } else { reel.IsVisible = false; } UpdateReel(reel); }
//end PlayGame protected bool CheckWinState(Reel[] reelArray) { bool reelsMatch = true; for (int i = 1; i < reelArray.Length && reelsMatch; i++) { if (reelArray[0].Face != reelArray[i].Face) reelsMatch = false; } if (!reelsMatch) Console.WriteLine("You Lose."); else Console.WriteLine("You Win!"); return reelsMatch; }
public override void PlayGame() { Console.WriteLine("Welcome to Slot Machine."); Console.WriteLine("Enter a Reel count for the slot machine."); bool playerWon = true; bool playerDone = false; Reel[] reelArray = new Reel[Input.GetUserNum()]; int betMultiplier = reelArray.Length * ((int)reelArray.Length / 2); if (betMultiplier < 2) betMultiplier = 1; for (int i = 0; i < reelArray.Length; i++) reelArray[i] = new Reel(); do { Console.WriteLine(reelArray.Length + " reels will roll. If their faces match, you win " + betMultiplier + " times your bet value."); MakeBet(); foreach (Reel reel in reelArray) reel.SpinReel(); foreach (Reel reel in reelArray) Console.Write(reel.Face); Console.WriteLine(); playerWon = CheckWinState(reelArray); ApplyBet(playerWon, betMultiplier); Console.WriteLine("Return to Main Menu? y/n"); char userConfirm = Input.GetUserAny(); if (userConfirm == 'y') playerDone = true; } while (!playerDone); }