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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.models.OnPremiseSqlResourceDetails;
import org.junit.jupiter.api.Assertions;

public final class OnPremiseSqlResourceDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OnPremiseSqlResourceDetails model =
            BinaryData
                .fromString(
                    "{\"source\":\"OnPremiseSql\",\"serverName\":\"wob\",\"databaseName\":\"jw\",\"workspaceId\":\"lwyjfnqzocrdz\",\"vmuuid\":\"czeuntgx\",\"sourceComputerId\":\"ncaqttiekoifu\",\"machineName\":\"nyttzgix\"}")
                .toObject(OnPremiseSqlResourceDetails.class);
        Assertions.assertEquals("lwyjfnqzocrdz", model.workspaceId());
        Assertions.assertEquals("czeuntgx", model.vmuuid());
        Assertions.assertEquals("ncaqttiekoifu", model.sourceComputerId());
        Assertions.assertEquals("nyttzgix", model.machineName());
        Assertions.assertEquals("wob", model.serverName());
        Assertions.assertEquals("jw", model.databaseName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OnPremiseSqlResourceDetails model =
            new OnPremiseSqlResourceDetails()
                .withWorkspaceId("lwyjfnqzocrdz")
                .withVmuuid("czeuntgx")
                .withSourceComputerId("ncaqttiekoifu")
                .withMachineName("nyttzgix")
                .withServerName("wob")
                .withDatabaseName("jw");
        model = BinaryData.fromObject(model).toObject(OnPremiseSqlResourceDetails.class);
        Assertions.assertEquals("lwyjfnqzocrdz", model.workspaceId());
        Assertions.assertEquals("czeuntgx", model.vmuuid());
        Assertions.assertEquals("ncaqttiekoifu", model.sourceComputerId());
        Assertions.assertEquals("nyttzgix", model.machineName());
        Assertions.assertEquals("wob", model.serverName());
        Assertions.assertEquals("jw", model.databaseName());
    }
}
