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

package com.azure.resourcemanager.desktopvirtualization.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageList;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MsixPackageListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MsixPackageList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"imagePath\":\"r\",\"packageName\":\"vu\",\"packageFamilyName\":\"raehtwdwrft\",\"displayName\":\"iby\",\"packageRelativePath\":\"dl\",\"isRegularRegistration\":true,\"isActive\":true,\"packageDependencies\":[],\"version\":\"racstwity\",\"lastUpdated\":\"2021-10-09T17:15:47Z\",\"packageApplications\":[]},\"id\":\"xccedcpnmdyodn\",\"name\":\"zxltjcvn\",\"type\":\"ltiugcxnavv\"}],\"nextLink\":\"qiby\"}")
                .toObject(MsixPackageList.class);
        Assertions.assertEquals("r", model.value().get(0).imagePath());
        Assertions.assertEquals("vu", model.value().get(0).packageName());
        Assertions.assertEquals("raehtwdwrft", model.value().get(0).packageFamilyName());
        Assertions.assertEquals("iby", model.value().get(0).displayName());
        Assertions.assertEquals("dl", model.value().get(0).packageRelativePath());
        Assertions.assertEquals(true, model.value().get(0).isRegularRegistration());
        Assertions.assertEquals(true, model.value().get(0).isActive());
        Assertions.assertEquals("racstwity", model.value().get(0).version());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-09T17:15:47Z"), model.value().get(0).lastUpdated());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MsixPackageList model =
            new MsixPackageList()
                .withValue(
                    Arrays
                        .asList(
                            new MsixPackageInner()
                                .withImagePath("r")
                                .withPackageName("vu")
                                .withPackageFamilyName("raehtwdwrft")
                                .withDisplayName("iby")
                                .withPackageRelativePath("dl")
                                .withIsRegularRegistration(true)
                                .withIsActive(true)
                                .withPackageDependencies(Arrays.asList())
                                .withVersion("racstwity")
                                .withLastUpdated(OffsetDateTime.parse("2021-10-09T17:15:47Z"))
                                .withPackageApplications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(MsixPackageList.class);
        Assertions.assertEquals("r", model.value().get(0).imagePath());
        Assertions.assertEquals("vu", model.value().get(0).packageName());
        Assertions.assertEquals("raehtwdwrft", model.value().get(0).packageFamilyName());
        Assertions.assertEquals("iby", model.value().get(0).displayName());
        Assertions.assertEquals("dl", model.value().get(0).packageRelativePath());
        Assertions.assertEquals(true, model.value().get(0).isRegularRegistration());
        Assertions.assertEquals(true, model.value().get(0).isActive());
        Assertions.assertEquals("racstwity", model.value().get(0).version());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-09T17:15:47Z"), model.value().get(0).lastUpdated());
    }
}
