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

package com.azure.resourcemanager.networkcloud.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.networkcloud.models.VirtualMachinePlacementHint;
import com.azure.resourcemanager.networkcloud.models.VirtualMachinePlacementHintPodAffinityScope;
import com.azure.resourcemanager.networkcloud.models.VirtualMachinePlacementHintType;
import com.azure.resourcemanager.networkcloud.models.VirtualMachineSchedulingExecution;
import org.junit.jupiter.api.Assertions;

public final class VirtualMachinePlacementHintTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VirtualMachinePlacementHint model =
            BinaryData
                .fromString(
                    "{\"hintType\":\"AntiAffinity\",\"resourceId\":\"etoge\",\"schedulingExecution\":\"Soft\",\"scope\":\"Rack\"}")
                .toObject(VirtualMachinePlacementHint.class);
        Assertions.assertEquals(VirtualMachinePlacementHintType.ANTI_AFFINITY, model.hintType());
        Assertions.assertEquals("etoge", model.resourceId());
        Assertions.assertEquals(VirtualMachineSchedulingExecution.SOFT, model.schedulingExecution());
        Assertions.assertEquals(VirtualMachinePlacementHintPodAffinityScope.RACK, model.scope());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VirtualMachinePlacementHint model =
            new VirtualMachinePlacementHint()
                .withHintType(VirtualMachinePlacementHintType.ANTI_AFFINITY)
                .withResourceId("etoge")
                .withSchedulingExecution(VirtualMachineSchedulingExecution.SOFT)
                .withScope(VirtualMachinePlacementHintPodAffinityScope.RACK);
        model = BinaryData.fromObject(model).toObject(VirtualMachinePlacementHint.class);
        Assertions.assertEquals(VirtualMachinePlacementHintType.ANTI_AFFINITY, model.hintType());
        Assertions.assertEquals("etoge", model.resourceId());
        Assertions.assertEquals(VirtualMachineSchedulingExecution.SOFT, model.schedulingExecution());
        Assertions.assertEquals(VirtualMachinePlacementHintPodAffinityScope.RACK, model.scope());
    }
}
