// 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.ApplicationInner;
import com.azure.resourcemanager.desktopvirtualization.models.ApplicationList;
import com.azure.resourcemanager.desktopvirtualization.models.CommandLineSetting;
import com.azure.resourcemanager.desktopvirtualization.models.RemoteApplicationType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ApplicationListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ApplicationList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"objectId\":\"o\",\"description\":\"bnxknalaulppg\",\"friendlyName\":\"tpnapnyiropuhpig\",\"filePath\":\"gylgqgitxmedjvcs\",\"msixPackageFamilyName\":\"n\",\"msixPackageApplicationId\":\"wncwzzhxgktrmg\",\"applicationType\":\"MsixApplication\",\"commandLineSetting\":\"DoNotAllow\",\"commandLineArguments\":\"kteo\",\"showInPortal\":false,\"iconPath\":\"pt\",\"iconIndex\":1401142659,\"iconHash\":\"pfqbuaceopzf\"},\"id\":\"hhuao\",\"name\":\"ppcqeqxolz\",\"type\":\"ahzxctobgbk\"},{\"properties\":{\"objectId\":\"izpost\",\"description\":\"rcfbunrm\",\"friendlyName\":\"jhhkxbp\",\"filePath\":\"ymjhxxjyngudivkr\",\"msixPackageFamilyName\":\"wbxqzvszjfau\",\"msixPackageApplicationId\":\"fdxxivetvtcqaqtd\",\"applicationType\":\"MsixApplication\",\"commandLineSetting\":\"Allow\",\"commandLineArguments\":\"xv\",\"showInPortal\":false,\"iconPath\":\"slqb\",\"iconIndex\":92665469,\"iconHash\":\"obl\"},\"id\":\"k\",\"name\":\"lmpewwwfbkr\",\"type\":\"rn\"},{\"properties\":{\"objectId\":\"hqjohxcrsbfova\",\"description\":\"ruvw\",\"friendlyName\":\"sqfsubcgjbirxb\",\"filePath\":\"bsrfbj\",\"msixPackageFamilyName\":\"twss\",\"msixPackageApplicationId\":\"ftpvjzbexil\",\"applicationType\":\"InBuilt\",\"commandLineSetting\":\"DoNotAllow\",\"commandLineArguments\":\"q\",\"showInPortal\":false,\"iconPath\":\"mqtaruoujmkcjh\",\"iconIndex\":1420775781,\"iconHash\":\"jrybnwjewgdrjer\"},\"id\":\"aen\",\"name\":\"pehindoygm\",\"type\":\"fthnzdn\"}],\"nextLink\":\"l\"}")
                .toObject(ApplicationList.class);
        Assertions.assertEquals("bnxknalaulppg", model.value().get(0).description());
        Assertions.assertEquals("tpnapnyiropuhpig", model.value().get(0).friendlyName());
        Assertions.assertEquals("gylgqgitxmedjvcs", model.value().get(0).filePath());
        Assertions.assertEquals("n", model.value().get(0).msixPackageFamilyName());
        Assertions.assertEquals("wncwzzhxgktrmg", model.value().get(0).msixPackageApplicationId());
        Assertions.assertEquals(RemoteApplicationType.MSIX_APPLICATION, model.value().get(0).applicationType());
        Assertions.assertEquals(CommandLineSetting.DO_NOT_ALLOW, model.value().get(0).commandLineSetting());
        Assertions.assertEquals("kteo", model.value().get(0).commandLineArguments());
        Assertions.assertEquals(false, model.value().get(0).showInPortal());
        Assertions.assertEquals("pt", model.value().get(0).iconPath());
        Assertions.assertEquals(1401142659, model.value().get(0).iconIndex());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ApplicationList model =
            new ApplicationList()
                .withValue(
                    Arrays
                        .asList(
                            new ApplicationInner()
                                .withDescription("bnxknalaulppg")
                                .withFriendlyName("tpnapnyiropuhpig")
                                .withFilePath("gylgqgitxmedjvcs")
                                .withMsixPackageFamilyName("n")
                                .withMsixPackageApplicationId("wncwzzhxgktrmg")
                                .withApplicationType(RemoteApplicationType.MSIX_APPLICATION)
                                .withCommandLineSetting(CommandLineSetting.DO_NOT_ALLOW)
                                .withCommandLineArguments("kteo")
                                .withShowInPortal(false)
                                .withIconPath("pt")
                                .withIconIndex(1401142659),
                            new ApplicationInner()
                                .withDescription("rcfbunrm")
                                .withFriendlyName("jhhkxbp")
                                .withFilePath("ymjhxxjyngudivkr")
                                .withMsixPackageFamilyName("wbxqzvszjfau")
                                .withMsixPackageApplicationId("fdxxivetvtcqaqtd")
                                .withApplicationType(RemoteApplicationType.MSIX_APPLICATION)
                                .withCommandLineSetting(CommandLineSetting.ALLOW)
                                .withCommandLineArguments("xv")
                                .withShowInPortal(false)
                                .withIconPath("slqb")
                                .withIconIndex(92665469),
                            new ApplicationInner()
                                .withDescription("ruvw")
                                .withFriendlyName("sqfsubcgjbirxb")
                                .withFilePath("bsrfbj")
                                .withMsixPackageFamilyName("twss")
                                .withMsixPackageApplicationId("ftpvjzbexil")
                                .withApplicationType(RemoteApplicationType.IN_BUILT)
                                .withCommandLineSetting(CommandLineSetting.DO_NOT_ALLOW)
                                .withCommandLineArguments("q")
                                .withShowInPortal(false)
                                .withIconPath("mqtaruoujmkcjh")
                                .withIconIndex(1420775781)));
        model = BinaryData.fromObject(model).toObject(ApplicationList.class);
        Assertions.assertEquals("bnxknalaulppg", model.value().get(0).description());
        Assertions.assertEquals("tpnapnyiropuhpig", model.value().get(0).friendlyName());
        Assertions.assertEquals("gylgqgitxmedjvcs", model.value().get(0).filePath());
        Assertions.assertEquals("n", model.value().get(0).msixPackageFamilyName());
        Assertions.assertEquals("wncwzzhxgktrmg", model.value().get(0).msixPackageApplicationId());
        Assertions.assertEquals(RemoteApplicationType.MSIX_APPLICATION, model.value().get(0).applicationType());
        Assertions.assertEquals(CommandLineSetting.DO_NOT_ALLOW, model.value().get(0).commandLineSetting());
        Assertions.assertEquals("kteo", model.value().get(0).commandLineArguments());
        Assertions.assertEquals(false, model.value().get(0).showInPortal());
        Assertions.assertEquals("pt", model.value().get(0).iconPath());
        Assertions.assertEquals(1401142659, model.value().get(0).iconIndex());
    }
}
