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

package com.azure.resourcemanager.resourcemover.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcemover.fluent.models.MoveResourceInner;
import com.azure.resourcemanager.resourcemover.models.MoveResourceCollection;
import com.azure.resourcemanager.resourcemover.models.MoveResourceProperties;
import com.azure.resourcemanager.resourcemover.models.Summary;
import com.azure.resourcemanager.resourcemover.models.SummaryCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MoveResourceCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MoveResourceCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"sourceId\":\"o\",\"targetId\":\"si\",\"existingTargetId\":\"evcciqihnhun\",\"dependsOn\":[],\"dependsOnOverrides\":[],\"isResolveRequired\":true},\"id\":\"gxg\",\"name\":\"spemvtzfk\",\"type\":\"fublj\"}],\"nextLink\":\"xqeofjaeqjhqjba\",\"summaryCollection\":{\"fieldName\":\"smjqulngsntnbyb\",\"summary\":[{\"count\":823404328,\"item\":\"wclxxwrl\"}]},\"totalCount\":4597104130811079473}")
                .toObject(MoveResourceCollection.class);
        Assertions.assertEquals("o", model.value().get(0).properties().sourceId());
        Assertions.assertEquals("evcciqihnhun", model.value().get(0).properties().existingTargetId());
        Assertions.assertEquals("xqeofjaeqjhqjba", model.nextLink());
        Assertions.assertEquals("smjqulngsntnbyb", model.summaryCollection().fieldName());
        Assertions.assertEquals(823404328, model.summaryCollection().summary().get(0).count());
        Assertions.assertEquals("wclxxwrl", model.summaryCollection().summary().get(0).item());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MoveResourceCollection model =
            new MoveResourceCollection()
                .withValue(
                    Arrays
                        .asList(
                            new MoveResourceInner()
                                .withProperties(
                                    new MoveResourceProperties()
                                        .withSourceId("o")
                                        .withExistingTargetId("evcciqihnhun")
                                        .withDependsOnOverrides(Arrays.asList()))))
                .withNextLink("xqeofjaeqjhqjba")
                .withSummaryCollection(
                    new SummaryCollection()
                        .withFieldName("smjqulngsntnbyb")
                        .withSummary(Arrays.asList(new Summary().withCount(823404328).withItem("wclxxwrl"))));
        model = BinaryData.fromObject(model).toObject(MoveResourceCollection.class);
        Assertions.assertEquals("o", model.value().get(0).properties().sourceId());
        Assertions.assertEquals("evcciqihnhun", model.value().get(0).properties().existingTargetId());
        Assertions.assertEquals("xqeofjaeqjhqjba", model.nextLink());
        Assertions.assertEquals("smjqulngsntnbyb", model.summaryCollection().fieldName());
        Assertions.assertEquals(823404328, model.summaryCollection().summary().get(0).count());
        Assertions.assertEquals("wclxxwrl", model.summaryCollection().summary().get(0).item());
    }
}
