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

public final class MqttC2DMessagesNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MqttC2DMessagesNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"MqttC2DMessagesNotInAllowedRange\",\"timeWindowSize\":\"PT44H32M11S\",\"minThreshold\":2052753548,\"maxThreshold\":1662063978,\"displayName\":\"ds\",\"description\":\"snuyemlowuowhl\",\"isEnabled\":false}")
                .toObject(MqttC2DMessagesNotInAllowedRange.class);
        Assertions.assertEquals(false, model.isEnabled());
        Assertions.assertEquals(2052753548, model.minThreshold());
        Assertions.assertEquals(1662063978, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT44H32M11S"), model.timeWindowSize());
    }

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