Skip to content

Commit

Permalink
Immutabillity (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Feb 21, 2024
1 parent b3d404c commit 7eca118
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion specs/Qowaiv.Specs/Hashing/Hash_specs.cs
Expand Up @@ -198,7 +198,7 @@ public void displays_the_hash()
using (Hash.WithoutRandomizer())
{
var hash = Hash.Code(12);
hash.ToString().Should().Be("12");
hash.ToString().Should().Be("665630175");
}
}
}
2 changes: 1 addition & 1 deletion src/Qowaiv.TestTools/EmptyTestClassAttribute.cs
Expand Up @@ -12,5 +12,5 @@
public sealed class EmptyTestClassAttribute : Attribute
{
/// <summary>(Optional) justification for having this empty test class.</summary>
public string? Justification { get; set; }
public string? Justification { get; init; }
}
2 changes: 1 addition & 1 deletion src/Qowaiv.TestTools/SerializationWrapper.cs
Expand Up @@ -8,5 +8,5 @@
public sealed class SerializationWrapper<T>
{
/// <summary>The generic part of the wrapper.</summary>
public T? Value { get; set; }
public T? Value { get; init; }
}
6 changes: 3 additions & 3 deletions src/Qowaiv.TestTools/XmlStructure.TSvo.cs
Expand Up @@ -7,13 +7,13 @@ public sealed class XmlStructure<TSvo>
where TSvo : struct
{
/// <summary>Gets and sets int property.</summary>
public int Id { get; set; } = 17;
public int Id { get; init; } = 17;

/// <summary>Gets and sets SVO property.</summary>
public TSvo Svo { get; set; }
public TSvo Svo { get; init; }

/// <summary>Gets and sets a date (time) property.</summary>
public DateTime Date { get; set; } = new DateTime(2017, 06, 11, 00, 00, 000, DateTimeKind.Utc);
public DateTime Date { get; init; } = new DateTime(2017, 06, 11, 00, 00, 000, DateTimeKind.Utc);

/// <inheritdoc />
[Pure]
Expand Down
4 changes: 2 additions & 2 deletions src/Qowaiv/Formatting/FormattingArgumentsCollection.cs
Expand Up @@ -37,7 +37,7 @@ public FormattingArgumentsCollection(IFormatProvider? formatProvider, Formatting
private readonly Dictionary<Type, FormattingArguments> dict = [];

/// <summary>Gets the default format provider of the collection.</summary>
public IFormatProvider FormatProvider { get; protected set; }
public IFormatProvider FormatProvider { get; }

/// <summary>Formats the object using the formatting arguments from the collection.</summary>
/// <param name="obj">
Expand Down Expand Up @@ -476,7 +476,7 @@ public FormattingArguments Get(Type? type)
}

/// <summary>Gets a collection containing the types for the collection.</summary>
public ICollection<Type> Types => dict.Keys;
public IReadOnlyCollection<Type> Types => dict.Keys;

/// <summary>Returns an enumerator that iterates through the collection.</summary>
[Pure]
Expand Down
2 changes: 1 addition & 1 deletion src/Qowaiv/SingleValueObjectAttribute.cs
Expand Up @@ -34,5 +34,5 @@ public SingleValueObjectAttribute(SingleValueStaticOptions staticOptions, Type u
/// <remarks>
/// Use this if the database type is different from the underlying type.
/// </remarks>
public Type? DatabaseType { get; set; }
public Type? DatabaseType { get; init; }
}
10 changes: 5 additions & 5 deletions src/Qowaiv/Text/WildcardPattern.cs
Expand Up @@ -115,19 +115,19 @@ protected virtual void GetObjectData(SerializationInfo info, StreamingContext co
}

/// <summary>The wildcard pattern options.</summary>
public WildcardPatternOptions Options { get; private set; }
public WildcardPatternOptions Options { get; init; }

/// <summary>The comparison type.</summary>
public StringComparison ComparisonType { get; private set; }
public StringComparison ComparisonType { get; init; }

/// <summary>The wildcard pattern.</summary>
protected string Pattern { get; private set; }
protected string Pattern { get; init; }

/// <summary>The wildcard single char.</summary>
protected char SingleChar { get; set; }
protected char SingleChar { get; init; }

/// <summary>The wildcard multiple chars.</summary>
protected char MultipleChars { get; set; }
protected char MultipleChars { get; init; }

/// <summary>Returns true if matching is culture independent, otherwise false.</summary>
/// <remarks>
Expand Down
6 changes: 3 additions & 3 deletions src/Qowaiv/Threading/ThreadDomain.cs
Expand Up @@ -8,7 +8,7 @@ namespace Qowaiv.Threading;
/// <summary>Represents domain of typed instances that can be used as the
/// default values based on the current thread.
/// </summary>
public class ThreadDomain
public sealed class ThreadDomain
{
/// <summary>Initializes static members of the <see cref="ThreadDomain"/> class.</summary>
static ThreadDomain()
Expand Down Expand Up @@ -68,10 +68,10 @@ public static void Register(Type type, Func<Thread, object> creator)
/// <remarks>
/// No public accessor.
/// </remarks>
protected ThreadDomain() => Values = [];
private ThreadDomain() => Values = [];

/// <summary>The underlying dictionary.</summary>
protected Dictionary<Type, object?> Values { get; private set; }
private Dictionary<Type, object?> Values { get; set; }

/// <summary>Gets the current value of T.</summary>
/// <typeparam name="T">
Expand Down

0 comments on commit 7eca118

Please sign in to comment.