// 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.ProductProperties;
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 ProductPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ProductProperties model =
            BinaryData
                .fromString(
                    "{\"autoRenew\":\"Off\",\"displayName\":\"mond\",\"purchaseDate\":\"2021-04-01T23:21:50Z\",\"productTypeId\":\"xvy\",\"productType\":\"mg\",\"status\":\"Expired\",\"endDate\":\"2021-02-23T14:11:02Z\",\"billingFrequency\":\"OneTime\",\"lastCharge\":{\"currency\":\"pajqgxysm\",\"value\":44.408627},\"lastChargeDate\":\"2021-03-21T23:12:31Z\",\"quantity\":40.273422,\"skuId\":\"mkcxozapvh\",\"skuDescription\":\"xprglyatddc\",\"tenantId\":\"bcuejrjxgci\",\"availabilityId\":\"brh\",\"invoiceSectionId\":\"xsdqrhzoymibmrqy\",\"invoiceSectionDisplayName\":\"ahwfluszdtmhrk\",\"billingProfileId\":\"fyyvoq\",\"billingProfileDisplayName\":\"piexpbtgiw\",\"customerId\":\"oenwashr\",\"customerDisplayName\":\"tkcnqxwb\",\"reseller\":{\"resellerId\":\"ulpiuj\",\"description\":\"asipqiio\"}}")
                .toObject(ProductProperties.class);
        Assertions.assertEquals(AutoRenew.OFF, model.autoRenew());
        Assertions.assertEquals(ProductStatusType.EXPIRED, model.status());
        Assertions.assertEquals(BillingFrequency.ONE_TIME, model.billingFrequency());
    }

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