// 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.EventGridConnectionProperties;
import com.azure.resourcemanager.kusto.models.BlobStorageEventType;
import com.azure.resourcemanager.kusto.models.DatabaseRouting;
import com.azure.resourcemanager.kusto.models.EventGridDataFormat;
import org.junit.jupiter.api.Assertions;

public final class EventGridConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EventGridConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"storageAccountResourceId\":\"goo\",\"eventGridResourceId\":\"kqfqjbvl\",\"eventHubResourceId\":\"orfmluiqt\",\"consumerGroup\":\"zf\",\"tableName\":\"yvnqqybaryeuay\",\"mappingRuleName\":\"qabqgzslesjcb\",\"dataFormat\":\"AVRO\",\"ignoreFirstRecord\":false,\"blobStorageEventType\":\"Microsoft.Storage.BlobCreated\",\"managedIdentityResourceId\":\"w\",\"managedIdentityObjectId\":\"cv\",\"databaseRouting\":\"Multi\",\"provisioningState\":\"Succeeded\"}")
                .toObject(EventGridConnectionProperties.class);
        Assertions.assertEquals("goo", model.storageAccountResourceId());
        Assertions.assertEquals("kqfqjbvl", model.eventGridResourceId());
        Assertions.assertEquals("orfmluiqt", model.eventHubResourceId());
        Assertions.assertEquals("zf", model.consumerGroup());
        Assertions.assertEquals("yvnqqybaryeuay", model.tableName());
        Assertions.assertEquals("qabqgzslesjcb", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.AVRO, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED, model.blobStorageEventType());
        Assertions.assertEquals("w", model.managedIdentityResourceId());
        Assertions.assertEquals(DatabaseRouting.MULTI, model.databaseRouting());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EventGridConnectionProperties model =
            new EventGridConnectionProperties()
                .withStorageAccountResourceId("goo")
                .withEventGridResourceId("kqfqjbvl")
                .withEventHubResourceId("orfmluiqt")
                .withConsumerGroup("zf")
                .withTableName("yvnqqybaryeuay")
                .withMappingRuleName("qabqgzslesjcb")
                .withDataFormat(EventGridDataFormat.AVRO)
                .withIgnoreFirstRecord(false)
                .withBlobStorageEventType(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED)
                .withManagedIdentityResourceId("w")
                .withDatabaseRouting(DatabaseRouting.MULTI);
        model = BinaryData.fromObject(model).toObject(EventGridConnectionProperties.class);
        Assertions.assertEquals("goo", model.storageAccountResourceId());
        Assertions.assertEquals("kqfqjbvl", model.eventGridResourceId());
        Assertions.assertEquals("orfmluiqt", model.eventHubResourceId());
        Assertions.assertEquals("zf", model.consumerGroup());
        Assertions.assertEquals("yvnqqybaryeuay", model.tableName());
        Assertions.assertEquals("qabqgzslesjcb", model.mappingRuleName());
        Assertions.assertEquals(EventGridDataFormat.AVRO, model.dataFormat());
        Assertions.assertEquals(false, model.ignoreFirstRecord());
        Assertions.assertEquals(BlobStorageEventType.MICROSOFT_STORAGE_BLOB_CREATED, model.blobStorageEventType());
        Assertions.assertEquals("w", model.managedIdentityResourceId());
        Assertions.assertEquals(DatabaseRouting.MULTI, model.databaseRouting());
    }
}
