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

public final class UnauthorizedOperationsNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UnauthorizedOperationsNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"UnauthorizedOperationsNotInAllowedRange\",\"timeWindowSize\":\"PT231H33M53S\",\"minThreshold\":1033707853,\"maxThreshold\":395818123,\"displayName\":\"u\",\"description\":\"sqxutr\",\"isEnabled\":true}")
                .toObject(UnauthorizedOperationsNotInAllowedRange.class);
        Assertions.assertEquals(true, model.isEnabled());
        Assertions.assertEquals(1033707853, model.minThreshold());
        Assertions.assertEquals(395818123, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT231H33M53S"), model.timeWindowSize());
    }

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