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

package com.azure.resourcemanager.devtestlabs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageProperties;
import com.azure.resourcemanager.devtestlabs.models.GalleryImageReference;
import org.junit.jupiter.api.Assertions;

public final class GalleryImagePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GalleryImageProperties model =
            BinaryData
                .fromString(
                    "{\"author\":\"rnjwmw\",\"createdDate\":\"2021-03-16T02:28:23Z\",\"description\":\"saz\",\"imageReference\":{\"offer\":\"oqkag\",\"publisher\":\"sxtta\",\"sku\":\"zxnfaaz\",\"osType\":\"dtnkdmkq\",\"version\":\"lwuenvrkp\"},\"icon\":\"uaibrebqaaysj\",\"enabled\":false,\"planId\":\"tnqttezlwfffiak\",\"isPlanAuthorized\":false}")
                .toObject(GalleryImageProperties.class);
        Assertions.assertEquals("rnjwmw", model.author());
        Assertions.assertEquals("saz", model.description());
        Assertions.assertEquals("oqkag", model.imageReference().offer());
        Assertions.assertEquals("sxtta", model.imageReference().publisher());
        Assertions.assertEquals("zxnfaaz", model.imageReference().sku());
        Assertions.assertEquals("dtnkdmkq", model.imageReference().osType());
        Assertions.assertEquals("lwuenvrkp", model.imageReference().version());
        Assertions.assertEquals("uaibrebqaaysj", model.icon());
        Assertions.assertEquals(false, model.enabled());
        Assertions.assertEquals("tnqttezlwfffiak", model.planId());
        Assertions.assertEquals(false, model.isPlanAuthorized());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GalleryImageProperties model =
            new GalleryImageProperties()
                .withAuthor("rnjwmw")
                .withDescription("saz")
                .withImageReference(
                    new GalleryImageReference()
                        .withOffer("oqkag")
                        .withPublisher("sxtta")
                        .withSku("zxnfaaz")
                        .withOsType("dtnkdmkq")
                        .withVersion("lwuenvrkp"))
                .withIcon("uaibrebqaaysj")
                .withEnabled(false)
                .withPlanId("tnqttezlwfffiak")
                .withIsPlanAuthorized(false);
        model = BinaryData.fromObject(model).toObject(GalleryImageProperties.class);
        Assertions.assertEquals("rnjwmw", model.author());
        Assertions.assertEquals("saz", model.description());
        Assertions.assertEquals("oqkag", model.imageReference().offer());
        Assertions.assertEquals("sxtta", model.imageReference().publisher());
        Assertions.assertEquals("zxnfaaz", model.imageReference().sku());
        Assertions.assertEquals("dtnkdmkq", model.imageReference().osType());
        Assertions.assertEquals("lwuenvrkp", model.imageReference().version());
        Assertions.assertEquals("uaibrebqaaysj", model.icon());
        Assertions.assertEquals(false, model.enabled());
        Assertions.assertEquals("tnqttezlwfffiak", model.planId());
        Assertions.assertEquals(false, model.isPlanAuthorized());
    }
}
