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

package com.azure.resourcemanager.devtestlabs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyProperties;
import com.azure.resourcemanager.devtestlabs.models.PolicyEvaluatorType;
import com.azure.resourcemanager.devtestlabs.models.PolicyFactName;
import com.azure.resourcemanager.devtestlabs.models.PolicyStatus;
import org.junit.jupiter.api.Assertions;

public final class PolicyPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PolicyProperties model =
            BinaryData
                .fromString(
                    "{\"description\":\"stgktst\",\"status\":\"Disabled\",\"factName\":\"UserOwnedLabVmCountInSubnet\",\"factData\":\"zedqbcvhzlhplo\",\"threshold\":\"kdl\",\"evaluatorType\":\"MaxValuePolicy\",\"createdDate\":\"2021-11-27T06:32:05Z\",\"provisioningState\":\"mlkxtrqjfs\",\"uniqueIdentifier\":\"mbtxhwgf\"}")
                .toObject(PolicyProperties.class);
        Assertions.assertEquals("stgktst", model.description());
        Assertions.assertEquals(PolicyStatus.DISABLED, model.status());
        Assertions.assertEquals(PolicyFactName.USER_OWNED_LAB_VM_COUNT_IN_SUBNET, model.factName());
        Assertions.assertEquals("zedqbcvhzlhplo", model.factData());
        Assertions.assertEquals("kdl", model.threshold());
        Assertions.assertEquals(PolicyEvaluatorType.MAX_VALUE_POLICY, model.evaluatorType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PolicyProperties model =
            new PolicyProperties()
                .withDescription("stgktst")
                .withStatus(PolicyStatus.DISABLED)
                .withFactName(PolicyFactName.USER_OWNED_LAB_VM_COUNT_IN_SUBNET)
                .withFactData("zedqbcvhzlhplo")
                .withThreshold("kdl")
                .withEvaluatorType(PolicyEvaluatorType.MAX_VALUE_POLICY);
        model = BinaryData.fromObject(model).toObject(PolicyProperties.class);
        Assertions.assertEquals("stgktst", model.description());
        Assertions.assertEquals(PolicyStatus.DISABLED, model.status());
        Assertions.assertEquals(PolicyFactName.USER_OWNED_LAB_VM_COUNT_IN_SUBNET, model.factName());
        Assertions.assertEquals("zedqbcvhzlhplo", model.factData());
        Assertions.assertEquals("kdl", model.threshold());
        Assertions.assertEquals(PolicyEvaluatorType.MAX_VALUE_POLICY, model.evaluatorType());
    }
}
