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

package com.azure.resourcemanager.netapp.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.netapp.fluent.models.ReplicationInner;
import com.azure.resourcemanager.netapp.models.EndpointType;
import com.azure.resourcemanager.netapp.models.ListReplications;
import com.azure.resourcemanager.netapp.models.ReplicationSchedule;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ListReplicationsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ListReplications model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"endpointType\":\"dst\",\"replicationSchedule\":\"hourly\",\"remoteVolumeResourceId\":\"hahvljuahaq\",\"remoteVolumeRegion\":\"c\"},{\"endpointType\":\"src\",\"replicationSchedule\":\"hourly\",\"remoteVolumeResourceId\":\"alaexqpvfadmwsrc\",\"remoteVolumeRegion\":\"vxpvgomz\"},{\"endpointType\":\"src\",\"replicationSchedule\":\"_10minutely\",\"remoteVolumeResourceId\":\"gwb\",\"remoteVolumeRegion\":\"beldawkzbaliourq\"}]}")
                .toObject(ListReplications.class);
        Assertions.assertEquals(EndpointType.DST, model.value().get(0).endpointType());
        Assertions.assertEquals(ReplicationSchedule.HOURLY, model.value().get(0).replicationSchedule());
        Assertions.assertEquals("hahvljuahaq", model.value().get(0).remoteVolumeResourceId());
        Assertions.assertEquals("c", model.value().get(0).remoteVolumeRegion());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ListReplications model =
            new ListReplications()
                .withValue(
                    Arrays
                        .asList(
                            new ReplicationInner()
                                .withEndpointType(EndpointType.DST)
                                .withReplicationSchedule(ReplicationSchedule.HOURLY)
                                .withRemoteVolumeResourceId("hahvljuahaq")
                                .withRemoteVolumeRegion("c"),
                            new ReplicationInner()
                                .withEndpointType(EndpointType.SRC)
                                .withReplicationSchedule(ReplicationSchedule.HOURLY)
                                .withRemoteVolumeResourceId("alaexqpvfadmwsrc")
                                .withRemoteVolumeRegion("vxpvgomz"),
                            new ReplicationInner()
                                .withEndpointType(EndpointType.SRC)
                                .withReplicationSchedule(ReplicationSchedule.ONE_ZEROMINUTELY)
                                .withRemoteVolumeResourceId("gwb")
                                .withRemoteVolumeRegion("beldawkzbaliourq")));
        model = BinaryData.fromObject(model).toObject(ListReplications.class);
        Assertions.assertEquals(EndpointType.DST, model.value().get(0).endpointType());
        Assertions.assertEquals(ReplicationSchedule.HOURLY, model.value().get(0).replicationSchedule());
        Assertions.assertEquals("hahvljuahaq", model.value().get(0).remoteVolumeResourceId());
        Assertions.assertEquals("c", model.value().get(0).remoteVolumeRegion());
    }
}
