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

package com.azure.resourcemanager.kusto.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kusto.fluent.models.CosmosDbDataConnectionProperties;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class CosmosDbDataConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CosmosDbDataConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"tableName\":\"behwagohb\",\"mappingRuleName\":\"fkmr\",\"managedIdentityResourceId\":\"emvvhm\",\"managedIdentityObjectId\":\"drjf\",\"cosmosDbAccountResourceId\":\"tac\",\"cosmosDbDatabase\":\"ebjvewzcjzn\",\"cosmosDbContainer\":\"wcpmguaadraufac\",\"retrievalStartDate\":\"2021-12-01T13:50:18Z\",\"provisioningState\":\"Creating\"}")
                .toObject(CosmosDbDataConnectionProperties.class);
        Assertions.assertEquals("behwagohb", model.tableName());
        Assertions.assertEquals("fkmr", model.mappingRuleName());
        Assertions.assertEquals("emvvhm", model.managedIdentityResourceId());
        Assertions.assertEquals("tac", model.cosmosDbAccountResourceId());
        Assertions.assertEquals("ebjvewzcjzn", model.cosmosDbDatabase());
        Assertions.assertEquals("wcpmguaadraufac", model.cosmosDbContainer());
        Assertions.assertEquals(OffsetDateTime.parse("2021-12-01T13:50:18Z"), model.retrievalStartDate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CosmosDbDataConnectionProperties model =
            new CosmosDbDataConnectionProperties()
                .withTableName("behwagohb")
                .withMappingRuleName("fkmr")
                .withManagedIdentityResourceId("emvvhm")
                .withCosmosDbAccountResourceId("tac")
                .withCosmosDbDatabase("ebjvewzcjzn")
                .withCosmosDbContainer("wcpmguaadraufac")
                .withRetrievalStartDate(OffsetDateTime.parse("2021-12-01T13:50:18Z"));
        model = BinaryData.fromObject(model).toObject(CosmosDbDataConnectionProperties.class);
        Assertions.assertEquals("behwagohb", model.tableName());
        Assertions.assertEquals("fkmr", model.mappingRuleName());
        Assertions.assertEquals("emvvhm", model.managedIdentityResourceId());
        Assertions.assertEquals("tac", model.cosmosDbAccountResourceId());
        Assertions.assertEquals("ebjvewzcjzn", model.cosmosDbDatabase());
        Assertions.assertEquals("wcpmguaadraufac", model.cosmosDbContainer());
        Assertions.assertEquals(OffsetDateTime.parse("2021-12-01T13:50:18Z"), model.retrievalStartDate());
    }
}
