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

public final class HttpC2DMessagesNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        HttpC2DMessagesNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"HttpC2DMessagesNotInAllowedRange\",\"timeWindowSize\":\"PT97H37M31S\",\"minThreshold\":1748294835,\"maxThreshold\":94404068,\"displayName\":\"mouvbl\",\"description\":\"okzkltr\",\"isEnabled\":true}")
                .toObject(HttpC2DMessagesNotInAllowedRange.class);
        Assertions.assertEquals(true, model.isEnabled());
        Assertions.assertEquals(1748294835, model.minThreshold());
        Assertions.assertEquals(94404068, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT97H37M31S"), model.timeWindowSize());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        HttpC2DMessagesNotInAllowedRange model =
            new HttpC2DMessagesNotInAllowedRange()
                .withIsEnabled(true)
                .withMinThreshold(1748294835)
                .withMaxThreshold(94404068)
                .withTimeWindowSize(Duration.parse("PT97H37M31S"));
        model = BinaryData.fromObject(model).toObject(HttpC2DMessagesNotInAllowedRange.class);
        Assertions.assertEquals(true, model.isEnabled());
        Assertions.assertEquals(1748294835, model.minThreshold());
        Assertions.assertEquals(94404068, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT97H37M31S"), model.timeWindowSize());
    }
}
