public void UpdateTest() { // GameItem-Liste initialisieren GameItem.GameItemList = new System.Collections.Generic.LinkedList <IGameItem>(); // Neuen Spieler erzeugen (Accessor, das private Felder manipuliert werden müssen) Player_Accessor target = CreatePlayer_Accessor(); // Unverwundbarkeits-Timer setzen target.invincibleTime = 0.5f; // PowerUp hinzufügen Speedboost speedboost = new Speedboost(Vector2.Zero, Vector2.Zero); target.AddPowerUp(new ActivePowerUp(0.5f, PowerUpEnum.Speedboost, speedboost.Apply, speedboost.Remove)); // GameTime so anlegen, dass nach Update keine Unverwundbarkeit mehr aktiv sein sollte und das PowerUp ausgelaufen ist GameTime gameTime = new GameTime(new TimeSpan(0, 42, 42), new TimeSpan(0, 0, 1)); target.Update(gameTime); Assert.AreEqual(target.IsInvincible, false); Assert.AreEqual(target.ActivePowerUps.Count, 0); // GameItem-Liste zurücksetzen GameItem.GameItemList = null; }
public void AllMovesTest() { Player_Accessor target = new Player_Accessor(); // TODO: Initialize to an appropriate value List <Move> moves = target.AllMoves(_TestBoard, "j"); Move m = moves[0]; }
public void GetAdjacentPositionsTest() { Player_Accessor target = new Player_Accessor(); // TODO: Initialize to an appropriate value int[,] piece = target._Pieces['j']; List <Point> points = target.GetAdjacentPositions(piece, new Point(5, 5)); PrintPoints(points); }
public void BoardFromStringTest() { Player_Accessor target = new Player_Accessor(); // TODO: Initialize to an appropriate value string board = ".......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... zzzzzzzz.."; int[,] actual; actual = target.BoardFromString(board); target.BoardArrayDebug(actual); }
public void GetFallPositionTest() { Player_Accessor target = new Player_Accessor(); int[,] piece = target._Pieces['s']; piece = target.RotatePiece(piece, 1); int actual; actual = target.GetFallPosition(_TestBoard, piece, 0); Assert.AreEqual(4, actual); }
public void IsCollidedWithTest() { GameItem.GameItemList = new System.Collections.Generic.LinkedList <IGameItem>(); // Neuen Spieler erzeugen (Accessor, das private Felder manipuliert werden müssen) Player_Accessor target = CreatePlayer_Accessor(); // Anfängliche Unverwundbarkeit ausschalten target.invincibleTime = 0.0f; // Als Kollisionspartner ein Alien erstellen IGameItem collisionPartner = new Alien(Vector2.Zero, GameItemConstants.AlienVelocity, GameItemConstants.AlienHitpoints, GameItemConstants.AlienDamage, GameItemConstants.AlienWeapon, GameItemConstants.AlienScoreGain); // TODO: Passenden Wert initialisieren target.IsCollidedWith(collisionPartner); Assert.AreEqual(target.Lives, GameItemConstants.PlayerLives - 1); Assert.AreEqual(target.IsInvincible, true); // GameItem-Liste zurücksetzen GameItem.GameItemList = null; }
public void playTickerTimeoutTest() { Player_Accessor target = new Player_Accessor(); int expected = 0; int actual; target.playTickerTimeout = expected; actual = target.playTickerTimeout; Assert.AreEqual(expected, actual); }
public void playTickerThreadTest() { Player_Accessor target = new Player_Accessor(); string vidPath = sampleVideos[2]; IVideo video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); Thread expected = target.playTickerThread; Thread actual; target.playTickerThread = expected; actual = target.playTickerThread; Assert.AreEqual(expected, actual); Assert.IsNotNull(actual); }
public void GetFallPositionTest() { Player_Accessor target = new Player_Accessor(); int[,] piece = target._Pieces['s']; piece = target.RotatePiece(piece, 1); int actual; actual = target.GetFallPosition(_TestBoard, piece, 0); Assert.AreEqual(4, actual); }
public void setVideoTest1() { Player_Accessor target = new Player_Accessor(); string vidPath = sampleVideos[2]; IVideo video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); int position = 0; target.setVideo(video, position); Assert.AreEqual(video, target.video); }
public void positionSlider_DragStartedTest() { Player_Accessor target = new Player_Accessor(); object sender = null; DragStartedEventArgs e = null; target.positionSlider_DragStarted(sender, e); if (target.pauseButton.IsVisible) { Pause_ClickTest(); } }
public void nextFrame_ClickTest() { Player_Accessor target = new Player_Accessor(); object sender = null; RoutedEventArgs e = null; target.nextFrame_Click(sender, e); Assert.IsTrue(target.pausePlayTicker.Reset()); }
public void jumpToFrame_ClickTest() { Player_Accessor target = new Player_Accessor(); object sender = null; RoutedEventArgs e = null; string vidPath = sampleVideos[2]; IVideo video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); int position = 0; target.setVideo(video, position); target.jumpToFrame_Click(sender, e); OnPropertyChangedTest_randomJumpPositionUpdate(); }
public void jumpToFrameTextBox_GotFocusTest() { Player_Accessor target = new Player_Accessor(); object sender = null; RoutedEventArgs e = null; target.jumpToFrameTextBox_GotFocus(sender, e); if (target.pauseButton.IsVisible) { Pause_ClickTest(); } }
public void getFrameTest() { Player_Accessor target = new Player_Accessor(); string vidPath = sampleVideos[2]; IVideo video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); int position = 0; target.setVideo(video, position); target.getFrame(position); }
public void fpsIndicatorValueTest() { Player_Accessor target = new Player_Accessor(); int expected = 0; int actual; target.fpsIndicatorValue = expected; actual = target.fpsIndicatorValue; Assert.AreEqual(expected, actual); }
public void flushTest() { Player_Accessor target = new Player_Accessor(); target.flush(); Assert.IsTrue(target.pausePlayTicker.Reset()); Assert.IsFalse(target.stopPlayTickerThread); //Assert.IsNull(target.playTickerThread); }
public void AllMovesTest() { Player_Accessor target = new Player_Accessor(); // TODO: Initialize to an appropriate value List<Move> moves = target.AllMoves(_TestBoard, "j"); Move m = moves[0]; }
public void Play_ClickTest() { Player_Accessor target = new Player_Accessor(); object sender = new Button(); RoutedEventArgs e = null; target._pausePlayTicker = null; Assert.AreEqual(null, target._pausePlayTicker); target.Play_Click(sender, e); Assert.IsTrue(target._pausePlayTicker is ManualResetEvent); }
public void positionSlider_DragDeltaTest() { Player_Accessor target = new Player_Accessor(); DragDeltaEventArgs e = new DragDeltaEventArgs(2, 0); target.positionSlider_DragDelta(null, e); OnPropertyChangedTest_posReadProName(); }
public void OnPropertyChangedTest_fpsIndProName() { Player_Accessor target = new Player_Accessor(); string expected = "fpsIndicatorValue"; object sender = new YuvVideoHandler(); PropertyChangedEventArgs e = new PropertyChangedEventArgs(target.fpsIndProName); target.OnPropertyChanged(sender, e); Assert.AreEqual(expected, e.PropertyName, "Property name is wrong. "); }
public void setVideoTest() { Player_Accessor target = new Player_Accessor(); string vidPath = sampleVideos[2]; object video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); target.setVideo(video); Assert.AreEqual(video, target.video); }
public void OnPropertyChangedTest_nextFramePositionUpdate() { Player_Accessor target = new Player_Accessor(); string expected = "nfpu"; PropertyChangedEventArgs e = new PropertyChangedEventArgs(target.nextFramePositionUpdate); target.OnPropertyChanged(this, e); Assert.AreEqual(expected, e.PropertyName, "Property name is wrong. "); Assert.IsTrue(target.pausePlayTicker.Reset()); }
public void speedUpButton_ClickTest() { Player_Accessor target = new Player_Accessor(); object sender = null; RoutedEventArgs e = null; int playTicker = target.playTickerTimeout; target.speedUpButton_Click(sender, e); Assert.AreEqual(playTicker - 10, target.playTickerTimeout); }
public void OnPropertyChangedTest_randomJumpPositionUpdate() { Thread.Sleep(5000); Player_Accessor target = new Player_Accessor(); string expected = "rjpu"; string vidPath = sampleVideos[2]; object video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); target.setVideo(video); PropertyChangedEventArgs e = new PropertyChangedEventArgs(target.randomJumpPositionUpdate); target.OnPropertyChanged(this, e); int jumpTo; Int32.TryParse(target.jumpToFrameTextBox.Text, out jumpTo); Assert.AreEqual(expected, e.PropertyName, "Property name is wrong. "); Assert.AreEqual(jumpTo, target.video.handler.positionReader); }
public void BoardFromStringTest() { Player_Accessor target = new Player_Accessor(); // TODO: Initialize to an appropriate value string board = ".......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... zzzzzzzz.."; int[,] actual; actual = target.BoardFromString(board); target.BoardArrayDebug(actual); }
public void pausePlayTickerTest() { Player_Accessor target = new Player_Accessor(); ManualResetEvent actual; target._pausePlayTicker = null; actual = target.pausePlayTicker; Assert.IsTrue(actual is ManualResetEvent); }
public void OnPropertyChangedTest_posReadProName() { string vidPath = sampleVideos[2]; object video = new Video(false, vidPath, new YuvVideoInfo(vidPath), null); Player_Accessor target = new Player_Accessor(); target.setVideo(video); string expected = "positionReader"; PropertyChangedEventArgs e = new PropertyChangedEventArgs(target.posReadProName); target.OnPropertyChanged(this, e); Assert.AreEqual(expected, e.PropertyName, "Property name is wrong. "); Assert.AreEqual(target._positionReader, target.video.handler.positionReader); }
public void GetAdjacentPositionsTest() { Player_Accessor target = new Player_Accessor(); // TODO: Initialize to an appropriate value int[,] piece = target._Pieces['j']; List<Point> points = target.GetAdjacentPositions(piece, new Point(5, 5)); PrintPoints(points); }