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

package com.azure.resourcemanager.devtestlabs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devtestlabs.fluent.models.EnvironmentProperties;
import com.azure.resourcemanager.devtestlabs.models.ArmTemplateParameterProperties;
import com.azure.resourcemanager.devtestlabs.models.EnvironmentDeploymentProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EnvironmentPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EnvironmentProperties model =
            BinaryData
                .fromString(
                    "{\"deploymentProperties\":{\"armTemplateId\":\"ynsqyrpfoobr\",\"parameters\":[{\"name\":\"msjnygqdnfw\",\"value\":\"dzgtil\"}]},\"armTemplateDisplayName\":\"hnfhqlyvijouwi\",\"resourceGroupId\":\"xoyzunbix\",\"createdByUser\":\"ti\",\"provisioningState\":\"cpwpg\",\"uniqueIdentifier\":\"rc\"}")
                .toObject(EnvironmentProperties.class);
        Assertions.assertEquals("ynsqyrpfoobr", model.deploymentProperties().armTemplateId());
        Assertions.assertEquals("msjnygqdnfw", model.deploymentProperties().parameters().get(0).name());
        Assertions.assertEquals("dzgtil", model.deploymentProperties().parameters().get(0).value());
        Assertions.assertEquals("hnfhqlyvijouwi", model.armTemplateDisplayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EnvironmentProperties model =
            new EnvironmentProperties()
                .withDeploymentProperties(
                    new EnvironmentDeploymentProperties()
                        .withArmTemplateId("ynsqyrpfoobr")
                        .withParameters(
                            Arrays
                                .asList(
                                    new ArmTemplateParameterProperties().withName("msjnygqdnfw").withValue("dzgtil"))))
                .withArmTemplateDisplayName("hnfhqlyvijouwi");
        model = BinaryData.fromObject(model).toObject(EnvironmentProperties.class);
        Assertions.assertEquals("ynsqyrpfoobr", model.deploymentProperties().armTemplateId());
        Assertions.assertEquals("msjnygqdnfw", model.deploymentProperties().parameters().get(0).name());
        Assertions.assertEquals("dzgtil", model.deploymentProperties().parameters().get(0).value());
        Assertions.assertEquals("hnfhqlyvijouwi", model.armTemplateDisplayName());
    }
}
