// 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.PolicyInner;
import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy;
import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy;
import com.azure.resourcemanager.billing.models.ViewChargesPolicy;
import org.junit.jupiter.api.Assertions;

public final class PolicyInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PolicyInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"marketplacePurchases\":\"AllAllowed\",\"reservationPurchases\":\"NotAllowed\",\"viewCharges\":\"Allowed\"},\"id\":\"joqrvqqaatj\",\"name\":\"nrvgoupmfiibfgg\",\"type\":\"ioolvrwxkvtkkgll\"}")
                .toObject(PolicyInner.class);
        Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, model.marketplacePurchases());
        Assertions.assertEquals(ReservationPurchasesPolicy.NOT_ALLOWED, model.reservationPurchases());
        Assertions.assertEquals(ViewChargesPolicy.ALLOWED, model.viewCharges());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PolicyInner model =
            new PolicyInner()
                .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED)
                .withReservationPurchases(ReservationPurchasesPolicy.NOT_ALLOWED)
                .withViewCharges(ViewChargesPolicy.ALLOWED);
        model = BinaryData.fromObject(model).toObject(PolicyInner.class);
        Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, model.marketplacePurchases());
        Assertions.assertEquals(ReservationPurchasesPolicy.NOT_ALLOWED, model.reservationPurchases());
        Assertions.assertEquals(ViewChargesPolicy.ALLOWED, model.viewCharges());
    }
}
