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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.models.TrackPropertyCompareOperation;
import com.azure.resourcemanager.mediaservices.models.TrackPropertyCondition;
import com.azure.resourcemanager.mediaservices.models.TrackPropertyType;
import com.azure.resourcemanager.mediaservices.models.TrackSelection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class TrackSelectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TrackSelection model =
            BinaryData
                .fromString(
                    "{\"trackSelections\":[{\"property\":\"FourCC\",\"operation\":\"Unknown\",\"value\":\"bjf\"},{\"property\":\"Unknown\",\"operation\":\"Unknown\",\"value\":\"sotftpvj\"}]}")
                .toObject(TrackSelection.class);
        Assertions.assertEquals(TrackPropertyType.FOUR_CC, model.trackSelections().get(0).property());
        Assertions.assertEquals(TrackPropertyCompareOperation.UNKNOWN, model.trackSelections().get(0).operation());
        Assertions.assertEquals("bjf", model.trackSelections().get(0).value());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TrackSelection model =
            new TrackSelection()
                .withTrackSelections(
                    Arrays
                        .asList(
                            new TrackPropertyCondition()
                                .withProperty(TrackPropertyType.FOUR_CC)
                                .withOperation(TrackPropertyCompareOperation.UNKNOWN)
                                .withValue("bjf"),
                            new TrackPropertyCondition()
                                .withProperty(TrackPropertyType.UNKNOWN)
                                .withOperation(TrackPropertyCompareOperation.UNKNOWN)
                                .withValue("sotftpvj")));
        model = BinaryData.fromObject(model).toObject(TrackSelection.class);
        Assertions.assertEquals(TrackPropertyType.FOUR_CC, model.trackSelections().get(0).property());
        Assertions.assertEquals(TrackPropertyCompareOperation.UNKNOWN, model.trackSelections().get(0).operation());
        Assertions.assertEquals("bjf", model.trackSelections().get(0).value());
    }
}
