// 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.ExpandMsixImageInner;
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 ExpandMsixImageInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ExpandMsixImageInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"packageAlias\":\"gzpfrla\",\"imagePath\":\"zrnw\",\"packageName\":\"indfpwpjyl\",\"packageFamilyName\":\"tlhflsjcdhszf\",\"packageFullName\":\"fbgofeljagrqmqh\",\"displayName\":\"vriiio\",\"packageRelativePath\":\"al\",\"isRegularRegistration\":false,\"isActive\":true,\"packageDependencies\":[{\"dependencyName\":\"ex\",\"publisher\":\"wueluqhhahhxv\",\"minVersion\":\"mzkwpjg\"},{\"dependencyName\":\"spughftqsxhq\",\"publisher\":\"j\",\"minVersion\":\"kndxdigrjgu\"},{\"dependencyName\":\"zdmsyqtfi\",\"publisher\":\"hbotzingamvppho\",\"minVersion\":\"qzudphq\"}],\"version\":\"vdkfwynwcvtbvk\",\"lastUpdated\":\"2021-01-08T18:46:20Z\",\"packageApplications\":[{\"appId\":\"vyqia\",\"description\":\"zwpcnpwzcjaesg\",\"appUserModelID\":\"sccyajguqf\",\"friendlyName\":\"ygz\",\"iconImageName\":\"dnkfx\"},{\"appId\":\"dwzrmuh\",\"description\":\"fcqdpsq\",\"appUserModelID\":\"vpsvuoymgcce\",\"friendlyName\":\"ezrypql\",\"iconImageName\":\"eokerqwkyhkobopg\"},{\"appId\":\"owepbqpcrfkb\",\"description\":\"csnjvcdwxlpqekft\",\"appUserModelID\":\"htjsying\",\"friendlyName\":\"qatmtdhtmdvy\",\"iconImageName\":\"ikdgszywkbir\"}]},\"id\":\"zh\",\"name\":\"hkjoqr\",\"type\":\"qqaatjinrvgou\"}")
                .toObject(ExpandMsixImageInner.class);
        Assertions.assertEquals("gzpfrla", model.packageAlias());
        Assertions.assertEquals("zrnw", model.imagePath());
        Assertions.assertEquals("indfpwpjyl", model.packageName());
        Assertions.assertEquals("tlhflsjcdhszf", model.packageFamilyName());
        Assertions.assertEquals("fbgofeljagrqmqh", model.packageFullName());
        Assertions.assertEquals("vriiio", model.displayName());
        Assertions.assertEquals("al", model.packageRelativePath());
        Assertions.assertEquals(false, model.isRegularRegistration());
        Assertions.assertEquals(true, model.isActive());
        Assertions.assertEquals("ex", model.packageDependencies().get(0).dependencyName());
        Assertions.assertEquals("wueluqhhahhxv", model.packageDependencies().get(0).publisher());
        Assertions.assertEquals("mzkwpjg", model.packageDependencies().get(0).minVersion());
        Assertions.assertEquals("vdkfwynwcvtbvk", model.version());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-08T18:46:20Z"), model.lastUpdated());
        Assertions.assertEquals("vyqia", model.packageApplications().get(0).appId());
        Assertions.assertEquals("zwpcnpwzcjaesg", model.packageApplications().get(0).description());
        Assertions.assertEquals("sccyajguqf", model.packageApplications().get(0).appUserModelId());
        Assertions.assertEquals("ygz", model.packageApplications().get(0).friendlyName());
        Assertions.assertEquals("dnkfx", model.packageApplications().get(0).iconImageName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ExpandMsixImageInner model =
            new ExpandMsixImageInner()
                .withPackageAlias("gzpfrla")
                .withImagePath("zrnw")
                .withPackageName("indfpwpjyl")
                .withPackageFamilyName("tlhflsjcdhszf")
                .withPackageFullName("fbgofeljagrqmqh")
                .withDisplayName("vriiio")
                .withPackageRelativePath("al")
                .withIsRegularRegistration(false)
                .withIsActive(true)
                .withPackageDependencies(
                    Arrays
                        .asList(
                            new MsixPackageDependencies()
                                .withDependencyName("ex")
                                .withPublisher("wueluqhhahhxv")
                                .withMinVersion("mzkwpjg"),
                            new MsixPackageDependencies()
                                .withDependencyName("spughftqsxhq")
                                .withPublisher("j")
                                .withMinVersion("kndxdigrjgu"),
                            new MsixPackageDependencies()
                                .withDependencyName("zdmsyqtfi")
                                .withPublisher("hbotzingamvppho")
                                .withMinVersion("qzudphq")))
                .withVersion("vdkfwynwcvtbvk")
                .withLastUpdated(OffsetDateTime.parse("2021-01-08T18:46:20Z"))
                .withPackageApplications(
                    Arrays
                        .asList(
                            new MsixPackageApplications()
                                .withAppId("vyqia")
                                .withDescription("zwpcnpwzcjaesg")
                                .withAppUserModelId("sccyajguqf")
                                .withFriendlyName("ygz")
                                .withIconImageName("dnkfx"),
                            new MsixPackageApplications()
                                .withAppId("dwzrmuh")
                                .withDescription("fcqdpsq")
                                .withAppUserModelId("vpsvuoymgcce")
                                .withFriendlyName("ezrypql")
                                .withIconImageName("eokerqwkyhkobopg"),
                            new MsixPackageApplications()
                                .withAppId("owepbqpcrfkb")
                                .withDescription("csnjvcdwxlpqekft")
                                .withAppUserModelId("htjsying")
                                .withFriendlyName("qatmtdhtmdvy")
                                .withIconImageName("ikdgszywkbir")));
        model = BinaryData.fromObject(model).toObject(ExpandMsixImageInner.class);
        Assertions.assertEquals("gzpfrla", model.packageAlias());
        Assertions.assertEquals("zrnw", model.imagePath());
        Assertions.assertEquals("indfpwpjyl", model.packageName());
        Assertions.assertEquals("tlhflsjcdhszf", model.packageFamilyName());
        Assertions.assertEquals("fbgofeljagrqmqh", model.packageFullName());
        Assertions.assertEquals("vriiio", model.displayName());
        Assertions.assertEquals("al", model.packageRelativePath());
        Assertions.assertEquals(false, model.isRegularRegistration());
        Assertions.assertEquals(true, model.isActive());
        Assertions.assertEquals("ex", model.packageDependencies().get(0).dependencyName());
        Assertions.assertEquals("wueluqhhahhxv", model.packageDependencies().get(0).publisher());
        Assertions.assertEquals("mzkwpjg", model.packageDependencies().get(0).minVersion());
        Assertions.assertEquals("vdkfwynwcvtbvk", model.version());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-08T18:46:20Z"), model.lastUpdated());
        Assertions.assertEquals("vyqia", model.packageApplications().get(0).appId());
        Assertions.assertEquals("zwpcnpwzcjaesg", model.packageApplications().get(0).description());
        Assertions.assertEquals("sccyajguqf", model.packageApplications().get(0).appUserModelId());
        Assertions.assertEquals("ygz", model.packageApplications().get(0).friendlyName());
        Assertions.assertEquals("dnkfx", model.packageApplications().get(0).iconImageName());
    }
}
