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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.models.AppProtocol;
import com.azure.resourcemanager.appcontainers.models.Dapr;
import com.azure.resourcemanager.appcontainers.models.LogLevel;
import org.junit.jupiter.api.Assertions;

public final class DaprTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        Dapr model =
            BinaryData
                .fromString(
                    "{\"enabled\":false,\"appId\":\"pbtg\",\"appProtocol\":\"grpc\",\"appPort\":1911820344,\"httpReadBufferSize\":2105060368,\"httpMaxRequestSize\":1273171944,\"logLevel\":\"debug\",\"enableApiLogging\":false}")
                .toObject(Dapr.class);
        Assertions.assertEquals(false, model.enabled());
        Assertions.assertEquals("pbtg", model.appId());
        Assertions.assertEquals(AppProtocol.GRPC, model.appProtocol());
        Assertions.assertEquals(1911820344, model.appPort());
        Assertions.assertEquals(2105060368, model.httpReadBufferSize());
        Assertions.assertEquals(1273171944, model.httpMaxRequestSize());
        Assertions.assertEquals(LogLevel.DEBUG, model.logLevel());
        Assertions.assertEquals(false, model.enableApiLogging());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        Dapr model =
            new Dapr()
                .withEnabled(false)
                .withAppId("pbtg")
                .withAppProtocol(AppProtocol.GRPC)
                .withAppPort(1911820344)
                .withHttpReadBufferSize(2105060368)
                .withHttpMaxRequestSize(1273171944)
                .withLogLevel(LogLevel.DEBUG)
                .withEnableApiLogging(false);
        model = BinaryData.fromObject(model).toObject(Dapr.class);
        Assertions.assertEquals(false, model.enabled());
        Assertions.assertEquals("pbtg", model.appId());
        Assertions.assertEquals(AppProtocol.GRPC, model.appProtocol());
        Assertions.assertEquals(1911820344, model.appPort());
        Assertions.assertEquals(2105060368, model.httpReadBufferSize());
        Assertions.assertEquals(1273171944, model.httpMaxRequestSize());
        Assertions.assertEquals(LogLevel.DEBUG, model.logLevel());
        Assertions.assertEquals(false, model.enableApiLogging());
    }
}
