Exemplo n.º 1
0
        public async Task CanSetTagProperties()
        {
            // Arrange
            ContainerRepositoryClient client = CreateClient();
            string        tag           = "latest";
            TagProperties tagProperties = await client.GetTagPropertiesAsync(tag);

            ContentProperties originalContentProperties = tagProperties.WriteableProperties;

            // Act
            await client.SetTagPropertiesAsync(
                tag,
                new ContentProperties()
            {
                CanList   = false,
                CanRead   = false,
                CanWrite  = false,
                CanDelete = false
            });

            // Assert
            TagProperties properties = await client.GetTagPropertiesAsync(tag);

            Assert.IsFalse(properties.WriteableProperties.CanList);
            Assert.IsFalse(properties.WriteableProperties.CanRead);
            Assert.IsFalse(properties.WriteableProperties.CanWrite);
            Assert.IsFalse(properties.WriteableProperties.CanDelete);

            // Cleanup
            await client.SetTagPropertiesAsync(tag, originalContentProperties);
        }
        public async Task InitializeTagProperties()
        {
            await _client.SetTagPropertiesAsync(
                _tagName,
                new ContentProperties()
            {
                CanList   = true,
                CanRead   = true,
                CanWrite  = true,
                CanDelete = true
            });

            RepositoryProperties properties = await _client.GetPropertiesAsync();

            Assert.IsTrue(properties.WriteableProperties.CanList);
            Assert.IsTrue(properties.WriteableProperties.CanRead);
            Assert.IsTrue(properties.WriteableProperties.CanWrite);
            Assert.IsTrue(properties.WriteableProperties.CanDelete);
        }