public void Test_SignedAccessConfig()
        {
            // Arrange
            var testPermissions = new List <AccessPermission> {
                AccessPermission.Write, AccessPermission.Read
            };
            var testExpiry = DateTimeOffset.UtcNow.AddDays(7);

            // Act
            var testAccessConfig = new SignedAccessConfig(testPermissions, testExpiry);

            // Assert
            Assert.NotNull(testAccessConfig);
            Assert.Equal(testPermissions, testAccessConfig.AccessPermissions);
            Assert.Equal(testExpiry, testAccessConfig.AccessExpiry);
        }
Пример #2
0
        public void Test_StorageQueue_GetSignedAccessUrl_IncorrectPermissions()
        {
            var testQueue    = GetMessengerClient("testqueue");
            var oneDayExpiry = DateTime.UtcNow.AddDays(1);

            var config = new SignedAccessConfig(new List <AccessPermission> {
                AccessPermission.List
            }, oneDayExpiry);

            var accessUrl = testQueue.GetSignedAccessUrl(config);

            //Assertions
            Assert.NotNull(accessUrl);
            Assert.Contains(oneDayExpiry.Date.ToString("yyyy-MM-dd"), accessUrl);
            Assert.DoesNotContain("sp=", accessUrl);
            Assert.Contains("testqueue", accessUrl);
        }