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

package com.azure.resourcemanager.devcenter.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devcenter.fluent.models.ProjectInner;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class ProjectInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ProjectInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"provisioningState\":\"MovingResources\",\"devCenterUri\":\"gakeqsr\",\"devCenterId\":\"bzqqedqytbciq\",\"description\":\"uflmm\",\"maxDevBoxesPerUser\":799119693},\"location\":\"modmglougpb\",\"tags\":{\"wgcu\":\"mutduqktaps\"},\"id\":\"rtumkdosvq\",\"name\":\"hbmdgbbjfdd\",\"type\":\"mbmbexppbh\"}")
                .toObject(ProjectInner.class);
        Assertions.assertEquals("modmglougpb", model.location());
        Assertions.assertEquals("mutduqktaps", model.tags().get("wgcu"));
        Assertions.assertEquals("bzqqedqytbciq", model.devCenterId());
        Assertions.assertEquals("uflmm", model.description());
        Assertions.assertEquals(799119693, model.maxDevBoxesPerUser());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ProjectInner model =
            new ProjectInner()
                .withLocation("modmglougpb")
                .withTags(mapOf("wgcu", "mutduqktaps"))
                .withDevCenterId("bzqqedqytbciq")
                .withDescription("uflmm")
                .withMaxDevBoxesPerUser(799119693);
        model = BinaryData.fromObject(model).toObject(ProjectInner.class);
        Assertions.assertEquals("modmglougpb", model.location());
        Assertions.assertEquals("mutduqktaps", model.tags().get("wgcu"));
        Assertions.assertEquals("bzqqedqytbciq", model.devCenterId());
        Assertions.assertEquals("uflmm", model.description());
        Assertions.assertEquals(799119693, model.maxDevBoxesPerUser());
    }

    @SuppressWarnings("unchecked")
    private static <T> Map<String, T> mapOf(Object... inputs) {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < inputs.length; i += 2) {
            String key = (String) inputs[i];
            T value = (T) inputs[i + 1];
            map.put(key, value);
        }
        return map;
    }
}
