Esempio n. 1
0
        public void ItemTest()
        {
            Quaternion target   = Utilities.GenerateQuaternion();
            int        index    = 0;
            float      expected = 7.3f;
            float      actual;

            target[index] = expected;
            actual        = target[index];
            Utilities.AreEqual(expected, actual);

            index         = 1;
            expected      = 5.8f;
            target[index] = expected;
            actual        = target[index];
            Utilities.AreEqual(expected, actual);

            index    = -1;
            expected = 4.1f;
            try
            {
                target[index] = expected;
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail("Wrong exception type thrown.");
            }

            try
            {
                actual = target[index];
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail("Wrong exception type thrown.");
            }

            index    = 4;
            expected = 4.1f;
            try
            {
                target[index] = expected;
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail("Wrong exception type thrown.");
            }

            try
            {
                actual = target[index];
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail("Wrong exception type thrown.");
            }
        }