Пример #1
0
        public void Test_GetPreviousFileAsync_Previous_TooOld()
        {
            // the function should look for a file named previous change number, even if there's a gap, so here "1"
            var file = new ServiceTagFile()
            {
                ChangeNumber = "1"
            };
            var fileAsStream = AzureIpFileFunctions.StringToStream(AzureIpFileFunctions.SerializeFile(file));

            IStorageProvider mockStorageProvider = new MockStorageProviderReadBlobDoesExist(fileAsStream, "1");

            var changeNumber = "4"; // needs to be valid
            // expect file "1" - but implementation only goes back 2, so null
            var result = AzureIpFileFunctions.GetPreviousFileAsync(mockStorageProvider, "demo", changeNumber).Result;

            // found nothing
            Assert.Null(result);
        }
Пример #2
0
        public void Test_GetPreviousFileAsync_Previous_NonContiguous()
        {
            // the function should look for a file named previous change number, even if there's a gap, so here "1"
            var file = new ServiceTagFile()
            {
                ChangeNumber = "2"
            };
            var fileAsStream = AzureIpFileFunctions.StringToStream(AzureIpFileFunctions.SerializeFile(file));

            IStorageProvider mockStorageProvider = new MockStorageProviderReadBlobDoesExist(fileAsStream, "2");

            var changeNumber = "4"; // needs to be valid
            // expect file "2"
            var result = AzureIpFileFunctions.GetPreviousFileAsync(mockStorageProvider, "demo", changeNumber).Result;

            // found previous
            Assert.Equal(result.ChangeNumber, file.ChangeNumber);
        }