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

package com.azure.resourcemanager.batch.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.batch.models.AutoStorageAuthenticationMode;
import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties;
import com.azure.resourcemanager.batch.models.ComputeNodeIdentityReference;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class AutoStorageBasePropertiesTests {
    @Test
    public void testDeserialize() {
        AutoStorageBaseProperties model =
            BinaryData
                .fromString(
                    "{\"storageAccountId\":\"lhqgnufooojy\",\"authenticationMode\":\"BatchAccountManagedIdentity\",\"nodeIdentityReference\":{\"resourceId\":\"esaagdfm\"}}")
                .toObject(AutoStorageBaseProperties.class);
        Assertions.assertEquals("lhqgnufooojy", model.storageAccountId());
        Assertions
            .assertEquals(AutoStorageAuthenticationMode.BATCH_ACCOUNT_MANAGED_IDENTITY, model.authenticationMode());
        Assertions.assertEquals("esaagdfm", model.nodeIdentityReference().resourceId());
    }

    @Test
    public void testSerialize() {
        AutoStorageBaseProperties model =
            new AutoStorageBaseProperties()
                .withStorageAccountId("lhqgnufooojy")
                .withAuthenticationMode(AutoStorageAuthenticationMode.BATCH_ACCOUNT_MANAGED_IDENTITY)
                .withNodeIdentityReference(new ComputeNodeIdentityReference().withResourceId("esaagdfm"));
        model = BinaryData.fromObject(model).toObject(AutoStorageBaseProperties.class);
        Assertions.assertEquals("lhqgnufooojy", model.storageAccountId());
        Assertions
            .assertEquals(AutoStorageAuthenticationMode.BATCH_ACCOUNT_MANAGED_IDENTITY, model.authenticationMode());
        Assertions.assertEquals("esaagdfm", model.nodeIdentityReference().resourceId());
    }
}
