-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #908 from khellang/clarify-failing-convention-tests
Clarify why convention tests are failing
- Loading branch information
Showing
9 changed files
with
139 additions
and
26 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayAttributeValueException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace Octokit.Tests.Conventions | ||
{ | ||
public class InvalidDebuggerDisplayAttributeValueException : Exception | ||
{ | ||
public InvalidDebuggerDisplayAttributeValueException(Type modelType, string value) | ||
: base (CreateMessage(modelType, value)) { } | ||
|
||
static string CreateMessage(Type modelType, string value) | ||
{ | ||
return string.Format( | ||
"Model type '{0}' has invalid DebuggerDisplayAttribute value '{1}'. Expected '{{DebuggerDisplay, nq}}'", | ||
modelType.FullName, | ||
value); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayReturnType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace Octokit.Tests.Conventions | ||
{ | ||
public class InvalidDebuggerDisplayReturnType : Exception | ||
{ | ||
public InvalidDebuggerDisplayReturnType(Type modelType, Type propertyType) | ||
: base (CreateMessage(modelType, propertyType)) { } | ||
|
||
static string CreateMessage(Type modelType, Type propertyType) | ||
{ | ||
return string.Format( | ||
"Model type '{0}' has invalid DebuggerDisplay return type '{1}'. Expected 'string'.", | ||
modelType.FullName, | ||
propertyType.Name); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayAttributeException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace Octokit.Tests.Conventions | ||
{ | ||
public class MissingDebuggerDisplayAttributeException : Exception | ||
{ | ||
public MissingDebuggerDisplayAttributeException(Type modelType) | ||
: base (string.Format("Model type '{0}' is missing the DebuggerDisplayAttribute.", modelType.FullName)) { } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayPropertyException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace Octokit.Tests.Conventions | ||
{ | ||
public class MissingDebuggerDisplayPropertyException : Exception | ||
{ | ||
public MissingDebuggerDisplayPropertyException(Type modelType) | ||
: base (string.Format("Model type '{0}' is missing the DebuggerDisplay property.", modelType.FullName)) { } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Octokit.Tests.Conventions/Exception/MutableModelPropertiesException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace Octokit.Tests.Conventions | ||
{ | ||
public class MutableModelPropertiesException : Exception | ||
{ | ||
public MutableModelPropertiesException(Type modelType, IEnumerable<PropertyInfo> mutableProperties) | ||
: base (CreateMessage(modelType, mutableProperties)) { } | ||
|
||
static string CreateMessage(Type modelType, IEnumerable<PropertyInfo> mutableProperties) | ||
{ | ||
return string.Format("Model type '{0}' contains the following mutable properties: {1}{2}", | ||
modelType.FullName, | ||
Environment.NewLine, | ||
string.Join(Environment.NewLine, mutableProperties.Select(x => x.Name))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters