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

package com.azure.resourcemanager.securitydevops.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.securitydevops.models.AutoDiscovery;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsOrgMetadata;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsProjectMetadata;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class AzureDevOpsOrgMetadataTests {
    @Test
    public void testDeserialize() {
        AzureDevOpsOrgMetadata model =
            BinaryData
                .fromString(
                    "{\"name\":\"cryuan\",\"autoDiscovery\":\"Disabled\",\"projects\":[{\"name\":\"xtayr\",\"autoDiscovery\":\"Disabled\",\"repos\":[\"fp\",\"rqobmtuk\",\"nryrtihf\",\"tijbpzvgnwzsymgl\"]},{\"name\":\"fcyzkohdbihanufh\",\"autoDiscovery\":\"Disabled\",\"repos\":[\"s\"]},{\"name\":\"ithxqhabifpi\",\"autoDiscovery\":\"Disabled\",\"repos\":[\"byscnp\"]},{\"name\":\"uhivyqniw\",\"autoDiscovery\":\"Disabled\",\"repos\":[\"xvd\"]}]}")
                .toObject(AzureDevOpsOrgMetadata.class);
        Assertions.assertEquals("cryuan", model.name());
        Assertions.assertEquals(AutoDiscovery.DISABLED, model.autoDiscovery());
        Assertions.assertEquals("xtayr", model.projects().get(0).name());
        Assertions.assertEquals(AutoDiscovery.DISABLED, model.projects().get(0).autoDiscovery());
        Assertions.assertEquals("fp", model.projects().get(0).repos().get(0));
    }

    @Test
    public void testSerialize() {
        AzureDevOpsOrgMetadata model =
            new AzureDevOpsOrgMetadata()
                .withName("cryuan")
                .withAutoDiscovery(AutoDiscovery.DISABLED)
                .withProjects(
                    Arrays
                        .asList(
                            new AzureDevOpsProjectMetadata()
                                .withName("xtayr")
                                .withAutoDiscovery(AutoDiscovery.DISABLED)
                                .withRepos(Arrays.asList("fp", "rqobmtuk", "nryrtihf", "tijbpzvgnwzsymgl")),
                            new AzureDevOpsProjectMetadata()
                                .withName("fcyzkohdbihanufh")
                                .withAutoDiscovery(AutoDiscovery.DISABLED)
                                .withRepos(Arrays.asList("s")),
                            new AzureDevOpsProjectMetadata()
                                .withName("ithxqhabifpi")
                                .withAutoDiscovery(AutoDiscovery.DISABLED)
                                .withRepos(Arrays.asList("byscnp")),
                            new AzureDevOpsProjectMetadata()
                                .withName("uhivyqniw")
                                .withAutoDiscovery(AutoDiscovery.DISABLED)
                                .withRepos(Arrays.asList("xvd"))));
        model = BinaryData.fromObject(model).toObject(AzureDevOpsOrgMetadata.class);
        Assertions.assertEquals("cryuan", model.name());
        Assertions.assertEquals(AutoDiscovery.DISABLED, model.autoDiscovery());
        Assertions.assertEquals("xtayr", model.projects().get(0).name());
        Assertions.assertEquals(AutoDiscovery.DISABLED, model.projects().get(0).autoDiscovery());
        Assertions.assertEquals("fp", model.projects().get(0).repos().get(0));
    }
}
