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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.fluent.models.AssetInner;
import com.azure.resourcemanager.mediaservices.models.AssetCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AssetCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AssetCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"assetId\":\"dcf15dd7-7297-4c35-b345-0652c5850873\",\"created\":\"2021-01-13T15:17:17Z\",\"lastModified\":\"2021-08-09T20:50:19Z\",\"alternateId\":\"rywn\",\"description\":\"oqftiyqzrnkcq\",\"container\":\"xlwhzlsicoh\",\"storageAccountName\":\"qnwvlrya\",\"storageEncryptionFormat\":\"MediaStorageClientEncryption\"},\"id\":\"eun\",\"name\":\"mqhgyxzkonocuk\",\"type\":\"klyaxuconu\"},{\"properties\":{\"assetId\":\"a84715ee-f63c-48eb-8008-66203b2ec722\",\"created\":\"2021-09-15T09:48:55Z\",\"lastModified\":\"2021-10-30T19:28:33Z\",\"alternateId\":\"pewr\",\"description\":\"mwvvjektcxsenhw\",\"container\":\"s\",\"storageAccountName\":\"rzpwvlqdqgbiq\",\"storageEncryptionFormat\":\"MediaStorageClientEncryption\"},\"id\":\"kaet\",\"name\":\"kt\",\"type\":\"fcivfsnkym\"},{\"properties\":{\"assetId\":\"204512af-90b8-4a97-bc2a-ea98ec35984b\",\"created\":\"2021-04-08T09:35Z\",\"lastModified\":\"2021-09-28T09:51:37Z\",\"alternateId\":\"ebrjcxe\",\"description\":\"uwutttxfvjrbi\",\"container\":\"hxepcyvahfnlj\",\"storageAccountName\":\"qxj\",\"storageEncryptionFormat\":\"None\"},\"id\":\"qgidokgjljyo\",\"name\":\"gvcl\",\"type\":\"bgsncghkjeszzhb\"}],\"@odata.nextLink\":\"htxfvgxbfsmxnehm\"}")
                .toObject(AssetCollection.class);
        Assertions.assertEquals("rywn", model.value().get(0).alternateId());
        Assertions.assertEquals("oqftiyqzrnkcq", model.value().get(0).description());
        Assertions.assertEquals("xlwhzlsicoh", model.value().get(0).container());
        Assertions.assertEquals("qnwvlrya", model.value().get(0).storageAccountName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AssetCollection model =
            new AssetCollection()
                .withValue(
                    Arrays
                        .asList(
                            new AssetInner()
                                .withAlternateId("rywn")
                                .withDescription("oqftiyqzrnkcq")
                                .withContainer("xlwhzlsicoh")
                                .withStorageAccountName("qnwvlrya"),
                            new AssetInner()
                                .withAlternateId("pewr")
                                .withDescription("mwvvjektcxsenhw")
                                .withContainer("s")
                                .withStorageAccountName("rzpwvlqdqgbiq"),
                            new AssetInner()
                                .withAlternateId("ebrjcxe")
                                .withDescription("uwutttxfvjrbi")
                                .withContainer("hxepcyvahfnlj")
                                .withStorageAccountName("qxj")));
        model = BinaryData.fromObject(model).toObject(AssetCollection.class);
        Assertions.assertEquals("rywn", model.value().get(0).alternateId());
        Assertions.assertEquals("oqftiyqzrnkcq", model.value().get(0).description());
        Assertions.assertEquals("xlwhzlsicoh", model.value().get(0).container());
        Assertions.assertEquals("qnwvlrya", model.value().get(0).storageAccountName());
    }
}
