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

package com.azure.resourcemanager.mysqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AzureADAdministratorInner;
import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorListResult;
import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AdministratorListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AdministratorListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"dznrbtcqq\",\"sid\":\"qglhq\",\"tenantId\":\"ufo\",\"identityResourceId\":\"jywif\"},\"id\":\"esaagdfm\",\"name\":\"lzl\",\"type\":\"j\"}],\"nextLink\":\"ifkwmrvktsizntoc\"}")
                .toObject(AdministratorListResult.class);
        Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.value().get(0).administratorType());
        Assertions.assertEquals("dznrbtcqq", model.value().get(0).login());
        Assertions.assertEquals("qglhq", model.value().get(0).sid());
        Assertions.assertEquals("ufo", model.value().get(0).tenantId());
        Assertions.assertEquals("jywif", model.value().get(0).identityResourceId());
        Assertions.assertEquals("ifkwmrvktsizntoc", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AdministratorListResult model =
            new AdministratorListResult()
                .withValue(
                    Arrays
                        .asList(
                            new AzureADAdministratorInner()
                                .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY)
                                .withLogin("dznrbtcqq")
                                .withSid("qglhq")
                                .withTenantId("ufo")
                                .withIdentityResourceId("jywif")))
                .withNextLink("ifkwmrvktsizntoc");
        model = BinaryData.fromObject(model).toObject(AdministratorListResult.class);
        Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.value().get(0).administratorType());
        Assertions.assertEquals("dznrbtcqq", model.value().get(0).login());
        Assertions.assertEquals("qglhq", model.value().get(0).sid());
        Assertions.assertEquals("ufo", model.value().get(0).tenantId());
        Assertions.assertEquals("jywif", model.value().get(0).identityResourceId());
        Assertions.assertEquals("ifkwmrvktsizntoc", model.nextLink());
    }
}
