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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.models.EntityReference;
import com.azure.resourcemanager.synapse.models.IntegrationRuntimeDataProxyProperties;
import com.azure.resourcemanager.synapse.models.IntegrationRuntimeEntityReferenceType;
import org.junit.jupiter.api.Assertions;

public final class IntegrationRuntimeDataProxyPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IntegrationRuntimeDataProxyProperties model =
            BinaryData
                .fromString(
                    "{\"connectVia\":{\"type\":\"LinkedServiceReference\",\"referenceName\":\"wofali\"},\"stagingLinkedService\":{\"type\":\"IntegrationRuntimeReference\",\"referenceName\":\"iqtamtyvsknxrw\"},\"path\":\"wnv\"}")
                .toObject(IntegrationRuntimeDataProxyProperties.class);
        Assertions
            .assertEquals(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE, model.connectVia().type());
        Assertions.assertEquals("wofali", model.connectVia().referenceName());
        Assertions
            .assertEquals(
                IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE,
                model.stagingLinkedService().type());
        Assertions.assertEquals("iqtamtyvsknxrw", model.stagingLinkedService().referenceName());
        Assertions.assertEquals("wnv", model.path());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IntegrationRuntimeDataProxyProperties model =
            new IntegrationRuntimeDataProxyProperties()
                .withConnectVia(
                    new EntityReference()
                        .withType(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE)
                        .withReferenceName("wofali"))
                .withStagingLinkedService(
                    new EntityReference()
                        .withType(IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE)
                        .withReferenceName("iqtamtyvsknxrw"))
                .withPath("wnv");
        model = BinaryData.fromObject(model).toObject(IntegrationRuntimeDataProxyProperties.class);
        Assertions
            .assertEquals(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE, model.connectVia().type());
        Assertions.assertEquals("wofali", model.connectVia().referenceName());
        Assertions
            .assertEquals(
                IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE,
                model.stagingLinkedService().type());
        Assertions.assertEquals("iqtamtyvsknxrw", model.stagingLinkedService().referenceName());
        Assertions.assertEquals("wnv", model.path());
    }
}
