Skip to content

Commit a4c8604

Browse files
update/xmldoc
* Updated xmldocs in OnixLabs.Core library. * Updated xmldocs for OnixLabs.Security library. * Fixed failing tests due to implementation change in Optional.cs
1 parent da5c87d commit a4c8604

File tree

11 files changed

+31
-142
lines changed

11 files changed

+31
-142
lines changed

OnixLabs.Core/Enumeration.Comparable.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,9 @@ namespace OnixLabs.Core;
1616

1717
public abstract partial class Enumeration<T>
1818
{
19-
/// <summary>
20-
/// Compares the current instance with another object of the same type and returns an integer that indicates
21-
/// whether the current instance precedes, follows, or occurs in the same position in the sort order as the
22-
/// other object.
23-
/// </summary>
24-
/// <param name="other">An object to compare with the current instance.</param>
25-
/// <returns>Returns a value that indicates the relative order of the objects being compared.</returns>
19+
/// <inheritdoc/>
2620
public int CompareTo(T? other) => Value.CompareToNullable(other?.Value);
2721

28-
/// <summary>
29-
/// Compares the current instance with another object of the same type and returns an integer that indicates
30-
/// whether the current instance precedes, follows, or occurs in the same position in the sort order as the
31-
/// other object.
32-
/// </summary>
33-
/// <param name="obj">An object to compare with the current instance.</param>
34-
/// <returns>Returns a value that indicates the relative order of the objects being compared.</returns>
22+
/// <inheritdoc/>
3523
public int CompareTo(object? obj) => this.CompareToObject(obj);
3624
}

OnixLabs.Core/Enumeration.Equatable.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,18 @@ namespace OnixLabs.Core;
1818

1919
public abstract partial class Enumeration<T>
2020
{
21-
/// <summary>
22-
/// Checks whether the current object is equal to another object of the same type.
23-
/// </summary>
24-
/// <param name="other">An object to compare with the current object.</param>
25-
/// <returns>Returns <see langword="true"/> if the current object is equal to the other parameter; otherwise, <see langword="false"/>.</returns>
21+
/// <inheritdoc/>
2622
public bool Equals(T? other) =>
2723
ReferenceEquals(this, other)
2824
|| other is not null
2925
&& other.GetType() == GetType()
3026
&& other.Value == Value
3127
&& other.Name == Name;
3228

33-
/// <summary>
34-
/// Checks for equality between the current instance and another object.
35-
/// </summary>
36-
/// <param name="obj">The object to check for equality.</param>
37-
/// <returns>Returns <see langword="true"/> if the object is equal to the current instance; otherwise, <see langword="false"/>.</returns>
29+
/// <inheritdoc/>
3830
public override bool Equals(object? obj) => Equals(obj as T);
3931

40-
/// <summary>
41-
/// Serves as a hash code function for the current instance.
42-
/// </summary>
43-
/// <returns>Returns a hash code for the current instance.</returns>
32+
/// <inheritdoc/>
4433
public override int GetHashCode() => HashCode.Combine(GetType(), Name, Value);
4534

4635
/// <summary>

OnixLabs.Core/Enumeration.To.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ public abstract partial class Enumeration<T>
2424
/// <returns>Returns a tuple that represents the current object.</returns>
2525
public (int Value, string Name) ToEntry() => (Value, Name);
2626

27-
/// <summary>
28-
/// Returns a <see cref="String"/> that represents the current object.
29-
/// </summary>
30-
/// <returns>Returns a <see cref="String"/> that represents the current object.</returns>
27+
/// <inheritdoc/>
3128
public override string ToString() => Name;
3229
}

OnixLabs.Core/Optional.cs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,13 @@ public static Optional<TStruct> Of<TStruct>(TStruct? value) where TStruct : stru
136136
/// <returns>Returns <see langword="true"/> if the left-hand instance is not equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
137137
public static bool operator !=(Optional<T>? left, Optional<T>? right) => !Equals(left, right);
138138

139-
/// <summary>
140-
/// Checks whether the current object is equal to another object of the same type.
141-
/// </summary>
142-
/// <param name="other">An object to compare with the current object.</param>
143-
/// <returns>Returns <see langword="true"/> if the current object is equal to the other parameter; otherwise, <see langword="false"/>.</returns>
139+
/// <inheritdoc/>
144140
public bool Equals(Optional<T>? other) => OptionalEqualityComparer<T>.Default.Equals(this, other);
145141

146-
/// <summary>
147-
/// Checks for equality between the current instance and another object.
148-
/// </summary>
149-
/// <param name="obj">The object to check for equality.</param>
150-
/// <returns>Returns <see langword="true"/> if the object is equal to the current instance; otherwise, <see langword="false"/>.</returns>
142+
/// <inheritdoc/>
151143
public sealed override bool Equals(object? obj) => Equals(obj as Optional<T>);
152144

153-
/// <summary>
154-
/// Serves as a hash code function for the current instance.
155-
/// </summary>
156-
/// <returns>Returns a hash code for the current instance.</returns>
145+
/// <inheritdoc/>
157146
// ReSharper disable once HeapView.PossibleBoxingAllocation
158147
public sealed override int GetHashCode() => this is Some<T> some ? some.Value.GetHashCode() : 0;
159148

@@ -258,10 +247,7 @@ public void Match(Action<T>? some = null, Action? none = null)
258247
/// <returns>Returns a new, successful <see cref="Result{T}"/> instance containing the current <see cref="Optional{T}"/> instance.</returns>
259248
public Result<Optional<T>> ToResult() => Result<Optional<T>>.Success(this);
260249

261-
/// <summary>
262-
/// Returns a <see cref="String"/> that represents the current object.
263-
/// </summary>
264-
/// <returns>Returns a <see cref="String"/> that represents the current object.</returns>
250+
/// <inheritdoc/>
265251
// ReSharper disable once HeapView.PossibleBoxingAllocation
266252
public sealed override string ToString() => this is Some<T> some ? some.Value.ToString() ?? string.Empty : nameof(None);
267253
}

OnixLabs.Core/OptionalEqualityComparer.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ public sealed class OptionalEqualityComparer<T>(EqualityComparer<T>? valueEquali
2929
// ReSharper disable once HeapView.ObjectAllocation.Evident
3030
public static readonly OptionalEqualityComparer<T> Default = new();
3131

32-
/// <summary>Determines whether the specified <see cref="Optional{T}"/> values are equal.</summary>
33-
/// <param name="x">The first object of type <see cref="Optional{T}"/> to compare.</param>
34-
/// <param name="y">The second object of type <see cref="Optional{T}"/> to compare.</param>
35-
/// <returns> Returns <see langword="true" /> if the specified <see cref="Optional{T}"/> values are equal; otherwise, <see langword="false" />.</returns>
32+
/// <inheritdoc/>
3633
public bool Equals(Optional<T>? x, Optional<T>? y)
3734
{
3835
if (ReferenceEquals(x, y)) return true;
@@ -43,8 +40,6 @@ public bool Equals(Optional<T>? x, Optional<T>? y)
4340
return (valueEqualityComparer ?? EqualityComparer<T>.Default).Equals(x.GetValueOrDefault(), y.GetValueOrDefault());
4441
}
4542

46-
/// <summary>Returns a hash code for the specified object.</summary>
47-
/// <param name="obj">The <see cref="object" /> for which a hash code is to be returned.</param>
48-
/// <returns>A hash code for the specified object.</returns>
43+
/// <inheritdoc/>
4944
public int GetHashCode(Optional<T> obj) => obj.GetHashCode();
5045
}

OnixLabs.Core/Result.Generic.cs

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ public static async Task<Result<T>> OfAsync(Func<CancellationToken, Task<T>> fun
174174
/// <returns>Returns <see langword="true"/> if the left-hand instance is not equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
175175
public static bool operator !=(Result<T>? left, Result<T>? right) => !Equals(left, right);
176176

177-
/// <summary>
178-
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
179-
/// </summary>
177+
/// <inheritdoc/>
180178
public void Dispose()
181179
{
182180
// ReSharper disable once HeapView.PossibleBoxingAllocation
@@ -186,12 +184,7 @@ public void Dispose()
186184
GC.SuppressFinalize(this);
187185
}
188186

189-
/// <summary>
190-
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
191-
/// </summary>
192-
/// <returns>
193-
/// Returns a task that represents the asynchronous dispose operation.
194-
/// </returns>
187+
/// <inheritdoc/>
195188
public async ValueTask DisposeAsync()
196189
{
197190
// ReSharper disable once HeapView.PossibleBoxingAllocation
@@ -201,24 +194,13 @@ public async ValueTask DisposeAsync()
201194
GC.SuppressFinalize(this);
202195
}
203196

204-
/// <summary>
205-
/// Checks whether the current object is equal to another object of the same type.
206-
/// </summary>
207-
/// <param name="other">An object to compare with the current object.</param>
208-
/// <returns>Returns <see langword="true"/> if the current object is equal to the other parameter; otherwise, <see langword="false"/>.</returns>
197+
/// <inheritdoc/>
209198
public bool Equals(Result<T>? other) => ResultEqualityComparer<T>.Default.Equals(this, other);
210199

211-
/// <summary>
212-
/// Checks for equality between the current instance and another object.
213-
/// </summary>
214-
/// <param name="obj">The object to check for equality.</param>
215-
/// <returns>Returns <see langword="true"/> if the object is equal to the current instance; otherwise, <see langword="false"/>.</returns>
200+
/// <inheritdoc/>
216201
public sealed override bool Equals(object? obj) => Equals(obj as Result<T>);
217202

218-
/// <summary>
219-
/// Serves as a hash code function for the current instance.
220-
/// </summary>
221-
/// <returns>Returns a hash code for the current instance.</returns>
203+
/// <inheritdoc/>
222204
public sealed override int GetHashCode() => this switch
223205
{
224206
// ReSharper disable once HeapView.PossibleBoxingAllocation
@@ -855,10 +837,7 @@ public void Throw()
855837
throw failure.Exception;
856838
}
857839

858-
/// <summary>
859-
/// Returns a <see cref="String"/> that represents the current object.
860-
/// </summary>
861-
/// <returns>Returns a <see cref="String"/> that represents the current object.</returns>
840+
/// <inheritdoc/>
862841
public sealed override string ToString() => this switch
863842
{
864843
// ReSharper disable once HeapView.PossibleBoxingAllocation

OnixLabs.Core/Result.cs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ public static async Task<Result> OfAsync(Func<CancellationToken, Task> func, Can
152152
/// <returns>Returns <see langword="true"/> if the left-hand instance is not equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
153153
public static bool operator !=(Result? left, Result? right) => !Equals(left, right);
154154

155-
/// <summary>
156-
/// Checks whether the current object is equal to another object of the same type.
157-
/// </summary>
158-
/// <param name="other">An object to compare with the current object.</param>
159-
/// <returns>Returns <see langword="true"/> if the current object is equal to the other parameter; otherwise, <see langword="false"/>.</returns>
155+
/// <inheritdoc/>
160156
public bool Equals(Result? other)
161157
{
162158
if (ReferenceEquals(this, other)) return true;
@@ -167,17 +163,10 @@ public bool Equals(Result? other)
167163
return this is Success && other is Success;
168164
}
169165

170-
/// <summary>
171-
/// Checks for equality between the current instance and another object.
172-
/// </summary>
173-
/// <param name="obj">The object to check for equality.</param>
174-
/// <returns>Returns <see langword="true"/> if the object is equal to the current instance; otherwise, <see langword="false"/>.</returns>
166+
/// <inheritdoc/>
175167
public sealed override bool Equals(object? obj) => Equals(obj as Result);
176168

177-
/// <summary>
178-
/// Serves as a hash code function for the current instance.
179-
/// </summary>
180-
/// <returns>Returns a hash code for the current instance.</returns>
169+
/// <inheritdoc/>
181170
public sealed override int GetHashCode() => this is Failure failure ? failure.Exception.GetHashCode() : 0;
182171

183172
/// <summary>
@@ -738,10 +727,7 @@ public void Throw()
738727
throw failure.Exception;
739728
}
740729

741-
/// <summary>
742-
/// Returns a <see cref="String"/> that represents the current object.
743-
/// </summary>
744-
/// <returns>Returns a <see cref="String"/> that represents the current object.</returns>
730+
/// <inheritdoc/>
745731
public sealed override string ToString() => this is Failure failure ? failure.Exception.Message : string.Empty;
746732
}
747733

OnixLabs.Core/ResultEqualityComparer.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ public sealed class ResultEqualityComparer<T>(EqualityComparer<T>? valueComparer
3030
// ReSharper disable once HeapView.ObjectAllocation.Evident
3131
public static readonly ResultEqualityComparer<T> Default = new();
3232

33-
/// <summary>Determines whether the specified <see cref="Result{T}"/> values are equal.</summary>
34-
/// <param name="x">The first object of type <see cref="Result{T}"/> to compare.</param>
35-
/// <param name="y">The second object of type <see cref="Result{T}"/> to compare.</param>
36-
/// <returns> Returns <see langword="true" /> if the specified <see cref="Result{T}"/> values are equal; otherwise, <see langword="false" />.</returns>
33+
/// <inheritdoc/>
3734
public bool Equals(Result<T>? x, Result<T>? y)
3835
{
3936
if (ReferenceEquals(x, y)) return true;
@@ -48,8 +45,6 @@ public bool Equals(Result<T>? x, Result<T>? y)
4845
return valueComparer.GetOrDefault().Equals(xValue, yValue);
4946
}
5047

51-
/// <summary>Returns a hash code for the specified object.</summary>
52-
/// <param name="obj">The <see cref="object" /> for which a hash code is to be returned.</param>
53-
/// <returns>A hash code for the specified object.</returns>
48+
/// <inheritdoc/>
5449
public int GetHashCode(Result<T> obj) => obj.GetHashCode();
5550
}

OnixLabs.Core/Specification.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ public static Specification<T> Or(params IEnumerable<Specification<T>> specifica
105105
/// <typeparam name="T">The underlying type of the subject to which the specification applies.</typeparam>
106106
public class CriteriaSpecification<T>(Expression<Func<T, bool>> criteria) : Specification<T>
107107
{
108-
/// <summary>
109-
/// Gets the underlying expression criteria of the current specification.
110-
/// </summary>
108+
/// <inheritdoc/>
111109
public override Expression<Func<T, bool>> Criteria => criteria;
112110
}
113111

OnixLabs.Security/SecurityToken.Equatable.cs

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,18 @@ namespace OnixLabs.Security;
1818

1919
public readonly partial struct SecurityToken
2020
{
21-
/// <summary>
22-
/// Checks whether the current object is equal to another object of the same type.
23-
/// </summary>
24-
/// <param name="other">An object to compare with the current object.</param>
25-
/// <returns>Returns <see langword="true"/> if the current object is equal to the other parameter; otherwise, <see langword="false"/>.</returns>
21+
/// <inheritdoc/>
2622
public bool Equals(SecurityToken other) => value.SequenceEqualOrNull(other.value);
2723

28-
/// <summary>
29-
/// Checks for equality between the current instance and another object.
30-
/// </summary>
31-
/// <param name="obj">The object to check for equality.</param>
32-
/// <returns>Returns <see langword="true"/> if the object is equal to the current instance; otherwise, <see langword="false"/>.</returns>
24+
/// <inheritdoc/>
3325
public override bool Equals(object? obj) => obj is SecurityToken other && Equals(other);
3426

35-
/// <summary>
36-
/// Serves as a hash code function for the current instance.
37-
/// </summary>
38-
/// <returns>Returns a hash code for the current instance.</returns>
27+
/// <inheritdoc/>
3928
public override int GetHashCode() => value.GetContentHashCode();
4029

41-
/// <summary>
42-
/// Performs an equality comparison between two object instances.
43-
/// </summary>
44-
/// <param name="left">The left-hand instance to compare.</param>
45-
/// <param name="right">The right-hand instance to compare.</param>
46-
/// <returns>Returns <see langword="true"/> if the left-hand instance is equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
30+
/// <inheritdoc/>
4731
public static bool operator ==(SecurityToken left, SecurityToken right) => left.Equals(right);
4832

49-
/// <summary>
50-
/// Performs an inequality comparison between two object instances.
51-
/// </summary>
52-
/// <param name="left">The left-hand instance to compare.</param>
53-
/// <param name="right">The right-hand instance to compare.</param>
54-
/// <returns>Returns <see langword="true"/> if the left-hand instance is not equal to the right-hand instance; otherwise, <see langword="false"/>.</returns>
33+
/// <inheritdoc/>
5534
public static bool operator !=(SecurityToken left, SecurityToken right) => !left.Equals(right);
5635
}

0 commit comments

Comments
 (0)