Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#668 Actually return parameters #670

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,6 @@ codeunit 8956 "AFS Optional Parameters"

internal procedure GetParameters(): Dictionary of [Text, Text]
begin
AFSOptionalParametersImpl.GetParameters();
exit(AFSOptionalParametersImpl.GetParameters());
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading