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

package com.azure.resourcemanager.mariadb.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner;
import com.azure.resourcemanager.mariadb.models.DatabaseListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DatabaseListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatabaseListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"charset\":\"qeojnxqbzvddntw\",\"collation\":\"eic\"},\"id\":\"twnpzaoqvuhrhcf\",\"name\":\"cyddglmjthjqk\",\"type\":\"pyeicxm\"},{\"properties\":{\"charset\":\"wqvhkhixuigdt\",\"collation\":\"bob\"},\"id\":\"og\",\"name\":\"m\",\"type\":\"w\"},{\"properties\":{\"charset\":\"a\",\"collation\":\"rzayv\"},\"id\":\"t\",\"name\":\"gvdfgiotkftutq\",\"type\":\"ln\"}]}")
                .toObject(DatabaseListResult.class);
        Assertions.assertEquals("qeojnxqbzvddntw", model.value().get(0).charset());
        Assertions.assertEquals("eic", model.value().get(0).collation());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatabaseListResult model =
            new DatabaseListResult()
                .withValue(
                    Arrays
                        .asList(
                            new DatabaseInner().withCharset("qeojnxqbzvddntw").withCollation("eic"),
                            new DatabaseInner().withCharset("wqvhkhixuigdt").withCollation("bob"),
                            new DatabaseInner().withCharset("a").withCollation("rzayv")));
        model = BinaryData.fromObject(model).toObject(DatabaseListResult.class);
        Assertions.assertEquals("qeojnxqbzvddntw", model.value().get(0).charset());
        Assertions.assertEquals("eic", model.value().get(0).collation());
    }
}
