Files
octokit.net/Octokit.Tests.Conventions/Exception/InterfaceMissingMethodsException.cs
2015-12-16 21:23:36 +02:00

29 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace Octokit.Tests.Conventions
{
public class InterfaceMissingMethodsException : Exception
{
public InterfaceMissingMethodsException(Type type, IEnumerable<string> methodsMissingOnReactiveClient)
: base(CreateMessage(type, methodsMissingOnReactiveClient))
{ }
public InterfaceMissingMethodsException(Type type, IEnumerable<string> methodsMissingOnReactiveClient, Exception innerException)
: base(CreateMessage(type, methodsMissingOnReactiveClient), innerException)
{ }
protected InterfaceMissingMethodsException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
static string CreateMessage(Type type, IEnumerable<string> methods)
{
var methodsFormatted = string.Join("\r\n", methods.Select(m => string.Format(" - {0}", m)));
return "Methods not found on interface {0} which are required:\r\n{1}"
.FormatWithNewLine(type.Name, methodsFormatted);
}
}
}