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

package com.azure.resourcemanager.sphere.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.sphere.fluent.models.DeviceInner;
import com.azure.resourcemanager.sphere.models.DeviceListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DeviceListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DeviceListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"deviceId\":\"zsbbzoggigrxwb\",\"chipSku\":\"vjxxjnsp\",\"lastAvailableOsVersion\":\"ptkoenkoukn\",\"lastInstalledOsVersion\":\"dwtiukbldngkp\",\"lastOsUpdateUtc\":\"2021-05-04T07:17:38Z\",\"lastUpdateRequestUtc\":\"2021-05-19T00:57:25Z\",\"provisioningState\":\"Canceled\"},\"id\":\"xoegukgjnpiucgy\",\"name\":\"evqzntypmrbp\",\"type\":\"zcdrqjsdpydnfyhx\"},{\"properties\":{\"deviceId\":\"ejzicwifsjtt\",\"chipSku\":\"fbishcbkha\",\"lastAvailableOsVersion\":\"eyeam\",\"lastInstalledOsVersion\":\"hagalpbuxwgipwh\",\"lastOsUpdateUtc\":\"2021-04-24T13:32:45Z\",\"lastUpdateRequestUtc\":\"2021-08-18T16:08:42Z\",\"provisioningState\":\"Deleting\"},\"id\":\"hwankixzbinjepu\",\"name\":\"tmryw\",\"type\":\"uzoqft\"},{\"properties\":{\"deviceId\":\"zrnkcqvyxlwh\",\"chipSku\":\"sicohoqqnwvlry\",\"lastAvailableOsVersion\":\"w\",\"lastInstalledOsVersion\":\"eun\",\"lastOsUpdateUtc\":\"2021-02-20T01:45:10Z\",\"lastUpdateRequestUtc\":\"2021-10-16T07:10:15Z\",\"provisioningState\":\"Canceled\"},\"id\":\"zko\",\"name\":\"ocukoklyax\",\"type\":\"conuqszfkbeype\"},{\"properties\":{\"deviceId\":\"jmwvvj\",\"chipSku\":\"tcxsenhwlrs\",\"lastAvailableOsVersion\":\"rzpwvlqdqgbiq\",\"lastInstalledOsVersion\":\"ihkaetcktvfc\",\"lastOsUpdateUtc\":\"2021-07-13T01:18:13Z\",\"lastUpdateRequestUtc\":\"2021-09-20T06:05:50Z\",\"provisioningState\":\"Provisioning\"},\"id\":\"m\",\"name\":\"ctq\",\"type\":\"jf\"}],\"nextLink\":\"brjcxe\"}")
                .toObject(DeviceListResult.class);
        Assertions.assertEquals("zsbbzoggigrxwb", model.value().get(0).deviceId());
        Assertions.assertEquals("brjcxe", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DeviceListResult model =
            new DeviceListResult()
                .withValue(
                    Arrays
                        .asList(
                            new DeviceInner().withDeviceId("zsbbzoggigrxwb"),
                            new DeviceInner().withDeviceId("ejzicwifsjtt"),
                            new DeviceInner().withDeviceId("zrnkcqvyxlwh"),
                            new DeviceInner().withDeviceId("jmwvvj")))
                .withNextLink("brjcxe");
        model = BinaryData.fromObject(model).toObject(DeviceListResult.class);
        Assertions.assertEquals("zsbbzoggigrxwb", model.value().get(0).deviceId());
        Assertions.assertEquals("brjcxe", model.nextLink());
    }
}
