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

package com.azure.resourcemanager.deploymentmanager.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.deploymentmanager.models.DeploymentMode;
import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitArtifacts;
import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitProperties;
import org.junit.jupiter.api.Assertions;

public final class ServiceUnitPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceUnitProperties model =
            BinaryData
                .fromString(
                    "{\"targetResourceGroup\":\"cnyejhkryhtnapcz\",\"deploymentMode\":\"Complete\",\"artifacts\":{\"templateUri\":\"jye\",\"parametersUri\":\"kvnipjoxz\",\"templateArtifactSourceRelativePath\":\"chgejspodm\",\"parametersArtifactSourceRelativePath\":\"lzydehojwyahux\"}}")
                .toObject(ServiceUnitProperties.class);
        Assertions.assertEquals("cnyejhkryhtnapcz", model.targetResourceGroup());
        Assertions.assertEquals(DeploymentMode.COMPLETE, model.deploymentMode());
        Assertions.assertEquals("jye", model.artifacts().templateUri());
        Assertions.assertEquals("kvnipjoxz", model.artifacts().parametersUri());
        Assertions.assertEquals("chgejspodm", model.artifacts().templateArtifactSourceRelativePath());
        Assertions.assertEquals("lzydehojwyahux", model.artifacts().parametersArtifactSourceRelativePath());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceUnitProperties model =
            new ServiceUnitProperties()
                .withTargetResourceGroup("cnyejhkryhtnapcz")
                .withDeploymentMode(DeploymentMode.COMPLETE)
                .withArtifacts(
                    new ServiceUnitArtifacts()
                        .withTemplateUri("jye")
                        .withParametersUri("kvnipjoxz")
                        .withTemplateArtifactSourceRelativePath("chgejspodm")
                        .withParametersArtifactSourceRelativePath("lzydehojwyahux"));
        model = BinaryData.fromObject(model).toObject(ServiceUnitProperties.class);
        Assertions.assertEquals("cnyejhkryhtnapcz", model.targetResourceGroup());
        Assertions.assertEquals(DeploymentMode.COMPLETE, model.deploymentMode());
        Assertions.assertEquals("jye", model.artifacts().templateUri());
        Assertions.assertEquals("kvnipjoxz", model.artifacts().parametersUri());
        Assertions.assertEquals("chgejspodm", model.artifacts().templateArtifactSourceRelativePath());
        Assertions.assertEquals("lzydehojwyahux", model.artifacts().parametersArtifactSourceRelativePath());
    }
}
