Namespace: Breakout
Assembly: Breakout (in Breakout.exe) Version: 1.1.1.0 (1.1.1)
Tests: Breakout.Tests.BallInLevelTests
Tests: Breakout.Tests.BallInLevelTests
4 unit tests call Breakout.Ball.Position
1 unit tests call Breakout.Ball.Position
Assembly: Breakout (in Breakout.exe) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: Vector2DRemarks
Remarks
Examples
[Test, CloseAfterFirstFrame] public void FireBall() { Resolve<BallInLevel>(); var ball = Resolve<Ball>(); Assert.IsTrue(ball.IsVisible); AdvanceTimeAndUpdateEntities(0.01f); var initialBallPosition = new Vector2D(0.5f, 0.86f); Assert.AreEqual(initialBallPosition, ball.Position); if (!IsMockResolver) return; //ncrunch: no coverage Resolve<MockKeyboard>().SetKeyboardState(Key.Space, State.Pressing); AdvanceTimeAndUpdateEntities(); Assert.AreNotEqual(initialBallPosition, ball.Position); }
[Test, CloseAfterFirstFrame] public void FireBall() { if (!IsMockResolver) return; //ncrunch: no coverage var ball = Resolve<Ball>(); Assert.IsTrue(ball.IsVisible); AdvanceTimeAndUpdateEntities(0.1f); var initialBallPosition = new Vector2D(0.5f, 0.86f); Assert.AreEqual(initialBallPosition, ball.Position); Resolve<MockKeyboard>().SetKeyboardState(Key.Space, State.Pressing); AdvanceTimeAndUpdateEntities(0.1f); Assert.AreNotEqual(initialBallPosition, ball.Position); }
[Test, CloseAfterFirstFrame] public void PaddleCollision() { var ball = Resolve<TestBall>(); var paddle = Resolve<Paddle>(); AdvanceTimeAndUpdateEntities(0.01f); ball.CurrentVelocity = new Vector2D(0f, 0.1f); ball.SetPosition(paddle.Position); Assert.IsFalse(ball.IsCurrentlyOnPaddle); AdvanceTimeAndUpdateEntities(0.01f); Assert.LessOrEqual(ball.CurrentVelocity.Y, 0.1f); }
Examples
[Test, CloseAfterFirstFrame] public void FireBall() { Resolve<BallInLevel>(); var ball = Resolve<Ball>(); Assert.IsTrue(ball.IsVisible); AdvanceTimeAndUpdateEntities(0.01f); var initialBallPosition = new Vector2D(0.5f, 0.86f); Assert.AreEqual(initialBallPosition, ball.Position); if (!IsMockResolver) return; //ncrunch: no coverage Resolve<MockKeyboard>().SetKeyboardState(Key.Space, State.Pressing); AdvanceTimeAndUpdateEntities(); Assert.AreNotEqual(initialBallPosition, ball.Position); }
See Also