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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.models.ResourceIdentity;
import com.azure.resourcemanager.mediaservices.models.StorageAccount;
import com.azure.resourcemanager.mediaservices.models.StorageAccountType;
import org.junit.jupiter.api.Assertions;

public final class StorageAccountTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        StorageAccount model =
            BinaryData
                .fromString(
                    "{\"id\":\"fkgukdkexxppof\",\"type\":\"Secondary\",\"identity\":{\"userAssignedIdentity\":\"c\",\"useSystemAssignedIdentity\":false},\"status\":\"gddtocj\"}")
                .toObject(StorageAccount.class);
        Assertions.assertEquals("fkgukdkexxppof", model.id());
        Assertions.assertEquals(StorageAccountType.SECONDARY, model.type());
        Assertions.assertEquals("c", model.identity().userAssignedIdentity());
        Assertions.assertEquals(false, model.identity().useSystemAssignedIdentity());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        StorageAccount model =
            new StorageAccount()
                .withId("fkgukdkexxppof")
                .withType(StorageAccountType.SECONDARY)
                .withIdentity(
                    new ResourceIdentity().withUserAssignedIdentity("c").withUseSystemAssignedIdentity(false));
        model = BinaryData.fromObject(model).toObject(StorageAccount.class);
        Assertions.assertEquals("fkgukdkexxppof", model.id());
        Assertions.assertEquals(StorageAccountType.SECONDARY, model.type());
        Assertions.assertEquals("c", model.identity().userAssignedIdentity());
        Assertions.assertEquals(false, model.identity().useSystemAssignedIdentity());
    }
}
