Example #1
0
 public void MovingOutsideOfWindowDoesNotChangeCoords(int x, int y)
 {
     Service.X = 0;
     Service.Y = 0;
     IXnaGameLoop.Update(new GameTime());
     Service.X = x;
     Service.Y = y;
     Assert.That(Service.X, Is.EqualTo(0));
     Assert.That(Service.Y, Is.EqualTo(0));
 }
Example #2
0
        public void UpdateInvokesMoveWhenPositionChanged()
        {
            var wasMoved = false;

            Service.Move += (s, m) => wasMoved = true;
            IXnaGameLoop.Update(new GameTime());
            Service.X = 1;
            IXnaGameLoop.Update(new GameTime());
            Assert.That(wasMoved, Is.True);
        }
Example #3
0
        public void UpdateInvokesRightButtonLift()
        {
            var wasLifted = false;

            Service.ButtonLift += (s, i) => wasLifted = true;
            Services.MouseCore.RightButton.Returns(ButtonState.Pressed);
            IXnaGameLoop.Update(new GameTime());
            Services.MouseCore.RightButton.Returns(ButtonState.Released);
            IXnaGameLoop.Update(new GameTime());
            Assert.That(wasLifted, Is.True);
        }
Example #4
0
        public void UpdateInvokesMiddleButtonHold()
        {
            var wasHeld = false;

            Service.ButtonHold += (s, i) => wasHeld = true;
            Services.MouseCore.MiddleButton.Returns(ButtonState.Pressed);
            IXnaGameLoop.Update(new GameTime());
            Services.MouseCore.MiddleButton.Returns(ButtonState.Pressed);
            IXnaGameLoop.Update(new GameTime());
            Assert.That(wasHeld, Is.True);
        }
Example #5
0
 public void DrawDoesNotThrowException() => Assert.DoesNotThrow(() => IXnaGameLoop.Draw(new GameTime()));
Example #6
0
 public void DrawWithoutThrowingException()
 {
     Assert.DoesNotThrow(() => IXnaGameLoop.Draw(new GameTime()));
 }
Example #7
0
 public void UpdateWithoutThrowingException()
 {
     Assert.DoesNotThrow(() => IXnaGameLoop.Update(new GameTime()));
 }