-
Notifications
You must be signed in to change notification settings - Fork 759
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use JsonPolymorphic feature of System.Text.Json
- Loading branch information
1 parent
6a93fdd
commit 2b1f75b
Showing
39 changed files
with
610 additions
and
189 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit.Internal; | ||
|
||
namespace Xunit.Sdk; | ||
|
||
/// <summary> | ||
/// An exception which indicates an object had several properties that were not properly initialized. | ||
/// </summary> | ||
public class UnsetPropertiesException : InvalidOperationException | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="UnsetPropertiesException"/> class. | ||
/// </summary> | ||
/// <param name="propertyNames">The properties that were not set</param> | ||
/// <param name="type">The type that the property belongs to</param> | ||
public UnsetPropertiesException( | ||
IEnumerable<string> propertyNames, | ||
Type type) | ||
{ | ||
PropertyNames = Guard.ArgumentNotNull(propertyNames).OrderBy(x => x).ToArray(); | ||
TypeName = Guard.ArgumentNotNull(type).SafeName(); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string Message => | ||
$"Object of type '{TypeName}' had one or more properties that were not set: {string.Join(", ", PropertyNames)}"; | ||
|
||
/// <summary> | ||
/// Gets the property names of the uninitialized properties. | ||
/// </summary> | ||
public string[] PropertyNames { get; } | ||
|
||
/// <summary> | ||
/// Gets the type name of the uninitialized property. | ||
/// </summary> | ||
public string TypeName { get; } | ||
} |
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
Oops, something went wrong.