From 1d2485be881eb8967e5cbe861e9d823dd645af6a Mon Sep 17 00:00:00 2001 From: Sakari Malkki Date: Wed, 11 Sep 2024 12:53:56 +0300 Subject: [PATCH] Update documentation on relevant parts and fix sonar complaint from tests --- .../PxFileStreamDataReaderTests/AsyncDataReaderTests.cs | 6 +++--- .../Validation/DataValidation/DataValidatorFunctions.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Px.Utils.UnitTests/PxFileTests/DataTests/PxFileStreamDataReaderTests/AsyncDataReaderTests.cs b/Px.Utils.UnitTests/PxFileTests/DataTests/PxFileStreamDataReaderTests/AsyncDataReaderTests.cs index 24dc2c6e..c9efbd6b 100644 --- a/Px.Utils.UnitTests/PxFileTests/DataTests/PxFileStreamDataReaderTests/AsyncDataReaderTests.cs +++ b/Px.Utils.UnitTests/PxFileTests/DataTests/PxFileStreamDataReaderTests/AsyncDataReaderTests.cs @@ -165,7 +165,7 @@ public async Task CancelReadDoubleDataValuesAsyncValidIntegersIsCancelled() DataIndexer indexer = new(testMeta, matrixMap); using CancellationTokenSource cts = new(); - cts.Cancel(); + await cts.CancelAsync(); CancellationToken cToken = cts.Token; async Task call() => await reader.ReadDoubleDataValuesAsync(targetBuffer, 0, indexer, cToken); @@ -224,7 +224,7 @@ public async Task CancelReadAddDecimalDataValuesAsyncValidIntegersIsCancelled() DataIndexer indexer = new(testMeta, matrixMap); using CancellationTokenSource cts = new(); - cts.Cancel(); + await cts.CancelAsync(); CancellationToken cToken = cts.Token; async Task call() => await reader.ReadDecimalDataValuesAsync(targetBuffer, 0, indexer, cToken); @@ -283,7 +283,7 @@ public async Task CancelReadUnsafeDoubleValuesAsyncValidIntegersIsCancelled() DataIndexer indexer = new(testMeta, matrixMap); using CancellationTokenSource cts = new(); - cts.Cancel(); + await cts.CancelAsync(); CancellationToken cToken = cts.Token; // Act and Assert diff --git a/Px.Utils/Validation/DataValidation/DataValidatorFunctions.cs b/Px.Utils/Validation/DataValidation/DataValidatorFunctions.cs index 131eaaa8..51370520 100644 --- a/Px.Utils/Validation/DataValidation/DataValidatorFunctions.cs +++ b/Px.Utils/Validation/DataValidation/DataValidatorFunctions.cs @@ -25,7 +25,7 @@ public class DataStringValidator : IDataValidator /// Encoding format of the Px file. /// Line number for the validation item. /// Represents the position relative to the line for the validation item. - /// object if the entry is not a missing value string sequence, otherwise null. + /// Key value pair containing information about the rule violation if the entry is not a missing value string sequence, otherwise null. public KeyValuePair? Validate(List entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename) { string value = encoding.GetString(entry.ToArray()); @@ -56,7 +56,7 @@ public class DataNumberValidator : IDataValidator /// Encoding format of the Px file. /// Line number for the validation item. /// Represents the position relative to the line for the validation item. - /// object if the entry is not a valid number, otherwise null. + /// Key value pair containing information about the rule violation if the entry is not a valid number, otherwise null. public KeyValuePair? Validate(List entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename) { if (entry.Count >= MaxLength && !decimal.TryParse(entry.ToArray(), out _)) @@ -138,7 +138,7 @@ public class DataSeparatorValidator : IDataValidator /// Encoding format of the Px file. /// Line number for the validation item. /// Represents the position relative to the line for the validation item. - /// object if the entry is not a valid item separator, otherwise null. + /// Key value pair containing information about the rule violation if the entry is not a valid item separator, otherwise null. public KeyValuePair? Validate(List entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename) { if (_separator == entry[0]) @@ -182,7 +182,7 @@ public class DataStructureValidator : IDataValidator /// Line number for the validation item. /// Represents the position relative to the line for the validation item. /// Reference to a list of feedback items to which any validation feedback is added to. - /// object if the entry sequence is invalid. Otherwise null. + /// Key value pair containing information about the rule violation if the entry sequence is invalid. Otherwise null. public KeyValuePair? Validate(List entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename) { if (_allowedPreviousTokens[entryType].Contains(_previousTokenType))