[QUERY] Is it possible to set LastModified property from BlobContainerProperties?
See original GitHub issueQuery/Question
I want to unit test a logic in my code. The logic gets a BlobContainerClient from the storage, get all blobs from it, and then filter the blobs for those who last modified date is before last week and delete those. I have somethind as the following:
var blobContainerClient = storageWrapper.GetContainerReference(_connectionString, containerName); //returns a BlobContainerClient
var dateLastWeek = DateTime.Now.AddDays(-7);
var desiredBlobs = blobContainerClient
.GetBlobs()
.ToList()
.Where(x => x.Properties.LastModified < dateLastWeek)
.ToList();
But then I realized that the BlobContainerProperties.LastModified is a get only property, and non virtual (so I can’t mock it’s return).
Is there a way to create one of these objects with the LastModified date so I can use it in my test logic?
Environment:
- .Net Version: Full Framework 4.8
- New version: Azure.Storage.Blobs v12.8.0
- IDE and version : Visual Studio 16.8.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Update LastModified on an Azure Blob
Azure allows you to add METADATA to the containers and blobs. LastModified is an internal property and there is no point to let...
Read more >How to get "LastModifiedDate" for a file in Azure Blob ...
I have a variable called results which has a couple methods, main one being LastUpdatedDate which should be set to the LastModifiedDate from ......
Read more >Five recommendations to amplify your Azure Storage Blobs ...
Azure storage blob container: In this blog, we will learn about how Cerebrata can be used to amplify your Azure Blobs Storage.
Read more >Microsoft Azure Blob Storage connector
This connector has the following properties ((Get operation only) for output documents that you can set or reference in various step parameters.
Read more >Azure Blob Storage
The Azure Blob Storage origin reads objects in ascending order based on the object name or the last modified timestamp. For best performance...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Mocking.md#creating-a-mock-of-the-method-that-returns-pageable has an example of mocking
Pageable<T>
.It worked! Thank you very much 😃