// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.frontdoor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.frontdoor.models.ManagedRuleSet;
import com.azure.resourcemanager.frontdoor.models.ManagedRuleSetActionType;
import com.azure.resourcemanager.frontdoor.models.ManagedRuleSetList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ManagedRuleSetListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ManagedRuleSetList model =
            BinaryData
                .fromString(
                    "{\"managedRuleSets\":[{\"ruleSetType\":\"ryo\",\"ruleSetVersion\":\"psoacctazakljl\",\"ruleSetAction\":\"Log\",\"exclusions\":[],\"ruleGroupOverrides\":[]},{\"ruleSetType\":\"fdfdosygexpa\",\"ruleSetVersion\":\"jakhmsbzjh\",\"ruleSetAction\":\"Block\",\"exclusions\":[],\"ruleGroupOverrides\":[]},{\"ruleSetType\":\"hlxaolthqtr\",\"ruleSetVersion\":\"qjbpfzfsin\",\"ruleSetAction\":\"Block\",\"exclusions\":[],\"ruleGroupOverrides\":[]}]}")
                .toObject(ManagedRuleSetList.class);
        Assertions.assertEquals("ryo", model.managedRuleSets().get(0).ruleSetType());
        Assertions.assertEquals("psoacctazakljl", model.managedRuleSets().get(0).ruleSetVersion());
        Assertions.assertEquals(ManagedRuleSetActionType.LOG, model.managedRuleSets().get(0).ruleSetAction());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ManagedRuleSetList model =
            new ManagedRuleSetList()
                .withManagedRuleSets(
                    Arrays
                        .asList(
                            new ManagedRuleSet()
                                .withRuleSetType("ryo")
                                .withRuleSetVersion("psoacctazakljl")
                                .withRuleSetAction(ManagedRuleSetActionType.LOG)
                                .withExclusions(Arrays.asList())
                                .withRuleGroupOverrides(Arrays.asList()),
                            new ManagedRuleSet()
                                .withRuleSetType("fdfdosygexpa")
                                .withRuleSetVersion("jakhmsbzjh")
                                .withRuleSetAction(ManagedRuleSetActionType.BLOCK)
                                .withExclusions(Arrays.asList())
                                .withRuleGroupOverrides(Arrays.asList()),
                            new ManagedRuleSet()
                                .withRuleSetType("hlxaolthqtr")
                                .withRuleSetVersion("qjbpfzfsin")
                                .withRuleSetAction(ManagedRuleSetActionType.BLOCK)
                                .withExclusions(Arrays.asList())
                                .withRuleGroupOverrides(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(ManagedRuleSetList.class);
        Assertions.assertEquals("ryo", model.managedRuleSets().get(0).ruleSetType());
        Assertions.assertEquals("psoacctazakljl", model.managedRuleSets().get(0).ruleSetVersion());
        Assertions.assertEquals(ManagedRuleSetActionType.LOG, model.managedRuleSets().get(0).ruleSetAction());
    }
}
