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

package com.azure.resourcemanager.maintenance.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.maintenance.fluent.models.ConfigurationAssignmentInner;
import com.azure.resourcemanager.maintenance.models.ListConfigurationAssignmentsResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ListConfigurationAssignmentsResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ListConfigurationAssignmentsResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"location\":\"blgphuticn\",\"properties\":{\"maintenanceConfigurationId\":\"aozwyiftyhxhu\",\"resourceId\":\"k\"},\"id\":\"yxolniwp\",\"name\":\"cukjf\",\"type\":\"giawx\"},{\"location\":\"ryplwckbasyypn\",\"properties\":{\"maintenanceConfigurationId\":\"sgcbac\",\"resourceId\":\"ejk\"},\"id\":\"ynqgoulzndlikwyq\",\"name\":\"gfgibm\",\"type\":\"dgak\"}]}")
                .toObject(ListConfigurationAssignmentsResult.class);
        Assertions.assertEquals("blgphuticn", model.value().get(0).location());
        Assertions.assertEquals("aozwyiftyhxhu", model.value().get(0).maintenanceConfigurationId());
        Assertions.assertEquals("k", model.value().get(0).resourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ListConfigurationAssignmentsResult model =
            new ListConfigurationAssignmentsResult()
                .withValue(
                    Arrays
                        .asList(
                            new ConfigurationAssignmentInner()
                                .withLocation("blgphuticn")
                                .withMaintenanceConfigurationId("aozwyiftyhxhu")
                                .withResourceId("k"),
                            new ConfigurationAssignmentInner()
                                .withLocation("ryplwckbasyypn")
                                .withMaintenanceConfigurationId("sgcbac")
                                .withResourceId("ejk")));
        model = BinaryData.fromObject(model).toObject(ListConfigurationAssignmentsResult.class);
        Assertions.assertEquals("blgphuticn", model.value().get(0).location());
        Assertions.assertEquals("aozwyiftyhxhu", model.value().get(0).maintenanceConfigurationId());
        Assertions.assertEquals("k", model.value().get(0).resourceId());
    }
}
