Example #1
0
 internal override void UpdateViews()
 {
     NameViewBlock.Text        = TypeOfTest.ToString() + " " + TestIndex;
     TimingsViewBlock.Text     = DayOfTest.ToString("dd/MM/yyyy");
     DescriptionViewBlock.Text = Description;
     MarksViewBlock.Text       = MarksObtained + "/" + TotalMarks;
 }
Example #2
0
        /// <summary>
        /// Loops through all of the Escape Characters to ensure the expected 'ArgumentException'
        ///     is thrown and that the exception message contains the Escape Character.  If any
        ///     unexpected exceptions are thrown, they are not directly handled, thus will fail the calling
        ///     unit test with the exception information.  And, if no exception is thrown, Assertion.Fail
        ///     is called, because the ArgumentException should have been thrown.
        /// </summary>
        /// <param name="testType">Type of test that you are calling from</param>
        private void VerifyEscapeCharactersThrowExpectedException(TypeOfTest testType)
        {
            foreach (char c in EscapableCharacters)
            {
                try
                {
                    if (testType == TypeOfTest.ConstructorTest)
                    {
                        BuildItem item = new BuildItem(c.ToString(), "i");
                    }
                    else if (testType == TypeOfTest.SetNameTest)
                    {
                        BuildItem item = new BuildItem("n", "i");
                        item.Name = c.ToString();
                    }
                    else if (testType == TypeOfTest.SetMetadataTest)
                    {
                        BuildItem item = new BuildItem("n", "i");
                        item.SetMetadata(c.ToString(), "v");
                    }

                    Assertion.Fail(String.Format("Escape Character '{0}' didn't throw the expected ArgumentException", c.ToString()));
                }
                catch (ArgumentException expected)
                {
                    Assertion.AssertEquals(true, expected.Message.Contains(c.ToString()));
                }
            }
        }
Example #3
0
        /// <summary>
        /// Loops through all of the Reserved itemNames to ensure the expected 'InvalidOperationException'
        ///     is thrown and that the exception message contains the reserved itemName name.  If any
        ///     unexpected exceptions are thrown, they are not directly handled, thus will fail the calling
        ///     unit test with the exception information.  And, if no exception is thrown, Assertion.Fail
        ///     is called, because the InvalidOperationException should have been thrown.
        /// </summary>
        /// <param name="testType">Type of test that you are calling from</param>
        private void VerifyReservedNamesForBuildItemNameThrowExpectedException(TypeOfTest testType)
        {
            foreach (string s in reservedNames)
            {
                try
                {
                    if (testType == TypeOfTest.ConstructorTest)
                    {
                        BuildItem item = new BuildItem(s, "i");
                    }
                    else if (testType == TypeOfTest.SetNameTest)
                    {
                        BuildItem item = new BuildItem("n", "i");
                        item.Name = s;
                    }
                    else if (testType == TypeOfTest.SetMetadataTest)
                    {
                        BuildItem item = new BuildItem("n", "i");
                        item.SetMetadata(s, "v");
                    }

                    Assertion.Fail(String.Format("Reserved itemName '{0}' didn't throw the expected InvalidOperationException", s));
                }
                catch (InvalidOperationException expected)
                {
                    Assertion.AssertEquals(true, expected.Message.Contains(s));
                }
            }
        }