Skip to content

Commit

Permalink
Updated dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
jscarle committed Dec 29, 2024
1 parent 62ef35e commit f121ced
Show file tree
Hide file tree
Showing 33 changed files with 121 additions and 122 deletions.
8 changes: 4 additions & 4 deletions ComparisonBenchmarks/Benchmarks.A_LightResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ private void SetupLightResults()

var enumerable = new List<Result>();
for (int i = 0; i < Iterations; i++)
enumerable.Add(random.Next(0, 1) == 0 ? Result.Ok() : Result.Fail(i.ToString()));
enumerable.Add(random.Next(0, 1) == 0 ? Result.Success() : Result.Failure(i.ToString()));
_lightResultsEnumerable = enumerable.AsEnumerable();

var readOnlyList = new List<Result>();
for (int i = 0; i < Iterations; i++)
readOnlyList.Add(random.Next(0, 1) == 0 ? Result.Ok() : Result.Fail(i.ToString()));
readOnlyList.Add(random.Next(0, 1) == 0 ? Result.Success() : Result.Failure(i.ToString()));
_lightResultsReadOnlyList = readOnlyList;

var enumerableT = new List<Result<int>>();
for (int i = 0; i < Iterations; i++)
enumerableT.Add(random.Next(0, 1) == 0 ? Result.Ok(i) : Result.Fail<int>(i.ToString()));
enumerableT.Add(random.Next(0, 1) == 0 ? Result.Success(i) : Result.Failure<int>(i.ToString()));
_lightResultsTValueEnumerable = enumerableT.AsEnumerable();

var readOnlyListT = new List<Result<int>>();
for (int i = 0; i < Iterations; i++)
readOnlyListT.Add(random.Next(0, 1) == 0 ? Result.Ok(i) : Result.Fail<int>(i.ToString()));
readOnlyListT.Add(random.Next(0, 1) == 0 ? Result.Success(i) : Result.Failure<int>(i.ToString()));
_lightResultsTValueReadOnlyList = readOnlyListT;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="LightResults" Version="8.0.10"/>
<PackageReference Include="LightResults" Version="8.0.11" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- References -->

<ItemGroup>
<PackageReference Include="LightResults" Version="8.0.10"/>
<PackageReference Include="LightResults" Version="8.0.11" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ namespace {symbolNamespace};
public static Result<{{symbolName}}> TryCreate({{declaredValueType}} value)
{
var validation = Validate(value);
if (validation.IsFailed(out var error))
return Result.Fail<{{symbolName}}>(error);
if (validation.IsFailure(out var error))
return Result.Failure<{{symbolName}}>(error);
return Result.Ok<{{symbolName}}>(new {{symbolName}}(value, true));
return Result.Success<{{symbolName}}>(new {{symbolName}}(value, true));
}
"""
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace {symbolNamespace};
if ({{declaredValueType}}.TryParse(s, out var value))
return TryCreate(value);
return Result.Fail<{{symbolName}}>("The string is not a valid identifier.");
return Result.Failure<{{symbolName}}>("The string is not a valid identifier.");
}
"""
Expand Down Expand Up @@ -644,7 +644,7 @@ public override string ToString()
source.AppendLine($$"""
private static Result Validate({{declaredValueType}} value)
{
return Result.Ok();
return Result.Success();
}
"""
);
Expand All @@ -653,9 +653,9 @@ private static Result Validate({{declaredValueType}} value)
private static Result Validate({{declaredValueType}} value)
{
if (string.IsNullOrWhiteSpace(value))
return Result.Fail("The value must not be empty.");
return Result.Failure("The value must not be empty.");
return Result.Ok();
return Result.Success();
}
"""
);
Expand All @@ -664,9 +664,9 @@ private static Result Validate({{declaredValueType}} value)
private static Result Validate({{declaredValueType}} value)
{
if (value < 0)
return Result.Fail("The value must be equal to or greater than zero.");
return Result.Failure("The value must be equal to or greater than zero.");
return Result.Ok();
return Result.Success();
}
"""
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

<!-- References -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageReference Include="PolySharp" Version="1.15.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" PrivateAssets="all" GeneratePathProperty="true"/>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="6.0.0" PrivateAssets="all" GeneratePathProperty="true"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all"/>
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.4.0.108396">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- References -->
<ItemGroup>
<PackageReference Include="LightResults" Version="9.0.0" />
<PackageReference Include="LightResults" Version="8.0.11" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/LightResults.Extensions.Json/ResultJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override Result Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
public override void Write(Utf8JsonWriter writer, Result value, JsonSerializerOptions options)
{
writer.WriteStartObject();
if (value.IsSuccess())
if (value.IsSuccess)
{
writer.WriteBoolean(IsSuccess, true);
}
Expand Down
4 changes: 2 additions & 2 deletions src/LightResults.Extensions.Json/ResultJsonConverter`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public override Result<TValue> Read(ref Utf8JsonReader reader, Type typeToConver
public override void Write(Utf8JsonWriter writer, Result<TValue> value, JsonSerializerOptions options)
{
writer.WriteStartObject();
if (value.IsSuccess(out var resultValue))
if (value.IsSuccess)
{
writer.WriteBoolean(IsSuccess, true);
WriteObject(writer, Value, resultValue);
WriteObject(writer, Value, value.Value);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Result Collect(this IEnumerable<Result> results)
errors.AddRange(next.Errors);
}

return errors is { Count: > 0 } ? Result.Fail(errors.AsReadOnly()) : Result.Ok();
return errors is { Count: > 0 } ? Result.Failure(errors.AsReadOnly()) : Result.Success();
}

/// <summary>Combine multiple results into a single result.</summary>
Expand Down Expand Up @@ -65,7 +65,7 @@ public static Result Collect(this IReadOnlyList<Result> results)
errors.AddRange(next.Errors);
}

return errors is { Count: > 0 } ? Result.Fail(errors.AsReadOnly()) : Result.Ok();
return errors is { Count: > 0 } ? Result.Failure(errors.AsReadOnly()) : Result.Success();
}

/// <summary>Combine multiple results into a single result.</summary>
Expand Down Expand Up @@ -106,7 +106,7 @@ public static Result<IReadOnlyList<TValue>> Collect<TValue>(this IEnumerable<Res

Debug.Assert(errors is { Count: > 0 } || values is not null);

return errors is { Count: > 0 } ? Result.Fail<IReadOnlyList<TValue>>(errors.AsReadOnly()) : Result.Ok<IReadOnlyList<TValue>>(values!.AsReadOnly());
return errors is { Count: > 0 } ? Result.Failure<IReadOnlyList<TValue>>(errors.AsReadOnly()) : Result.Success<IReadOnlyList<TValue>>(values!.AsReadOnly());
}

/// <summary>Combine multiple results into a single result.</summary>
Expand Down Expand Up @@ -146,6 +146,6 @@ public static Result<IReadOnlyList<TValue>> Collect<TValue>(this IReadOnlyList<R

Debug.Assert(errors is { Count: > 0 } || values is not null);

return errors is { Count: > 0 } ? Result.Fail<IReadOnlyList<TValue>>(errors.AsReadOnly()) : Result.Ok<IReadOnlyList<TValue>>(values!.AsReadOnly());
return errors is { Count: > 0 } ? Result.Failure<IReadOnlyList<TValue>>(errors.AsReadOnly()) : Result.Success<IReadOnlyList<TValue>>(values!.AsReadOnly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- References -->
<ItemGroup>
<PackageReference Include="LightResults" Version="9.0.0-preview.15" />
<PackageReference Include="LightResults" Version="9.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- References -->
<ItemGroup>
<PackageReference Include="LightResults" Version="9.0.0-preview.15"/>
<PackageReference Include="LightResults" Version="9.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public static Result<ValueObjectCollection<TValue>> TryParse(string s)
.IsSuccess(out var valueObject, out var error))
builder.Add(valueObject);
else
return Result.Fail<ValueObjectCollection<TValue>>(error);
return Result.Failure<ValueObjectCollection<TValue>>(error);
}
var values = new ValueObjectCollection<TValue>(builder.ToImmutable());
return Result.Ok(values);
return Result.Success(values);
}

public static bool TryParse(string s, out ValueObjectCollection<TValue> valueObjectCollection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void ThrowIfFailed(IResult result)
{
ArgumentNullException.ThrowIfNull(result);

if (result.IsFailed(out var error))
if (result.IsFailure(out var error))
throw new ValueObjectException(error.Message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="LightResults" Version="9.0.0-preview.15"/>
<PackageReference Include="LightResults" Version="9.0.0" />
<PackageReference Include="LightResults.Extensions.ValueObjects" Version="9.0.0-preview.3"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public readonly partial struct TestGuidId :
public static Result<TestGuidId> TryCreate(Guid value)
{
var validation = Validate(value);
if (validation.IsFailed(out var error))
return Result.Fail<TestGuidId>(error);
if (validation.IsFailure(out var error))
return Result.Failure<TestGuidId>(error);

return Result.Ok<TestGuidId>(new TestGuidId(value, true));
return Result.Success<TestGuidId>(new TestGuidId(value, true));
}

/// <inheritdoc />
Expand All @@ -79,7 +79,7 @@ public readonly partial struct TestGuidId :
if (Guid.TryParse(s, out var value))
return TryCreate(value);

return Result.Fail<TestGuidId>("The string is not a valid identifier.");
return Result.Failure<TestGuidId>("The string is not a valid identifier.");
}

/// <inheritdoc />
Expand Down Expand Up @@ -195,7 +195,7 @@ public readonly partial struct TestGuidId :

private static Result Validate(Guid value)
{
return Result.Ok();
return Result.Success();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public readonly partial struct TestGuidId :
public static Result<TestGuidId> TryCreate(Guid value)
{
var validation = Validate(value);
if (validation.IsFailed(out var error))
return Result.Fail<TestGuidId>(error);
if (validation.IsFailure(out var error))
return Result.Failure<TestGuidId>(error);

return Result.Ok<TestGuidId>(new TestGuidId(value, true));
return Result.Success<TestGuidId>(new TestGuidId(value, true));
}

/// <inheritdoc />
Expand All @@ -77,7 +77,7 @@ public readonly partial struct TestGuidId :
if (Guid.TryParse(s, out var value))
return TryCreate(value);

return Result.Fail<TestGuidId>("The string is not a valid identifier.");
return Result.Failure<TestGuidId>("The string is not a valid identifier.");
}

/// <inheritdoc />
Expand Down Expand Up @@ -193,7 +193,7 @@ public readonly partial struct TestGuidId :

private static Result Validate(Guid value)
{
return Result.Ok();
return Result.Success();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public readonly partial struct TestIntId :
public static Result<TestIntId> TryCreate(int value)
{
var validation = Validate(value);
if (validation.IsFailed(out var error))
return Result.Fail<TestIntId>(error);
if (validation.IsFailure(out var error))
return Result.Failure<TestIntId>(error);

return Result.Ok<TestIntId>(new TestIntId(value, true));
return Result.Success<TestIntId>(new TestIntId(value, true));
}

/// <inheritdoc />
Expand All @@ -79,7 +79,7 @@ public readonly partial struct TestIntId :
if (int.TryParse(s, out var value))
return TryCreate(value);

return Result.Fail<TestIntId>("The string is not a valid identifier.");
return Result.Failure<TestIntId>("The string is not a valid identifier.");
}

/// <inheritdoc />
Expand Down Expand Up @@ -196,9 +196,9 @@ public readonly partial struct TestIntId :
private static Result Validate(int value)
{
if (value < 0)
return Result.Fail("The value must be equal to or greater than zero.");
return Result.Failure("The value must be equal to or greater than zero.");

return Result.Ok();
return Result.Success();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public readonly partial struct TestIntId :
public static Result<TestIntId> TryCreate(int value)
{
var validation = Validate(value);
if (validation.IsFailed(out var error))
return Result.Fail<TestIntId>(error);
if (validation.IsFailure(out var error))
return Result.Failure<TestIntId>(error);

return Result.Ok<TestIntId>(new TestIntId(value, true));
return Result.Success<TestIntId>(new TestIntId(value, true));
}

/// <inheritdoc />
Expand All @@ -77,7 +77,7 @@ public readonly partial struct TestIntId :
if (int.TryParse(s, out var value))
return TryCreate(value);

return Result.Fail<TestIntId>("The string is not a valid identifier.");
return Result.Failure<TestIntId>("The string is not a valid identifier.");
}

/// <inheritdoc />
Expand Down Expand Up @@ -194,9 +194,9 @@ public readonly partial struct TestIntId :
private static Result Validate(int value)
{
if (value < 0)
return Result.Fail("The value must be equal to or greater than zero.");
return Result.Failure("The value must be equal to or greater than zero.");

return Result.Ok();
return Result.Success();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public readonly partial struct TestLongId :
public static Result<TestLongId> TryCreate(long value)
{
var validation = Validate(value);
if (validation.IsFailed(out var error))
return Result.Fail<TestLongId>(error);
if (validation.IsFailure(out var error))
return Result.Failure<TestLongId>(error);

return Result.Ok<TestLongId>(new TestLongId(value, true));
return Result.Success<TestLongId>(new TestLongId(value, true));
}

/// <inheritdoc />
Expand All @@ -79,7 +79,7 @@ public readonly partial struct TestLongId :
if (long.TryParse(s, out var value))
return TryCreate(value);

return Result.Fail<TestLongId>("The string is not a valid identifier.");
return Result.Failure<TestLongId>("The string is not a valid identifier.");
}

/// <inheritdoc />
Expand Down Expand Up @@ -196,9 +196,9 @@ public readonly partial struct TestLongId :
private static Result Validate(long value)
{
if (value < 0)
return Result.Fail("The value must be equal to or greater than zero.");
return Result.Failure("The value must be equal to or greater than zero.");

return Result.Ok();
return Result.Success();
}
}

Expand Down
Loading

0 comments on commit f121ced

Please sign in to comment.