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

package com.azure.resourcemanager.kusto.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kusto.fluent.models.AttachedDatabaseConfigurationInner;
import com.azure.resourcemanager.kusto.models.AttachedDatabaseConfigurationListResult;
import com.azure.resourcemanager.kusto.models.DefaultPrincipalsModificationKind;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AttachedDatabaseConfigurationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AttachedDatabaseConfigurationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"location\":\"xysmoc\",\"properties\":{\"provisioningState\":\"Running\",\"databaseName\":\"qvmkcxo\",\"clusterResourceId\":\"apvhelxprgly\",\"attachedDatabaseNames\":[],\"defaultPrincipalsModificationKind\":\"Replace\",\"databaseNameOverride\":\"kcbcue\",\"databaseNamePrefix\":\"jxgciqibrh\"},\"id\":\"sxsdqrhzoymibm\",\"name\":\"qyib\",\"type\":\"hwflu\"}]}")
                .toObject(AttachedDatabaseConfigurationListResult.class);
        Assertions.assertEquals("xysmoc", model.value().get(0).location());
        Assertions.assertEquals("qvmkcxo", model.value().get(0).databaseName());
        Assertions.assertEquals("apvhelxprgly", model.value().get(0).clusterResourceId());
        Assertions
            .assertEquals(
                DefaultPrincipalsModificationKind.REPLACE, model.value().get(0).defaultPrincipalsModificationKind());
        Assertions.assertEquals("kcbcue", model.value().get(0).databaseNameOverride());
        Assertions.assertEquals("jxgciqibrh", model.value().get(0).databaseNamePrefix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AttachedDatabaseConfigurationListResult model =
            new AttachedDatabaseConfigurationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new AttachedDatabaseConfigurationInner()
                                .withLocation("xysmoc")
                                .withDatabaseName("qvmkcxo")
                                .withClusterResourceId("apvhelxprgly")
                                .withDefaultPrincipalsModificationKind(DefaultPrincipalsModificationKind.REPLACE)
                                .withDatabaseNameOverride("kcbcue")
                                .withDatabaseNamePrefix("jxgciqibrh")));
        model = BinaryData.fromObject(model).toObject(AttachedDatabaseConfigurationListResult.class);
        Assertions.assertEquals("xysmoc", model.value().get(0).location());
        Assertions.assertEquals("qvmkcxo", model.value().get(0).databaseName());
        Assertions.assertEquals("apvhelxprgly", model.value().get(0).clusterResourceId());
        Assertions
            .assertEquals(
                DefaultPrincipalsModificationKind.REPLACE, model.value().get(0).defaultPrincipalsModificationKind());
        Assertions.assertEquals("kcbcue", model.value().get(0).databaseNameOverride());
        Assertions.assertEquals("jxgciqibrh", model.value().get(0).databaseNamePrefix());
    }
}
