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

package com.azure.resourcemanager.resourcegraph.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcegraph.models.FacetRequest;
import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions;
import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class FacetRequestTests {
    @Test
    public void testDeserialize() {
        FacetRequest model =
            BinaryData
                .fromString(
                    "{\"expression\":\"soqijg\",\"options\":{\"sortBy\":\"bpazlobcufpdzn\",\"sortOrder\":\"asc\",\"filter\":\"qqjnqgl\",\"$top\":2127527772}}")
                .toObject(FacetRequest.class);
        Assertions.assertEquals("soqijg", model.expression());
        Assertions.assertEquals("bpazlobcufpdzn", model.options().sortBy());
        Assertions.assertEquals(FacetSortOrder.ASC, model.options().sortOrder());
        Assertions.assertEquals("qqjnqgl", model.options().filter());
        Assertions.assertEquals(2127527772, model.options().top());
    }

    @Test
    public void testSerialize() {
        FacetRequest model =
            new FacetRequest()
                .withExpression("soqijg")
                .withOptions(
                    new FacetRequestOptions()
                        .withSortBy("bpazlobcufpdzn")
                        .withSortOrder(FacetSortOrder.ASC)
                        .withFilter("qqjnqgl")
                        .withTop(2127527772));
        model = BinaryData.fromObject(model).toObject(FacetRequest.class);
        Assertions.assertEquals("soqijg", model.expression());
        Assertions.assertEquals("bpazlobcufpdzn", model.options().sortBy());
        Assertions.assertEquals(FacetSortOrder.ASC, model.options().sortOrder());
        Assertions.assertEquals("qqjnqgl", model.options().filter());
        Assertions.assertEquals(2127527772, model.options().top());
    }
}
