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

public final class DirectMethodInvokesNotInAllowedRangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DirectMethodInvokesNotInAllowedRange model =
            BinaryData
                .fromString(
                    "{\"ruleType\":\"DirectMethodInvokesNotInAllowedRange\",\"timeWindowSize\":\"PT14H59M6S\",\"minThreshold\":2142539902,\"maxThreshold\":629230880,\"displayName\":\"isczskoswo\",\"description\":\"qazu\",\"isEnabled\":false}")
                .toObject(DirectMethodInvokesNotInAllowedRange.class);
        Assertions.assertEquals(false, model.isEnabled());
        Assertions.assertEquals(2142539902, model.minThreshold());
        Assertions.assertEquals(629230880, model.maxThreshold());
        Assertions.assertEquals(Duration.parse("PT14H59M6S"), model.timeWindowSize());
    }

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