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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.models.EnforcementMode;
import com.azure.resourcemanager.security.models.ProtectionMode;
import org.junit.jupiter.api.Assertions;

public final class ProtectionModeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ProtectionMode model =
            BinaryData
                .fromString("{\"exe\":\"Audit\",\"msi\":\"None\",\"script\":\"Enforce\",\"executable\":\"None\"}")
                .toObject(ProtectionMode.class);
        Assertions.assertEquals(EnforcementMode.AUDIT, model.exe());
        Assertions.assertEquals(EnforcementMode.NONE, model.msi());
        Assertions.assertEquals(EnforcementMode.ENFORCE, model.script());
        Assertions.assertEquals(EnforcementMode.NONE, model.executable());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ProtectionMode model =
            new ProtectionMode()
                .withExe(EnforcementMode.AUDIT)
                .withMsi(EnforcementMode.NONE)
                .withScript(EnforcementMode.ENFORCE)
                .withExecutable(EnforcementMode.NONE);
        model = BinaryData.fromObject(model).toObject(ProtectionMode.class);
        Assertions.assertEquals(EnforcementMode.AUDIT, model.exe());
        Assertions.assertEquals(EnforcementMode.NONE, model.msi());
        Assertions.assertEquals(EnforcementMode.ENFORCE, model.script());
        Assertions.assertEquals(EnforcementMode.NONE, model.executable());
    }
}
