// 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.AmqpC2DMessagesNotInAllowedRange;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class AmqpC2DMessagesNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AmqpC2DMessagesNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"AmqpC2DMessagesNotInAllowedRange\",\"timeWindowSize\":\"PT71H1M20S\",\"minThreshold\":1281785865,\"maxThreshold\":384532828,\"displayName\":\"adppyibn\",\"description\":\"ladywrxwhyd\",\"isEnabled\":false}")
                .toObject(AmqpC2DMessagesNotInAllowedRange.class);
        Assertions.assertEquals(false, model.isEnabled());
        Assertions.assertEquals(1281785865, model.minThreshold());
        Assertions.assertEquals(384532828, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT71H1M20S"), model.timeWindowSize());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AmqpC2DMessagesNotInAllowedRange model =
            new AmqpC2DMessagesNotInAllowedRange()
                .withIsEnabled(false)
                .withMinThreshold(1281785865)
                .withMaxThreshold(384532828)
                .withTimeWindowSize(Duration.parse("PT71H1M20S"));
        model = BinaryData.fromObject(model).toObject(AmqpC2DMessagesNotInAllowedRange.class);
        Assertions.assertEquals(false, model.isEnabled());
        Assertions.assertEquals(1281785865, model.minThreshold());
        Assertions.assertEquals(384532828, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT71H1M20S"), model.timeWindowSize());
    }
}
