예제 #1
0
        public void RegisterNavigationRule_NavigationDataIsRegisteredByKeyInUnityContainer()
        {
            //Act
            _unityContainer.RegisterNavigationRule <InstanceClass, InstanceClass>(_navigationKey);

            //Assert
            UnityAssert.IsRegisteredWithName <NavigationData>(_unityContainer, _navigationKey);
        }
예제 #2
0
        public void RegisterNavigationManager_NavigationManagerIsRegisteredInContainer()
        {
            //Act
            _unityContainer.RegisterNavigationManager(_frameControl, _navigationManagerType, _frameControlType, _injectionMembers);

            //Assert
            UnityAssert.IsRegistered <INavigationManager>(_unityContainer);
        }
예제 #3
0
        public void RegisterNavigationManager_NavigationManagerCanBeResolved()
        {
            //Arrange
            var frameControl = new ContentControl();

            //Act
            _unityContainer.RegisterNavigationManager(frameControl);

            //Assert
            UnityAssert.CanResolve <NavigationManager>(_unityContainer);
        }
예제 #4
0
        public void RegisterNavigationManager_INavigationManagerIsRegistered()
        {
            //Arrange
            var frameControl = new ContentControl();

            //Act
            _unityContainer.RegisterNavigationManager(frameControl);

            //Assert
            UnityAssert.IsRegistered <INavigationManager>(_unityContainer);
        }
예제 #5
0
        public void NearestPointOnLineSegment3dVerification()
        {
            Vector3 a = new Vector3(0.0f, 0.0f, 5.0f);
            Vector3 b = new Vector3(5.0f, 0.0f, 0.0f);

            Vector3 pnt = new Vector3(0.0f, 0.0f, 0.0f);

            Vector3 expected = new Vector3(2.5f, 0.0f, 2.5f);

            // Normal case
            UnityAssert.AreClose(expected, LinearAlgebra.NearestPointOnLineSegment(a, b, pnt), 0.0001f);

            // Edge cases
            Vector3 ones    = Vector3.one;
            Vector3 negOnes = -1.0f * ones;

            UnityAssert.AreClose(Vector3.zero, LinearAlgebra.NearestPointOnLineSegment(Vector3.zero, ones, negOnes), 0.0001f);
            UnityAssert.AreClose(Vector3.zero, LinearAlgebra.NearestPointOnLineSegment(Vector3.zero, Vector3.zero, ones), 0.0001f);
        }
예제 #6
0
        public void NearestPointOnLineSegment2dVerification()
        {
            Vector2 a = new Vector2(0.0f, 5.0f);
            Vector2 b = new Vector2(5.0f, 0.0f);

            Vector2 pnt = new Vector2(0.0f, 0.0f);

            Vector2 expected = new Vector2(2.5f, 2.5f);

            // Normal case
            UnityAssert.AreClose(expected, LinearAlgebra.NearestPointOnLineSegment(a, b, pnt), 0.0001f);

            // Edge cases
            Vector2 ones    = new Vector2(1.0f, 1.0f);
            Vector2 negOnes = new Vector2(-1.0f, -1.0f);

            UnityAssert.AreClose(Vector3.zero, LinearAlgebra.NearestPointOnLineSegment(Vector2.zero, ones, negOnes), 0.0001f);
            UnityAssert.AreClose(Vector3.zero, LinearAlgebra.NearestPointOnLineSegment(Vector2.zero, Vector2.zero, ones), 0.0001f);
        }