// 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.MsixPackageApplications;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MsixPackageInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MsixPackageInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"imagePath\":\"xoruzfgsquyfxrx\",\"packageName\":\"eptra\",\"packageFamilyName\":\"jezwlwnw\",\"displayName\":\"qlcvydy\",\"packageRelativePath\":\"tdooaoj\",\"isRegularRegistration\":true,\"isActive\":true,\"packageDependencies\":[{\"dependencyName\":\"ebwnujhe\",\"publisher\":\"sbvdkcrodtjinfw\",\"minVersion\":\"fltkacjv\"}],\"version\":\"kdlfoa\",\"lastUpdated\":\"2020-12-29T16:57:58Z\",\"packageApplications\":[{\"appId\":\"agaowpulpqblylsy\",\"description\":\"qjnsjervtia\",\"appUserModelID\":\"sdszue\",\"friendlyName\":\"sbzkf\",\"iconImageName\":\"eyvpnqicvinvkj\"},{\"appId\":\"rbuukzclewyhmlwp\",\"description\":\"tzpofncckwyfzq\",\"appUserModelID\":\"xxbuyq\",\"friendlyName\":\"zfeqztppri\",\"iconImageName\":\"xorjaltolmncwsob\"},{\"appId\":\"dbnw\",\"description\":\"fhucqdpfuv\",\"appUserModelID\":\"sbjjc\",\"friendlyName\":\"vxb\",\"iconImageName\":\"vudutncor\"}]},\"id\":\"xqtvcofu\",\"name\":\"f\",\"type\":\"vkg\"}")
                .toObject(MsixPackageInner.class);
        Assertions.assertEquals("xoruzfgsquyfxrx", model.imagePath());
        Assertions.assertEquals("eptra", model.packageName());
        Assertions.assertEquals("jezwlwnw", model.packageFamilyName());
        Assertions.assertEquals("qlcvydy", model.displayName());
        Assertions.assertEquals("tdooaoj", model.packageRelativePath());
        Assertions.assertEquals(true, model.isRegularRegistration());
        Assertions.assertEquals(true, model.isActive());
        Assertions.assertEquals("ebwnujhe", model.packageDependencies().get(0).dependencyName());
        Assertions.assertEquals("sbvdkcrodtjinfw", model.packageDependencies().get(0).publisher());
        Assertions.assertEquals("fltkacjv", model.packageDependencies().get(0).minVersion());
        Assertions.assertEquals("kdlfoa", model.version());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-29T16:57:58Z"), model.lastUpdated());
        Assertions.assertEquals("agaowpulpqblylsy", model.packageApplications().get(0).appId());
        Assertions.assertEquals("qjnsjervtia", model.packageApplications().get(0).description());
        Assertions.assertEquals("sdszue", model.packageApplications().get(0).appUserModelId());
        Assertions.assertEquals("sbzkf", model.packageApplications().get(0).friendlyName());
        Assertions.assertEquals("eyvpnqicvinvkj", model.packageApplications().get(0).iconImageName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MsixPackageInner model =
            new MsixPackageInner()
                .withImagePath("xoruzfgsquyfxrx")
                .withPackageName("eptra")
                .withPackageFamilyName("jezwlwnw")
                .withDisplayName("qlcvydy")
                .withPackageRelativePath("tdooaoj")
                .withIsRegularRegistration(true)
                .withIsActive(true)
                .withPackageDependencies(
                    Arrays
                        .asList(
                            new MsixPackageDependencies()
                                .withDependencyName("ebwnujhe")
                                .withPublisher("sbvdkcrodtjinfw")
                                .withMinVersion("fltkacjv")))
                .withVersion("kdlfoa")
                .withLastUpdated(OffsetDateTime.parse("2020-12-29T16:57:58Z"))
                .withPackageApplications(
                    Arrays
                        .asList(
                            new MsixPackageApplications()
                                .withAppId("agaowpulpqblylsy")
                                .withDescription("qjnsjervtia")
                                .withAppUserModelId("sdszue")
                                .withFriendlyName("sbzkf")
                                .withIconImageName("eyvpnqicvinvkj"),
                            new MsixPackageApplications()
                                .withAppId("rbuukzclewyhmlwp")
                                .withDescription("tzpofncckwyfzq")
                                .withAppUserModelId("xxbuyq")
                                .withFriendlyName("zfeqztppri")
                                .withIconImageName("xorjaltolmncwsob"),
                            new MsixPackageApplications()
                                .withAppId("dbnw")
                                .withDescription("fhucqdpfuv")
                                .withAppUserModelId("sbjjc")
                                .withFriendlyName("vxb")
                                .withIconImageName("vudutncor")));
        model = BinaryData.fromObject(model).toObject(MsixPackageInner.class);
        Assertions.assertEquals("xoruzfgsquyfxrx", model.imagePath());
        Assertions.assertEquals("eptra", model.packageName());
        Assertions.assertEquals("jezwlwnw", model.packageFamilyName());
        Assertions.assertEquals("qlcvydy", model.displayName());
        Assertions.assertEquals("tdooaoj", model.packageRelativePath());
        Assertions.assertEquals(true, model.isRegularRegistration());
        Assertions.assertEquals(true, model.isActive());
        Assertions.assertEquals("ebwnujhe", model.packageDependencies().get(0).dependencyName());
        Assertions.assertEquals("sbvdkcrodtjinfw", model.packageDependencies().get(0).publisher());
        Assertions.assertEquals("fltkacjv", model.packageDependencies().get(0).minVersion());
        Assertions.assertEquals("kdlfoa", model.version());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-29T16:57:58Z"), model.lastUpdated());
        Assertions.assertEquals("agaowpulpqblylsy", model.packageApplications().get(0).appId());
        Assertions.assertEquals("qjnsjervtia", model.packageApplications().get(0).description());
        Assertions.assertEquals("sdszue", model.packageApplications().get(0).appUserModelId());
        Assertions.assertEquals("sbzkf", model.packageApplications().get(0).friendlyName());
        Assertions.assertEquals("eyvpnqicvinvkj", model.packageApplications().get(0).iconImageName());
    }
}
