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

package com.azure.resourcemanager.billing.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.billing.fluent.models.ProductInner;
import com.azure.resourcemanager.billing.models.AutoRenew;
import com.azure.resourcemanager.billing.models.BillingFrequency;
import com.azure.resourcemanager.billing.models.ProductStatusType;
import org.junit.jupiter.api.Assertions;

public final class ProductInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ProductInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"autoRenew\":\"Off\",\"displayName\":\"vithh\",\"purchaseDate\":\"2021-10-25T20:46:01Z\",\"productTypeId\":\"osggbhc\",\"productType\":\"fwdsj\",\"status\":\"Disabled\",\"endDate\":\"2021-06-21T07:46:59Z\",\"billingFrequency\":\"Monthly\",\"lastCharge\":{\"currency\":\"swacffgdkzz\",\"value\":79.305},\"lastChargeDate\":\"2021-09-11T04:06:27Z\",\"quantity\":91.20859,\"skuId\":\"railvpnppfuf\",\"skuDescription\":\"wdmhdlxyjrxs\",\"tenantId\":\"afcnih\",\"availabilityId\":\"qapnedgfbcv\",\"invoiceSectionId\":\"vq\",\"invoiceSectionDisplayName\":\"keqdcvdrhvoods\",\"billingProfileId\":\"bobzdopcjwvnhd\",\"billingProfileDisplayName\":\"wmgxcxrsl\",\"customerId\":\"utwu\",\"customerDisplayName\":\"grpkhjwniyqs\",\"reseller\":{\"resellerId\":\"cpdggkzzlvmbmp\",\"description\":\"modfvuefywsbpfvm\"}},\"id\":\"yhrfouyftaakcpw\",\"name\":\"yzvqt\",\"type\":\"nubexk\"}")
                .toObject(ProductInner.class);
        Assertions.assertEquals(AutoRenew.OFF, model.autoRenew());
        Assertions.assertEquals(ProductStatusType.DISABLED, model.status());
        Assertions.assertEquals(BillingFrequency.MONTHLY, model.billingFrequency());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ProductInner model =
            new ProductInner()
                .withAutoRenew(AutoRenew.OFF)
                .withStatus(ProductStatusType.DISABLED)
                .withBillingFrequency(BillingFrequency.MONTHLY);
        model = BinaryData.fromObject(model).toObject(ProductInner.class);
        Assertions.assertEquals(AutoRenew.OFF, model.autoRenew());
        Assertions.assertEquals(ProductStatusType.DISABLED, model.status());
        Assertions.assertEquals(BillingFrequency.MONTHLY, model.billingFrequency());
    }
}
