mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-25 15:42:55 +00:00
3345f76fc9
* Added a convention test to detect a model constructor exposing all properties * add ctors to classes where they are missing * rename ctor parameters that dont match properties * add missing parameters to existing ctors * add specific PunchCard ctor to allow mocking, and update test to resolve call ambiguity * Added base class properties to the convention test Added member exclusion attribute * Updated newly offending classes 2 excludes and 2 ctors * rename exclusion attribute to be a bit shorter
23 lines
880 B
C#
23 lines
880 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
|
|
namespace Octokit.Tests.Conventions
|
|
{
|
|
public class MissingPublicConstructorWithAllPropertiesException : Exception
|
|
{
|
|
public MissingPublicConstructorWithAllPropertiesException(Type modelType, IEnumerable<PropertyInfo> missingProperties)
|
|
: base(CreateMessage(modelType, missingProperties))
|
|
{ }
|
|
|
|
private static string CreateMessage(Type modelType, IEnumerable<PropertyInfo> missingProperties)
|
|
{
|
|
return string.Format("Model type '{0}' is missing a constructor with all properties. Closest match is missing the following properties: {1}{2}",
|
|
modelType.FullName,
|
|
Environment.NewLine,
|
|
string.Join(Environment.NewLine, missingProperties.Select(prop => prop.Name)));
|
|
}
|
|
}
|
|
}
|