// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.logic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logic.models.AS2ValidationSettings;
import com.azure.resourcemanager.logic.models.EncryptionAlgorithm;
import com.azure.resourcemanager.logic.models.SigningAlgorithm;
import org.junit.jupiter.api.Assertions;

public final class AS2ValidationSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AS2ValidationSettings model =
            BinaryData
                .fromString(
                    "{\"overrideMessageProperties\":true,\"encryptMessage\":false,\"signMessage\":true,\"compressMessage\":true,\"checkDuplicateMessage\":false,\"interchangeDuplicatesValidityDays\":1349191527,\"checkCertificateRevocationListOnSend\":true,\"checkCertificateRevocationListOnReceive\":true,\"encryptionAlgorithm\":\"RC2\",\"signingAlgorithm\":\"Default\"}")
                .toObject(AS2ValidationSettings.class);
        Assertions.assertEquals(true, model.overrideMessageProperties());
        Assertions.assertEquals(false, model.encryptMessage());
        Assertions.assertEquals(true, model.signMessage());
        Assertions.assertEquals(true, model.compressMessage());
        Assertions.assertEquals(false, model.checkDuplicateMessage());
        Assertions.assertEquals(1349191527, model.interchangeDuplicatesValidityDays());
        Assertions.assertEquals(true, model.checkCertificateRevocationListOnSend());
        Assertions.assertEquals(true, model.checkCertificateRevocationListOnReceive());
        Assertions.assertEquals(EncryptionAlgorithm.RC2, model.encryptionAlgorithm());
        Assertions.assertEquals(SigningAlgorithm.DEFAULT, model.signingAlgorithm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AS2ValidationSettings model =
            new AS2ValidationSettings()
                .withOverrideMessageProperties(true)
                .withEncryptMessage(false)
                .withSignMessage(true)
                .withCompressMessage(true)
                .withCheckDuplicateMessage(false)
                .withInterchangeDuplicatesValidityDays(1349191527)
                .withCheckCertificateRevocationListOnSend(true)
                .withCheckCertificateRevocationListOnReceive(true)
                .withEncryptionAlgorithm(EncryptionAlgorithm.RC2)
                .withSigningAlgorithm(SigningAlgorithm.DEFAULT);
        model = BinaryData.fromObject(model).toObject(AS2ValidationSettings.class);
        Assertions.assertEquals(true, model.overrideMessageProperties());
        Assertions.assertEquals(false, model.encryptMessage());
        Assertions.assertEquals(true, model.signMessage());
        Assertions.assertEquals(true, model.compressMessage());
        Assertions.assertEquals(false, model.checkDuplicateMessage());
        Assertions.assertEquals(1349191527, model.interchangeDuplicatesValidityDays());
        Assertions.assertEquals(true, model.checkCertificateRevocationListOnSend());
        Assertions.assertEquals(true, model.checkCertificateRevocationListOnReceive());
        Assertions.assertEquals(EncryptionAlgorithm.RC2, model.encryptionAlgorithm());
        Assertions.assertEquals(SigningAlgorithm.DEFAULT, model.signingAlgorithm());
    }
}
