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

package com.azure.resourcemanager.reservations.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.reservations.models.CalculateRefundRequest;
import com.azure.resourcemanager.reservations.models.CalculateRefundRequestProperties;
import com.azure.resourcemanager.reservations.models.ReservationToReturn;
import org.junit.jupiter.api.Assertions;

public final class CalculateRefundRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CalculateRefundRequest model =
            BinaryData
                .fromString(
                    "{\"id\":\"pabgyeps\",\"properties\":{\"scope\":\"azqugxywpmueefj\",\"reservationToReturn\":{\"reservationId\":\"qkqujidsu\",\"quantity\":168254793}}}")
                .toObject(CalculateRefundRequest.class);
        Assertions.assertEquals("pabgyeps", model.id());
        Assertions.assertEquals("azqugxywpmueefj", model.properties().scope());
        Assertions.assertEquals("qkqujidsu", model.properties().reservationToReturn().reservationId());
        Assertions.assertEquals(168254793, model.properties().reservationToReturn().quantity());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CalculateRefundRequest model =
            new CalculateRefundRequest()
                .withId("pabgyeps")
                .withProperties(
                    new CalculateRefundRequestProperties()
                        .withScope("azqugxywpmueefj")
                        .withReservationToReturn(
                            new ReservationToReturn().withReservationId("qkqujidsu").withQuantity(168254793)));
        model = BinaryData.fromObject(model).toObject(CalculateRefundRequest.class);
        Assertions.assertEquals("pabgyeps", model.id());
        Assertions.assertEquals("azqugxywpmueefj", model.properties().scope());
        Assertions.assertEquals("qkqujidsu", model.properties().reservationToReturn().reservationId());
        Assertions.assertEquals(168254793, model.properties().reservationToReturn().quantity());
    }
}
