-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12,138 changed files
with
6,113,036 additions
and
972 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
461 changes: 461 additions & 0 deletions
461
...apshotTests/Config/snapshots/snap-v3.1/GlobalConfigTests.Conversion_override.verified.txt
Large diffs are not rendered by default.
Oops, something went wrong.
510 changes: 510 additions & 0 deletions
510
...hotTests/Config/snapshots/snap-v3.1/GlobalConfigTests.Customization_override.verified.txt
Large diffs are not rendered by default.
Oops, something went wrong.
516 changes: 516 additions & 0 deletions
516
...ts/Config/snapshots/snap-v3.1/GlobalConfigTests.OmitDebugAttributes_override.verified.txt
Large diffs are not rendered by default.
Oops, something went wrong.
374 changes: 374 additions & 0 deletions
374
tests/SnapshotTests/Config/snapshots/snap-v3.1/GlobalConfigTests.Override_all.verified.txt
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,374 @@ | ||
[ | ||
// ------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a source generator named Intellenum (https://github.com/SteveDunn/Intellenum) | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
// ------------------------------------------------------------------------------ | ||
|
||
// Suppress warnings about [Obsolete] member usage in generated code. | ||
#pragma warning disable CS0618 | ||
|
||
// Suppress warnings for 'Override methods on comparable types'. | ||
#pragma warning disable CA1036 | ||
|
||
// Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators | ||
#pragma warning disable MA0097 | ||
|
||
// Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' | ||
// The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. | ||
#pragma warning disable CS8669 | ||
|
||
#pragma warning disable CS1573 | ||
|
||
// Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' | ||
#pragma warning disable CS1591 | ||
|
||
using Intellenum; | ||
using System; | ||
|
||
|
||
namespace Whatever | ||
{ | ||
|
||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Intellenum", "1.0.0.0")] | ||
|
||
[global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(CustomerTypeDebugView))] | ||
[global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.String, Value = { _value }")] | ||
public partial class CustomerType : | ||
global::System.IEquatable<CustomerType>, | ||
global::System.IComparable, | ||
global::System.IComparable<CustomerType> | ||
{ | ||
|
||
|
||
#if DEBUG | ||
private readonly global::System.Diagnostics.StackTrace _stackTrace = null; | ||
#endif | ||
private readonly global::System.Boolean _isInitialized; | ||
private readonly System.String _value; | ||
|
||
|
||
|
||
/// <summary> | ||
/// Gets the underlying <see cref="System.String" /> value if set, otherwise default | ||
/// </summary> | ||
public System.String Value => _value; | ||
|
||
[global::System.Diagnostics.DebuggerStepThroughAttribute] | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
public CustomerType() | ||
{ | ||
#if DEBUG | ||
_stackTrace = new global::System.Diagnostics.StackTrace(); | ||
#endif | ||
_isInitialized = false; | ||
_value = default; | ||
Name = "[UNDEFINED]"; | ||
} | ||
|
||
[global::System.Diagnostics.DebuggerStepThroughAttribute] | ||
private CustomerType(System.String value) | ||
{ | ||
_value = value; | ||
Name = "[INFERRED-TO-BE-REPLACED!]"; | ||
_isInitialized = true; | ||
} | ||
|
||
[global::System.Diagnostics.DebuggerStepThroughAttribute] | ||
private CustomerType(string enumName, System.String value) | ||
{ | ||
_value = value; | ||
Name = enumName; | ||
_isInitialized = true; | ||
} | ||
|
||
public string Name { get; private set; } | ||
|
||
public void Deconstruct(out string Name, out System.String Value) | ||
{ | ||
Name = this.Name; | ||
Value = this.Value; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Builds a member from an enum value. | ||
/// </summary> | ||
/// <param name="value">The value.</param> | ||
/// <returns>The matching enum, or an exception.</returns> | ||
public static CustomerType FromValue(System.String value) | ||
{ | ||
bool b = TryFromValue(value, out var ret); | ||
if(b) return ret; | ||
throw new IntellenumMatchFailedException($"CustomerType has no matching members with a value of '{value}'"); | ||
} | ||
|
||
/// <summary> | ||
/// Tries to get a member based on value. | ||
/// </summary> | ||
/// <param name="value">The value.</param> | ||
/// <returns>The matching enum, or an exception.</returns> | ||
public static bool TryFromValue(System.String value, out CustomerType member) | ||
{ | ||
switch (value) | ||
{ | ||
case "0": | ||
member = CustomerType.Normal; | ||
return true; | ||
case "1": | ||
member = CustomerType.Gold; | ||
return true; | ||
default: | ||
member = default; | ||
return false; | ||
} | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Determines if there is a member that is defined with the specified value. | ||
/// </summary> | ||
/// <param name="value">The value to search for.</param> | ||
/// <returns>True if there is a member with matching value, otherwise False.</returns> | ||
public static bool IsDefined(System.String value) | ||
{ | ||
return value switch { "0" => true, | ||
"1" => true, | ||
_ => false | ||
}; | ||
} | ||
|
||
|
||
|
||
/// <summary> | ||
/// Gets the matching member based on name. | ||
/// </summary> | ||
/// <param name="name">The name.</param> | ||
/// <returns>The matching enum, or an exception.</returns> | ||
public static CustomerType FromName(ReadOnlySpan<char> name) | ||
{ | ||
bool b = TryFromName(name, out var ret); | ||
if(b) return ret; | ||
throw new IntellenumMatchFailedException($"CustomerType has no matching members named '{name.ToString()}'"); | ||
} | ||
|
||
/// <summary> | ||
/// Tries to get the matching member from a name. | ||
/// </summary> | ||
/// <param name="name">The name.</param> | ||
/// <returns>The matching enum, or an exception.</returns> | ||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static bool TryFromName(ReadOnlySpan<char> name, out CustomerType member) | ||
{ | ||
switch (name) | ||
{ | ||
case ("Normal"): | ||
member = CustomerType.Normal; | ||
return true; | ||
case ("Gold"): | ||
member = CustomerType.Gold; | ||
return true; | ||
default: | ||
member = default; | ||
return false; | ||
} | ||
|
||
} | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static bool IsNamedDefined(ReadOnlySpan<char> name) | ||
{ | ||
return TryFromName(name, out _); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Builds a member from the provided underlying type. | ||
/// </summary> | ||
/// <param name="value">The underlying type.</param> | ||
/// <returns>A member of this type.</returns> | ||
private static CustomerType From(string name, System.String value) | ||
{ | ||
if (value is null) | ||
{ | ||
throw new IntellenumCreationFailedException("Cannot create an Intellenum member with a null."); | ||
} | ||
|
||
|
||
CustomerType member = new CustomerType(name, value); | ||
|
||
return member; | ||
} | ||
|
||
// A placeholder method used by the source generator during compilation so that | ||
// users call 'Call' it. The source generator examines calls to this in order to | ||
// generate physical members (e.g. public static readonly MyEnum Item1 = new...) | ||
private static void Member(string name, System.String value) | ||
{ | ||
} | ||
|
||
// only called internally when something has been deserialized into | ||
// its primitive type. | ||
private static CustomerType Deserialize(System.String value) | ||
{ | ||
if (value is null) | ||
{ | ||
throw new IntellenumCreationFailedException("Cannot create an Intellenum member with a null."); | ||
} | ||
|
||
|
||
if(value == Normal.Value) return Normal; | ||
if(value == Gold.Value) return Gold; | ||
|
||
|
||
return FromValue(value); | ||
} | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public global::System.Boolean Equals(CustomerType other) | ||
{ | ||
if (ReferenceEquals(null, other)) | ||
{ | ||
return false; | ||
} | ||
|
||
// It's possible to create uninitialized members via converters such as EfCore (HasDefaultValue), which call Equals. | ||
// We treat anything uninitialized as not equal to anything, even other uninitialized members of this type. | ||
if(!_isInitialized || !other._isInitialized) return false; | ||
|
||
if (ReferenceEquals(this, other)) | ||
{ | ||
return true; | ||
} | ||
|
||
return GetType() == other.GetType() && global::System.Collections.Generic.EqualityComparer<System.String>.Default.Equals(Value, other.Value); | ||
} | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public override global::System.Boolean Equals(global::System.Object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (ReferenceEquals(this, obj)) | ||
{ | ||
return true; | ||
} | ||
|
||
if (obj.GetType() != GetType()) | ||
{ | ||
return false; | ||
} | ||
|
||
return Equals((CustomerType) obj); | ||
} | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator ==(CustomerType left, CustomerType right) => Equals(left, right); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator !=(CustomerType left, CustomerType right) => !Equals(left, right); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator ==(CustomerType left, System.String right) => Equals(left.Value, right); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator !=(CustomerType left, System.String right) => !Equals(left.Value, right); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator ==(System.String left, CustomerType right) => Equals(left, right.Value); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator !=(System.String left, CustomerType right) => !Equals(left, right.Value); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator <(CustomerType left, CustomerType right) => left.CompareTo(right) < 0; | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator <=(CustomerType left, CustomerType right) => left.CompareTo(right) <= 0; | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator >(CustomerType left, CustomerType right) => left.CompareTo(right) > 0; | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static global::System.Boolean operator >=(CustomerType left, CustomerType right) => left.CompareTo(right) >= 0; | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static explicit operator CustomerType(System.String value) => FromValue(value); | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public static implicit operator System.String(CustomerType value) => value.Value; | ||
|
||
public int CompareTo(CustomerType other) => Value.CompareTo(other.Value); | ||
public int CompareTo(object other) { | ||
if(other == null) return 1; | ||
if(other is CustomerType x) return CompareTo(x); | ||
throw new global::System.ArgumentException("Cannot compare to object as it is not of type CustomerType", nameof(other)); | ||
} | ||
|
||
[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] | ||
public override global::System.Int32 GetHashCode() | ||
{ | ||
unchecked // Overflow is fine, just wrap | ||
{ | ||
global::System.Int32 hash = (global::System.Int32) 2166136261; | ||
hash = (hash * 16777619) ^ Value.GetHashCode(); | ||
hash = (hash * 16777619) ^ GetType().GetHashCode(); | ||
hash = (hash * 16777619) ^ global::System.Collections.Generic.EqualityComparer<System.String>.Default.GetHashCode(); | ||
return hash; | ||
} | ||
} | ||
|
||
|
||
// member... | ||
|
||
public static readonly CustomerType Normal = new CustomerType("Normal","0"); | ||
|
||
// member... | ||
|
||
public static readonly CustomerType Gold = new CustomerType("Gold","1"); | ||
|
||
|
||
public static global::System.Collections.Generic.IEnumerable<CustomerType> List() | ||
{ | ||
yield return Normal; | ||
yield return Gold; | ||
|
||
} | ||
|
||
/// <summary>Returns the name of the enum.</summary> | ||
public override global::System.String ToString() => Name; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
internal sealed class CustomerTypeDebugView | ||
{ | ||
private readonly CustomerType _t; | ||
|
||
CustomerTypeDebugView(CustomerType t) | ||
{ | ||
_t = t; | ||
} | ||
|
||
public global::System.String UnderlyingType => "System.String"; | ||
public System.String Value => _t.Value ; | ||
|
||
public global::System.String Conversions => @""; | ||
} | ||
} | ||
} | ||
] |
Oops, something went wrong.