コード例 #1
0
ファイル: Assertions.cs プロジェクト: stan-osipov/testify
        /// <summary>
        /// Replaces the nulls.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns>Text formatted without nulls.</returns>
        internal static string ReplaceNulls(object input)
        {
            if (input == null)
            {
                return(Resources.Common_NullInMessages);
            }

            var result = input.ToString();

            if (result == null)
            {
                return(Resources.Common_ObjectString);
            }

            return(Assertions.ReplaceNullChars(result));
        }
コード例 #2
0
        /// <summary>
        /// Fails with an <see cref="AssertionException"/> without checking any conditions. Displays
        /// a message, and applies the specified formatting to it.
        /// </summary>
        /// <param name="message">A message to display. This message can be seen in the unit test results.</param>
        /// <param name="parameters">An array of parameters to use when formatting <paramref name="message"/>.</param>
        public static void Fail(string message, params object[] parameters)
        {
            var completeMessage = Assertions.CreateCompleteMessage(message, parameters);

            throw new AssertionException(completeMessage);
        }
コード例 #3
0
ファイル: TestCollection.cs プロジェクト: drewnoakes/testify
        /// <summary>
        /// Runs the tests.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="args">The arguments.</param>
        /// <exception cref="AssertionException">One or more tests failed.</exception>
        public void RunTests(string message, params object[] args)
        {
            Argument.NotNull(message, nameof(message));

            Assertions.AssertAll(string.Format(message, args), tests);
        }