Exemplo n.º 1
0
        /// <summary>
        /// Will throw a combined exception for any failures have been collected since <see cref="StartCollecting"/> was called.
        /// </summary>
        public void ThrowIfAny(IDictionary <string, object> context)
        {
            if (failureMessages.Any())
            {
                var builder = new StringBuilder();
                builder.AppendLine(string.Join(Environment.NewLine, failureMessages.ToArray()));

                if (context.Any())
                {
                    foreach (KeyValuePair <string, object> pair in context)
                    {
                        builder.AppendFormat("\nWith {0}:\n{1}", pair.Key, pair.Value);
                    }
                }

                AssertionHelper.Throw(builder.ToString());
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Instructs the strategy to handle a assertion failure.
 /// </summary>
 public void HandleFailure(string message)
 {
     AssertionHelper.Throw(message);
 }