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

package com.azure.resourcemanager.redisenterprise.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.redisenterprise.fluent.models.RegionSkuDetailInner;
import com.azure.resourcemanager.redisenterprise.models.LocationInfo;
import com.azure.resourcemanager.redisenterprise.models.RegionSkuDetails;
import com.azure.resourcemanager.redisenterprise.models.SkuDetail;
import com.azure.resourcemanager.redisenterprise.models.SkuName;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class RegionSkuDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RegionSkuDetails model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"resourceType\":\"dnfyhxdeoejzicwi\",\"locationInfo\":{\"location\":\"ttgzfbis\",\"capabilities\":[]},\"skuDetails\":{\"name\":\"Enterprise_E20\"}}]}")
                .toObject(RegionSkuDetails.class);
        Assertions.assertEquals("dnfyhxdeoejzicwi", model.value().get(0).resourceType());
        Assertions.assertEquals("ttgzfbis", model.value().get(0).locationInfo().location());
        Assertions.assertEquals(SkuName.ENTERPRISE_E20, model.value().get(0).skuDetails().name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RegionSkuDetails model =
            new RegionSkuDetails()
                .withValue(
                    Arrays
                        .asList(
                            new RegionSkuDetailInner()
                                .withResourceType("dnfyhxdeoejzicwi")
                                .withLocationInfo(
                                    new LocationInfo().withLocation("ttgzfbis").withCapabilities(Arrays.asList()))
                                .withSkuDetails(new SkuDetail().withName(SkuName.ENTERPRISE_E20))));
        model = BinaryData.fromObject(model).toObject(RegionSkuDetails.class);
        Assertions.assertEquals("dnfyhxdeoejzicwi", model.value().get(0).resourceType());
        Assertions.assertEquals("ttgzfbis", model.value().get(0).locationInfo().location());
        Assertions.assertEquals(SkuName.ENTERPRISE_E20, model.value().get(0).skuDetails().name());
    }
}
