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

public final class ActiveConnectionsNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ActiveConnectionsNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"ActiveConnectionsNotInAllowedRange\",\"timeWindowSize\":\"PT166H22M2S\",\"minThreshold\":1327259513,\"maxThreshold\":713961317,\"displayName\":\"n\",\"description\":\"mehllizhceu\",\"isEnabled\":true}")
                .toObject(ActiveConnectionsNotInAllowedRange.class);
        Assertions.assertEquals(true, model.isEnabled());
        Assertions.assertEquals(1327259513, model.minThreshold());
        Assertions.assertEquals(713961317, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT166H22M2S"), model.timeWindowSize());
    }

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