Skip to content

Commit 47ec32a

Browse files
author
Jani Giannoudis
committed
updated third party nugets
udapted to .net 9 updated version to 0.9.0-beta.1
1 parent 0ab174f commit 47ec32a

40 files changed

+144
-140
lines changed

.github/workflows/release.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v2
1414
- name: Setup .NET SDK
15-
uses: actions/setup-dotnet@v1
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: 9.0.x
1618
- name: Build
1719
run: dotnet build -c Release
1820
- name: Test

Client.Scripting.Tests/PayrollEngine.Client.Scripting.Tests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
12-
<PackageReference Include="xunit" Version="2.6.2" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
12+
<PackageReference Include="xunit" Version="2.9.3" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>

Client.Scripting/Cache/Cache.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected List<DateTime> GetConsolidatedPeriodStarts(PayrunFunction function, Co
7171
// test for valid cycle setup
7272
if (function.CycleStart != CycleStartDate)
7373
{
74-
throw new ScriptException($"Mismatching cache cycle dates: {function.CycleStart} vs {CycleStartDate}");
74+
throw new ScriptException($"Mismatching cache cycle dates: {function.CycleStart} vs {CycleStartDate}.");
7575
}
7676

7777
// forecast

Client.Scripting/CasePayrollValue.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public PeriodCasePayrollValueDictionary GetCaseValue(string caseFieldName)
8787
var periodValue = periodValues.Value[caseFieldName];
8888
if (periodValue == null)
8989
{
90-
throw new ScriptException($"Unknown case field {caseFieldName}");
90+
throw new ScriptException($"Unknown case field {caseFieldName}.");
9191
}
9292
values.Add(periodValues.Key, periodValue);
9393
}

Client.Scripting/CaseValue.cs

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public bool Equals(CaseValue compare)
102102
Value == compare.Value &&
103103
CancellationDate == compare.CancellationDate &&
104104
(Tags?.SequenceEqual(compare.Tags) ?? compare.Tags != null) &&
105+
// ReSharper disable once UsageOfDefaultStructEquality
105106
(Attributes?.SequenceEqual(compare.Attributes) ?? compare.Attributes != null);
106107
}
107108

Client.Scripting/ClientScript.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public TValue this[TKey key]
235235
{
236236
if (SetValueHandler == null)
237237
{
238-
throw new ScriptException($"Write operation on read-only scripting dictionary: {key}={value} ");
238+
throw new ScriptException($"Write operation on read-only scripting dictionary: {key}={value}.");
239239
}
240240
SetValueHandler(key, value);
241241
}

Client.Scripting/Extensions.cs

+26-26
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public static bool IsNumericType(this Type type)
4444
public static class NullableExtensions
4545
{
4646
/// <summary>Safe nullable boolean cast</summary>
47-
public static bool Safe(this bool? value, bool defaultValue = default) =>
47+
public static bool Safe(this bool? value, bool defaultValue = false) =>
4848
value ?? defaultValue;
4949

5050
/// <summary>Safe nullable int cast</summary>
51-
public static int Safe(this int? value, int defaultValue = default) =>
51+
public static int Safe(this int? value, int defaultValue = 0) =>
5252
value ?? defaultValue;
5353

5454
/// <summary>Safe nullable decimal cast</summary>
55-
public static decimal Safe(this decimal? value, decimal defaultValue = default) =>
55+
public static decimal Safe(this decimal? value, decimal defaultValue = 0) =>
5656
value ?? defaultValue;
5757

5858
/// <summary>Safe nullable DateTime cast</summary>
@@ -336,13 +336,13 @@ public static Tuple<string, string> ToRelatedCaseNames(this string caseRelation)
336336
{
337337
if (string.IsNullOrWhiteSpace(caseRelation))
338338
{
339-
return default;
339+
return null;
340340
}
341341

342342
var relatedCases = caseRelation.Split(RelatedCaseSeparator, StringSplitOptions.RemoveEmptyEntries);
343343
if (relatedCases.Length != 2)
344344
{
345-
throw new ArgumentException($"invalid case relation {caseRelation}, please use 'sourceCaseName:targetCaseName')");
345+
throw new ArgumentException($"invalid case relation {caseRelation}, please use 'sourceCaseName:targetCaseName').");
346346
}
347347
return new(relatedCases[0], relatedCases[1]);
348348
}
@@ -355,11 +355,11 @@ public static string ToCaseRelationKey(this string sourceCaseName, string target
355355
{
356356
if (string.IsNullOrWhiteSpace(sourceCaseName))
357357
{
358-
return default;
358+
return null;
359359
}
360360
if (string.IsNullOrWhiteSpace(targetCaseName))
361361
{
362-
return default;
362+
return null;
363363
}
364364

365365
return $"{sourceCaseName}{RelatedCaseSeparator}{targetCaseName}";
@@ -467,21 +467,21 @@ public static bool IsWithin(this decimal? value, decimal min, decimal max) =>
467467
/// <param name="stepSize">The step size used to truncate</param>
468468
/// <returns>The result of d rounded toward zero, to the nearest whole number within the step size</returns>
469469
public static decimal Truncate(this decimal value, int stepSize) =>
470-
value == default ? default : value - (value % stepSize);
470+
value == 0 ? 0 : value - (value % stepSize);
471471

472472
/// <summary>Rounds a decimal value up</summary>
473473
/// <param name="value">The decimal value to round</param>
474474
/// <param name="stepSize">The round step size</param>
475475
/// <returns>The up-rounded value</returns>
476476
public static decimal RoundUp(this decimal value, decimal stepSize) =>
477-
value == default || stepSize == 0 ? value : Math.Ceiling(value / stepSize) * stepSize;
477+
value == 0 || stepSize == 0 ? value : Math.Ceiling(value / stepSize) * stepSize;
478478

479479
/// <summary>Rounds a decimal value down</summary>
480480
/// <param name="value">The decimal value to round</param>
481481
/// <param name="stepSize">The round step size</param>
482482
/// <returns>The rounded value</returns>
483483
public static decimal RoundDown(this decimal value, decimal stepSize) =>
484-
value == default || stepSize == 0 ? value : Math.Floor(value / stepSize) * stepSize;
484+
value == 0 || stepSize == 0 ? value : Math.Floor(value / stepSize) * stepSize;
485485

486486
/// <summary>Rounds a decimal value wit predefined rounding type</summary>
487487
/// <param name="value">The decimal value to round</param>
@@ -542,7 +542,7 @@ public static decimal RoundHundredth(this decimal value) =>
542542
/// <param name="divisor">The divisor factor</param>
543543
/// <returns>The rounded value to one-tenth</returns>
544544
public static decimal RoundPartOfOne(this decimal value, int divisor) =>
545-
value == default ? default : Math.Round(value * divisor, MidpointRounding.AwayFromZero) / divisor;
545+
value == 0 ? 0 : Math.Round(value * divisor, MidpointRounding.AwayFromZero) / divisor;
546546
}
547547

548548
/// <summary><see cref="DateTime">DateTime</see> extension methods</summary>
@@ -645,7 +645,7 @@ public static DateTime ToUtc(this DateTime moment)
645645
// convert to utc
646646
return moment.ToUniversalTime();
647647
default:
648-
throw new ArgumentOutOfRangeException($"Unknown date time kind {moment.Kind}");
648+
throw new ArgumentOutOfRangeException($"Unknown date time kind {moment.Kind}.");
649649
}
650650
}
651651

@@ -667,7 +667,7 @@ public static DateTime ToUtcTime(this DateTime moment)
667667
// convert to utc
668668
return moment.ToUniversalTime();
669669
default:
670-
throw new ArgumentOutOfRangeException($"Unknown date time kind {moment.Kind}");
670+
throw new ArgumentOutOfRangeException($"Unknown date time kind {moment.Kind}.");
671671
}
672672
}
673673

@@ -991,7 +991,7 @@ public static int Age(this DateTime birthDate, DateTime testMoment)
991991
{
992992
if (testMoment <= birthDate)
993993
{
994-
throw new ArgumentOutOfRangeException(nameof(testMoment), "calculate age: birth-date must be older than test-date");
994+
throw new ArgumentOutOfRangeException(nameof(testMoment), "calculate age: birth-date must be older than test-date.");
995995
}
996996
var age = testMoment.Year - birthDate.Year;
997997
// leap years
@@ -1033,7 +1033,7 @@ public static bool IsLastMomentOfDay(this DateTime moment) =>
10331033
public static DateTime RoundUp(this DateTime dateTime, TimeSpan stepSize)
10341034
{
10351035
var modTicks = dateTime.Ticks % stepSize.Ticks;
1036-
var delta = modTicks != default ? stepSize.Ticks - modTicks : 0;
1036+
var delta = modTicks != 0 ? stepSize.Ticks - modTicks : 0;
10371037
return delta != 0 ? new(dateTime.Ticks + delta, dateTime.Kind) : dateTime;
10381038
}
10391039

@@ -1044,7 +1044,7 @@ public static DateTime RoundUp(this DateTime dateTime, TimeSpan stepSize)
10441044
public static DateTime RoundDown(this DateTime dateTime, TimeSpan stepSize)
10451045
{
10461046
var delta = dateTime.Ticks % stepSize.Ticks;
1047-
return delta != default ? new(dateTime.Ticks - delta, dateTime.Kind) : dateTime;
1047+
return delta != 0 ? new(dateTime.Ticks - delta, dateTime.Kind) : dateTime;
10481048
}
10491049

10501050
/// <summary>Rounds a date time to the nearest value</summary>
@@ -1054,7 +1054,7 @@ public static DateTime RoundDown(this DateTime dateTime, TimeSpan stepSize)
10541054
public static DateTime Round(this DateTime dateTime, TimeSpan stepSize)
10551055
{
10561056
var delta = dateTime.Ticks % stepSize.Ticks;
1057-
if (delta == default)
1057+
if (delta == 0)
10581058
{
10591059
return dateTime;
10601060
}
@@ -1193,7 +1193,7 @@ public static class DictionaryExtensions
11931193
/// <param name="key">The value key</param>
11941194
/// <param name="defaultValue">The default value</param>
11951195
/// <returns>The dictionary value</returns>
1196-
public static object GetValue(this Dictionary<string, object> dictionary, string key, object defaultValue = default)
1196+
public static object GetValue(this Dictionary<string, object> dictionary, string key, object defaultValue = null)
11971197
{
11981198
if (!dictionary.TryGetValue(key, out var value))
11991199
{
@@ -1238,7 +1238,7 @@ public static class TimeSpanExtensions
12381238
public static TimeSpan RoundUp(this TimeSpan timeSpan, TimeSpan stepSize)
12391239
{
12401240
var modTicks = timeSpan.Ticks % stepSize.Ticks;
1241-
var delta = modTicks != default ? stepSize.Ticks - modTicks : 0;
1241+
var delta = modTicks != 0 ? stepSize.Ticks - modTicks : 0;
12421242
return delta != 0 ? new(timeSpan.Ticks + delta) : timeSpan;
12431243
}
12441244

@@ -1249,7 +1249,7 @@ public static TimeSpan RoundUp(this TimeSpan timeSpan, TimeSpan stepSize)
12491249
public static TimeSpan RoundDown(this TimeSpan timeSpan, TimeSpan stepSize)
12501250
{
12511251
var delta = timeSpan.Ticks % stepSize.Ticks;
1252-
return delta != default ? new(timeSpan.Ticks - delta) : timeSpan;
1252+
return delta != 0 ? new(timeSpan.Ticks - delta) : timeSpan;
12531253
}
12541254

12551255
/// <summary>Rounds a time interval to the nearest value</summary>
@@ -1259,7 +1259,7 @@ public static TimeSpan RoundDown(this TimeSpan timeSpan, TimeSpan stepSize)
12591259
public static TimeSpan Round(this TimeSpan timeSpan, TimeSpan stepSize)
12601260
{
12611261
var delta = timeSpan.Ticks % stepSize.Ticks;
1262-
if (delta == default)
1262+
if (delta == 0)
12631263
{
12641264
return timeSpan;
12651265
}
@@ -2137,7 +2137,7 @@ public static Type GetDataType(this ValueType valueType)
21372137
{
21382138
return typeof(DBNull);
21392139
}
2140-
throw new ScriptException($"Unknown value type {valueType}");
2140+
throw new ScriptException($"Unknown value type {valueType}.");
21412141
}
21422142

21432143
/// <summary>Get the value type</summary>
@@ -2181,15 +2181,15 @@ public static object JsonToValue(this ValueType valueType, string json)
21812181

21822182
if (valueType.IsInteger())
21832183
{
2184-
return string.IsNullOrWhiteSpace(json) ? default : JsonSerializer.Deserialize<int>(json);
2184+
return string.IsNullOrWhiteSpace(json) ? 0 : JsonSerializer.Deserialize<int>(json);
21852185
}
21862186
if (valueType.IsDecimal())
21872187
{
2188-
return string.IsNullOrWhiteSpace(json) ? default : JsonSerializer.Deserialize<decimal>(json);
2188+
return string.IsNullOrWhiteSpace(json) ? 0 : JsonSerializer.Deserialize<decimal>(json);
21892189
}
21902190
if (valueType.IsString())
21912191
{
2192-
return string.IsNullOrWhiteSpace(json) ? default :
2192+
return string.IsNullOrWhiteSpace(json) ? null :
21932193
json.StartsWith('"') ? JsonSerializer.Deserialize<string>(json) : json;
21942194
}
21952195
if (valueType.IsDateTime())
@@ -2207,7 +2207,7 @@ public static object JsonToValue(this ValueType valueType, string json)
22072207
{
22082208
return null;
22092209
}
2210-
throw new ScriptException($"unknown value type {valueType}");
2210+
throw new ScriptException($"unknown value type {valueType}.");
22112211
}
22122212
}
22132213

Client.Scripting/Function/CaseAction.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ protected void RegisterFunction(string name, ActionValueType valueType, Func<TVa
419419
{
420420
if (valueFunctions.ContainsKey(name))
421421
{
422-
throw new ScriptException($"Duplicated action value function: {name}");
422+
throw new ScriptException($"Duplicated action value function: {name}.");
423423
}
424424
valueFunctions.Add(name, new(valueType, evaluate));
425425
}
@@ -428,7 +428,7 @@ private Tuple<ActionValueType, Func<TValue, object>> GetValueFunction()
428428
{
429429
if (!valueFunctions.TryGetValue(Name, out var function))
430430
{
431-
throw new ScriptException($"Missing action function {Name}");
431+
throw new ScriptException($"Missing action function {Name}.");
432432
}
433433
return function;
434434
}
@@ -516,7 +516,7 @@ protected bool TryGetParameter<T>(int index, out T result)
516516
case ActionValueSource.ValueAttribute:
517517
case ActionValueSource.Lookup:
518518
case ActionValueSource.RangeLookup:
519-
throw new ScriptException("No parameter support for case value attributes");
519+
throw new ScriptException("No parameter support for case value attributes.");
520520
}
521521

522522
if (value == null)
@@ -2264,18 +2264,18 @@ public ActionValueType GetValueType()
22642264
case ActionValueSource.ValueAttribute:
22652265
if (!AttributeType.HasValue)
22662266
{
2267-
throw new ScriptException("Missing case field or value attribute");
2267+
throw new ScriptException("Missing case field or value attribute.");
22682268
}
22692269
return AttributeType.Value;
22702270
case ActionValueSource.Lookup:
22712271
case ActionValueSource.RangeLookup:
22722272
if (!LookupType.HasValue)
22732273
{
2274-
throw new ScriptException("Missing lookup value attribute");
2274+
throw new ScriptException("Missing lookup value attribute.");
22752275
}
22762276
return LookupType.Value;
22772277
default:
2278-
throw new ScriptException($"Unsupported value type {ValueSource}");
2278+
throw new ScriptException($"Unsupported value type {ValueSource}.");
22792279
}
22802280
}
22812281

@@ -2304,7 +2304,7 @@ private TValue GetResolvedValue()
23042304
{
23052305
case ActionValueReferenceType.CaseChange:
23062306
case ActionValueReferenceType.CaseValue:
2307-
value = CaseValue?.Value != null ? CaseValue.Value.Value : default;
2307+
value = CaseValue?.Value != null ? CaseValue.Value.Value : null;
23082308
break;
23092309
default:
23102310
value = SourceValue;
@@ -2319,7 +2319,7 @@ private TValue GetResolvedValue()
23192319
value = CaseValue?.Start;
23202320
break;
23212321
default:
2322-
throw new ScriptException("Start mode not allowed");
2322+
throw new ScriptException("Start mode not allowed.");
23232323
}
23242324
break;
23252325
case ActionValueSource.End:
@@ -2330,7 +2330,7 @@ private TValue GetResolvedValue()
23302330
value = CaseValue?.End;
23312331
break;
23322332
default:
2333-
throw new ScriptException("End mode not allowed");
2333+
throw new ScriptException("End mode not allowed.");
23342334
}
23352335
break;
23362336
case ActionValueSource.Period:
@@ -2344,7 +2344,7 @@ private TValue GetResolvedValue()
23442344
}
23452345
break;
23462346
default:
2347-
throw new ScriptException("End mode not allowed");
2347+
throw new ScriptException("End mode not allowed.");
23482348
}
23492349
break;
23502350
case ActionValueSource.FieldAttribute:
@@ -2742,7 +2742,7 @@ protected CaseActionsBase()
27422742
var attribute = GetType().GetCustomAttribute<ActionProviderAttribute>();
27432743
if (attribute == null)
27442744
{
2745-
throw new ScriptException($"Missing action provider attribute on type {GetType()}");
2745+
throw new ScriptException($"Missing action provider attribute on type {GetType()}.");
27462746
}
27472747
Namespace = attribute.Namespace;
27482748
}

Client.Scripting/Function/CaseAvailableFunction.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected static CaseAvailableActionValue<TValue> GetSourceActionValue<TValue>(C
5353
{
5454
if (string.IsNullOrWhiteSpace(source))
5555
{
56-
throw new ArgumentException("Invalid case available source", nameof(source));
56+
throw new ArgumentException("Invalid case available source.", nameof(source));
5757
}
5858

5959
try
@@ -63,7 +63,7 @@ protected static CaseAvailableActionValue<TValue> GetSourceActionValue<TValue>(C
6363
catch (Exception exception)
6464
{
6565
context.Function.LogError($"Invalid case field name {source}: {exception.GetBaseException().Message}");
66-
return default;
66+
return null;
6767
}
6868
}
6969

@@ -83,7 +83,7 @@ protected static CaseAvailableActionValue<TValue> GetActionValue<TValue>(CaseAva
8383
catch (Exception exception)
8484
{
8585
context.Function.LogError($"Invalid case action value {value}: {exception.GetBaseException().Message}");
86-
return default;
86+
return null;
8787
}
8888
}
8989

@@ -147,7 +147,7 @@ public string[] GetAvailableActions() =>
147147
// ReSharper restore EmptyRegion
148148

149149
// compiler will optimize this out if the code provides a return
150-
return default;
150+
return null;
151151
}
152152

153153
private bool InvokeAvailableActions()

0 commit comments

Comments
 (0)