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

package com.azure.resourcemanager.billingbenefits.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.billingbenefits.models.AppliedScopeProperties;
import com.azure.resourcemanager.billingbenefits.models.AppliedScopeType;
import com.azure.resourcemanager.billingbenefits.models.RenewProperties;
import com.azure.resourcemanager.billingbenefits.models.SavingsPlanUpdateRequest;
import com.azure.resourcemanager.billingbenefits.models.SavingsPlanUpdateRequestProperties;
import org.junit.jupiter.api.Assertions;

public final class SavingsPlanUpdateRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SavingsPlanUpdateRequest model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"displayName\":\"c\",\"appliedScopeType\":\"Shared\",\"appliedScopeProperties\":{\"tenantId\":\"dpydn\",\"managementGroupId\":\"hxdeoejz\",\"subscriptionId\":\"w\",\"resourceGroupId\":\"sjttgzfbish\",\"displayName\":\"khaj\"},\"renew\":true,\"renewProperties\":{}}}")
                .toObject(SavingsPlanUpdateRequest.class);
        Assertions.assertEquals("c", model.properties().displayName());
        Assertions.assertEquals(AppliedScopeType.SHARED, model.properties().appliedScopeType());
        Assertions.assertEquals("dpydn", model.properties().appliedScopeProperties().tenantId());
        Assertions.assertEquals("hxdeoejz", model.properties().appliedScopeProperties().managementGroupId());
        Assertions.assertEquals("w", model.properties().appliedScopeProperties().subscriptionId());
        Assertions.assertEquals("sjttgzfbish", model.properties().appliedScopeProperties().resourceGroupId());
        Assertions.assertEquals("khaj", model.properties().appliedScopeProperties().displayName());
        Assertions.assertEquals(true, model.properties().renew());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SavingsPlanUpdateRequest model =
            new SavingsPlanUpdateRequest()
                .withProperties(
                    new SavingsPlanUpdateRequestProperties()
                        .withDisplayName("c")
                        .withAppliedScopeType(AppliedScopeType.SHARED)
                        .withAppliedScopeProperties(
                            new AppliedScopeProperties()
                                .withTenantId("dpydn")
                                .withManagementGroupId("hxdeoejz")
                                .withSubscriptionId("w")
                                .withResourceGroupId("sjttgzfbish")
                                .withDisplayName("khaj"))
                        .withRenew(true)
                        .withRenewProperties(new RenewProperties()));
        model = BinaryData.fromObject(model).toObject(SavingsPlanUpdateRequest.class);
        Assertions.assertEquals("c", model.properties().displayName());
        Assertions.assertEquals(AppliedScopeType.SHARED, model.properties().appliedScopeType());
        Assertions.assertEquals("dpydn", model.properties().appliedScopeProperties().tenantId());
        Assertions.assertEquals("hxdeoejz", model.properties().appliedScopeProperties().managementGroupId());
        Assertions.assertEquals("w", model.properties().appliedScopeProperties().subscriptionId());
        Assertions.assertEquals("sjttgzfbish", model.properties().appliedScopeProperties().resourceGroupId());
        Assertions.assertEquals("khaj", model.properties().appliedScopeProperties().displayName());
        Assertions.assertEquals(true, model.properties().renew());
    }
}
