diff --git a/src/System Application/App/Azure File Services API/src/AFSOptionalParameters.Codeunit.al b/src/System Application/App/Azure File Services API/src/AFSOptionalParameters.Codeunit.al index 9ba32c0bb0..e7ea825906 100644 --- a/src/System Application/App/Azure File Services API/src/AFSOptionalParameters.Codeunit.al +++ b/src/System Application/App/Azure File Services API/src/AFSOptionalParameters.Codeunit.al @@ -332,6 +332,6 @@ codeunit 8956 "AFS Optional Parameters" internal procedure GetParameters(): Dictionary of [Text, Text] begin - AFSOptionalParametersImpl.GetParameters(); + exit(AFSOptionalParametersImpl.GetParameters()); end; } \ No newline at end of file diff --git a/src/System Application/Test/Azure File Services API/src/AFSFileClientTest.Codeunit.al b/src/System Application/Test/Azure File Services API/src/AFSFileClientTest.Codeunit.al index 5ae1538c01..08b6514bb0 100644 --- a/src/System Application/Test/Azure File Services API/src/AFSFileClientTest.Codeunit.al +++ b/src/System Application/Test/Azure File Services API/src/AFSFileClientTest.Codeunit.al @@ -105,6 +105,52 @@ codeunit 132520 "AFS File Client Test" LibraryAssert.RecordIsNotEmpty(AFSDirectoryContent); end; + [Test] + procedure ListDirectoryWithTimestampsAndEtagTest() + var + AFSDirectoryContent: Record "AFS Directory Content"; + AFSFileClient: Codeunit "AFS File Client"; + AFSOperationResponse: Codeunit "AFS Operation Response"; + AFSOptionalParameters: Codeunit "AFS Optional Parameters"; + IncludeProperties: List of [Enum "AFS Property"]; + begin + // [SCENARIO] User wants to see files in the directory including timestamps and etag. + + // [GIVEN] A storage account with a file share and a preset file structure + // -- parentdir + // -- test.txt + // -- test2.txt + // -- deeperdir + // -- test3.txt + // -- test4.txt + // -- anotherdir + // -- image.jpg + // -- document.pdf + // -- spreadsheet.xlsx + // -- emptydir + AFSInitTestStorage.ClearFileShare(); + SharedKeyAuthorization := AFSGetTestStorageAuth.GetDefaultAccountSAS(AFSInitTestStorage.GetAccessKey()); + InitializeFileShareStructure(); + + // [GIVEN] Optional parameters for the list operation + IncludeProperties.Add(Enum::"AFS Property"::Timestamps); + IncludeProperties.Add(Enum::"AFS Property"::ETag); + AFSOptionalParameters.Include(IncludeProperties); + + // [WHEN] The programmer runs a list operation on the anotherdir/ directory with the parameters requesting timestamps and etag + AFSFileClient.Initialize(AFSInitTestStorage.GetStorageAccountName(), AFSInitTestStorage.GetFileShareName(), SharedKeyAuthorization); + AFSOperationResponse := AFSFileClient.ListDirectory('anotherdir/', AFSDirectoryContent, AFSOptionalParameters); + LibraryAssert.IsTrue(AFSOperationResponse.IsSuccessful(), AFSOperationResponse.GetError()); + + // [THEN] Directory and file entries must contain timestamps and etag + AFSDirectoryContent.FindSet(); + + repeat + LibraryAssert.AreNotEqual(0DT, AFSDirectoryContent."Creation Time", 'Timestamp CreationTime must be set'); + LibraryAssert.AreNotEqual('', AFSDirectoryContent.Etag, 'Etag must be set'); + until AFSDirectoryContent.Next() = 0; + end; + [Test] procedure CreateAndGetFileInDirectoryTest() var