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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.fluent.models.SourceControlInner;
import com.azure.resourcemanager.appcontainers.models.SourceControlCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SourceControlCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SourceControlCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"operationState\":\"Succeeded\",\"repoUrl\":\"qucwyhahnom\",\"branch\":\"kywuhpsvfuu\"},\"id\":\"lwexxwl\",\"name\":\"lniexz\",\"type\":\"rzpgep\"},{\"properties\":{\"operationState\":\"InProgress\",\"repoUrl\":\"wwpgdakchzyvlixq\",\"branch\":\"kcxk\"},\"id\":\"nxm\",\"name\":\"suxswqrntvlwijp\",\"type\":\"ttexoqqpwcyyufmh\"},{\"properties\":{\"operationState\":\"Succeeded\",\"repoUrl\":\"wmqs\",\"branch\":\"cdqzhlctddu\"},\"id\":\"dyfpchrqbnj\",\"name\":\"rcgegydcwboxjum\",\"type\":\"qqoli\"}],\"nextLink\":\"raiouaubrjtl\"}")
                .toObject(SourceControlCollection.class);
        Assertions.assertEquals("qucwyhahnom", model.value().get(0).repoUrl());
        Assertions.assertEquals("kywuhpsvfuu", model.value().get(0).branch());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SourceControlCollection model =
            new SourceControlCollection()
                .withValue(
                    Arrays
                        .asList(
                            new SourceControlInner().withRepoUrl("qucwyhahnom").withBranch("kywuhpsvfuu"),
                            new SourceControlInner().withRepoUrl("wwpgdakchzyvlixq").withBranch("kcxk"),
                            new SourceControlInner().withRepoUrl("wmqs").withBranch("cdqzhlctddu")));
        model = BinaryData.fromObject(model).toObject(SourceControlCollection.class);
        Assertions.assertEquals("qucwyhahnom", model.value().get(0).repoUrl());
        Assertions.assertEquals("kywuhpsvfuu", model.value().get(0).branch());
    }
}
