public void UpdateCamera_NoPressedKeys_ExpectNoMovementOrRotation()
        {
            //Arrange
            var cameraViewModel = new FakeCameraViewModel();

            var testSubject = new KeyboardCameraControlViewModel(cameraViewModel);

            //Act
            testSubject.UpdateCamera();

            //Assert
            Assert.That(cameraViewModel.LookAtPoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MovePoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MoveVector, Is.EqualTo(new Vector3D()));
            Assert.That(cameraViewModel.RotationX, Is.EqualTo(0));
            Assert.That(cameraViewModel.RotationY, Is.EqualTo(0));
            Assert.That(cameraViewModel.RotationZ, Is.EqualTo(0));
        }
        public void UpdateCamera_RotationKeyPressedAndSpecialKeyPressed_ExpectNoMovementAndRotation(Key pressedKey)
        {
            //Arrange
            var cameraViewModel = new FakeCameraViewModel();

            var testSubject = new KeyboardCameraControlViewModel(cameraViewModel);

            testSubject.ReactToKeyboardKeyDown(pressedKey);
            testSubject.ReactToKeyboardKeyDown(Key.LeftShift);

            //Act
            testSubject.UpdateCamera();

            //Assert
            Assert.That(cameraViewModel.LookAtPoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MovePoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MoveVector, Is.EqualTo(new Vector3D()));
            Assert.That(cameraViewModel.Rotation, Is.Not.EqualTo(0));
        }
예제 #3
0
        public void UpdateCamera_MouseWheelMoved_ExpectMovementAndNoRotation()
        {
            //Arrange
            var cameraViewModel = new FakeCameraViewModel();

            var testSubject = new MouseCameraControlViewModel(cameraViewModel);

            testSubject.ReactToMouseWheelMovement(100);

            //Act
            testSubject.UpdateCamera();

            //Assert
            Assert.That(cameraViewModel.LookAtPoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MovePoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MoveVector, Is.Not.EqualTo(new Vector3D()));
            Assert.That(cameraViewModel.RotationX, Is.EqualTo(0));
            Assert.That(cameraViewModel.RotationY, Is.EqualTo(0));
            Assert.That(cameraViewModel.RotationZ, Is.EqualTo(0));
        }
예제 #4
0
        public void UpdateCamera_LeftButtonPressedAndMoved_ExpectMovementAndNoRotation()
        {
            //Arrange
            var cameraViewModel = new FakeCameraViewModel();

            var testSubject = new MouseCameraControlViewModel(cameraViewModel);

            testSubject.ReactToMouseMovement(new Point(0, 0));
            testSubject.ReactToMouseDown(System.Windows.Input.MouseButton.Left);
            testSubject.ReactToMouseMovement(new Point(10, 10));


            //Act
            testSubject.UpdateCamera();

            //Assert
            Assert.That(cameraViewModel.LookAtPoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MovePoint, Is.EqualTo(new Point3D()));
            Assert.That(cameraViewModel.MoveVector, Is.Not.EqualTo(new Vector3D()));
            Assert.That(cameraViewModel.RotationX, Is.EqualTo(0));
            Assert.That(cameraViewModel.RotationY, Is.EqualTo(0));
            Assert.That(cameraViewModel.RotationZ, Is.EqualTo(0));
        }