// 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.fluent.models.OperationInner;
import com.azure.resourcemanager.logic.models.OperationDisplay;
import com.azure.resourcemanager.logic.models.OperationListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"origin\":\"hwddkvbxgkq\",\"name\":\"ybwptda\",\"display\":{\"provider\":\"vvlfntymtp\",\"resource\":\"wenaz\",\"operation\":\"ohzrsqalsx\",\"description\":\"nwqapfgsdpcvess\"},\"properties\":\"datahhkuuip\"}],\"nextLink\":\"q\"}")
                .toObject(OperationListResult.class);
        Assertions.assertEquals("hwddkvbxgkq", model.value().get(0).origin());
        Assertions.assertEquals("ybwptda", model.value().get(0).name());
        Assertions.assertEquals("vvlfntymtp", model.value().get(0).display().provider());
        Assertions.assertEquals("wenaz", model.value().get(0).display().resource());
        Assertions.assertEquals("ohzrsqalsx", model.value().get(0).display().operation());
        Assertions.assertEquals("nwqapfgsdpcvess", model.value().get(0).display().description());
        Assertions.assertEquals("q", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationListResult model =
            new OperationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new OperationInner()
                                .withOrigin("hwddkvbxgkq")
                                .withName("ybwptda")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("vvlfntymtp")
                                        .withResource("wenaz")
                                        .withOperation("ohzrsqalsx")
                                        .withDescription("nwqapfgsdpcvess"))
                                .withProperties("datahhkuuip")))
                .withNextLink("q");
        model = BinaryData.fromObject(model).toObject(OperationListResult.class);
        Assertions.assertEquals("hwddkvbxgkq", model.value().get(0).origin());
        Assertions.assertEquals("ybwptda", model.value().get(0).name());
        Assertions.assertEquals("vvlfntymtp", model.value().get(0).display().provider());
        Assertions.assertEquals("wenaz", model.value().get(0).display().resource());
        Assertions.assertEquals("ohzrsqalsx", model.value().get(0).display().operation());
        Assertions.assertEquals("nwqapfgsdpcvess", model.value().get(0).display().description());
        Assertions.assertEquals("q", model.nextLink());
    }
}
