// 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.fluent.models.ServiceUnitResourceProperties;
import com.azure.resourcemanager.deploymentmanager.models.DeploymentMode;
import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitArtifacts;
import org.junit.jupiter.api.Assertions;

public final class ServiceUnitResourcePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceUnitResourceProperties model =
            BinaryData
                .fromString(
                    "{\"targetResourceGroup\":\"hiv\",\"deploymentMode\":\"Complete\",\"artifacts\":{\"templateUri\":\"wby\",\"parametersUri\":\"k\",\"templateArtifactSourceRelativePath\":\"dumjgrtfwvuk\",\"parametersArtifactSourceRelativePath\":\"audccsnhs\"}}")
                .toObject(ServiceUnitResourceProperties.class);
        Assertions.assertEquals("hiv", model.targetResourceGroup());
        Assertions.assertEquals(DeploymentMode.COMPLETE, model.deploymentMode());
        Assertions.assertEquals("wby", model.artifacts().templateUri());
        Assertions.assertEquals("k", model.artifacts().parametersUri());
        Assertions.assertEquals("dumjgrtfwvuk", model.artifacts().templateArtifactSourceRelativePath());
        Assertions.assertEquals("audccsnhs", model.artifacts().parametersArtifactSourceRelativePath());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceUnitResourceProperties model =
            new ServiceUnitResourceProperties()
                .withTargetResourceGroup("hiv")
                .withDeploymentMode(DeploymentMode.COMPLETE)
                .withArtifacts(
                    new ServiceUnitArtifacts()
                        .withTemplateUri("wby")
                        .withParametersUri("k")
                        .withTemplateArtifactSourceRelativePath("dumjgrtfwvuk")
                        .withParametersArtifactSourceRelativePath("audccsnhs"));
        model = BinaryData.fromObject(model).toObject(ServiceUnitResourceProperties.class);
        Assertions.assertEquals("hiv", model.targetResourceGroup());
        Assertions.assertEquals(DeploymentMode.COMPLETE, model.deploymentMode());
        Assertions.assertEquals("wby", model.artifacts().templateUri());
        Assertions.assertEquals("k", model.artifacts().parametersUri());
        Assertions.assertEquals("dumjgrtfwvuk", model.artifacts().templateArtifactSourceRelativePath());
        Assertions.assertEquals("audccsnhs", model.artifacts().parametersArtifactSourceRelativePath());
    }
}
