public async Task PutLifecycleConfigurationWithLogicalAndTest(S3Provider provider, string _, ISimpleClient client)
    {
        await CreateTempBucketAsync(provider, client, async tempBucket =>
        {
            S3AndCondition conditions = new S3AndCondition();
            conditions.Prefix         = "temp/";
            conditions.Tags.Add(new KeyValuePair <string, string>("Type1", "Temp1"));
            conditions.Tags.Add(new KeyValuePair <string, string>("Type2", "Temp2"));

            S3Filter filter      = new S3Filter();
            filter.AndConditions = conditions;

            S3Rule rule     = new S3Rule("Test logical and", true);
            rule.Filter     = filter;
            rule.Expiration = new S3Expiration(DateTimeOffset.UtcNow.AddDays(1));

            PutBucketLifecycleConfigurationResponse putResp = await client.PutBucketLifecycleConfigurationAsync(tempBucket, new[] { rule }).ConfigureAwait(false);
            Assert.True(putResp.IsSuccess);

            GetBucketLifecycleConfigurationResponse getResp = await client.GetBucketLifecycleConfigurationAsync(tempBucket).ConfigureAwait(false);
            Assert.True(getResp.IsSuccess);

            S3Rule?rule1 = Assert.Single(getResp.Rules);
            S3AndCondition?conditions1 = rule1.Filter?.AndConditions;

            Assert.NotNull(conditions1);
            Assert.Equal(conditions.Prefix, conditions1 !.Prefix);
            Assert.Equal(conditions.Tags, conditions1.Tags);
        }).ConfigureAwait(false);
    }
    private static S3AndCondition ReadAndCondition(XmlReader xmlReader)
    {
        string?prefix = null;
        IList <KeyValuePair <string, string> > tags = new List <KeyValuePair <string, string> >();

        foreach (string name in XmlHelper.ReadElements(xmlReader, "And"))
        {
            switch (name)
            {
            case "Prefix":
                prefix = xmlReader.ReadString();
                break;

            case "Tag":
                tags.Add(ReadTag(xmlReader));
                break;
            }
        }

        if (prefix == null && tags.Count == 0)
        {
            throw new InvalidOperationException("Missing required values");
        }

        S3AndCondition condition = new S3AndCondition();

        condition.Prefix = prefix;
        condition.Tags   = tags;
        return(condition);
    }