Example #1
0
        public void CrosshairWorldPositionUsesCameraToTransform()
        {
            var stubCamera = MockRepository.GenerateStub<ICamera>();
            Crosshair crosshair = new Crosshair(stubCamera);
            stubCamera.Stub(x => x.ConvertToWorldCoordinates(Arg<Vector2>.Is.Anything)).Return(new Vector2(100, 200));

            Assert.AreEqual(new Vector2(100, 200), crosshair.WorldPosition);
        }
Example #2
0
        public void CrosshairHasSize()
        {
            Crosshair crosshair = new Crosshair(null);

            crosshair.Size = 10;

            Assert.AreEqual(10, crosshair.Size);
        }
Example #3
0
        public void CrosshairViewPositionMatchesMousePosition()
        {
            Crosshair crosshair = new Crosshair(null);

            // TODO: Wrap Mouse so that this test can be made robust even when mouse is moving...
            Vector2 mousePosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
            Assert.AreEqual(mousePosition, crosshair.ViewPosition);
        }