// 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.RefundRequest;
import com.azure.resourcemanager.reservations.models.RefundRequestProperties;
import com.azure.resourcemanager.reservations.models.ReservationToReturn;
import org.junit.jupiter.api.Assertions;

public final class RefundRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RefundRequest model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"sessionId\":\"c\",\"scope\":\"mdua\",\"reservationToReturn\":{\"reservationId\":\"xqpvfadmw\",\"quantity\":448234135},\"returnReason\":\"gvxp\"}}")
                .toObject(RefundRequest.class);
        Assertions.assertEquals("c", model.properties().sessionId());
        Assertions.assertEquals("mdua", model.properties().scope());
        Assertions.assertEquals("xqpvfadmw", model.properties().reservationToReturn().reservationId());
        Assertions.assertEquals(448234135, model.properties().reservationToReturn().quantity());
        Assertions.assertEquals("gvxp", model.properties().returnReason());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RefundRequest model =
            new RefundRequest()
                .withProperties(
                    new RefundRequestProperties()
                        .withSessionId("c")
                        .withScope("mdua")
                        .withReservationToReturn(
                            new ReservationToReturn().withReservationId("xqpvfadmw").withQuantity(448234135))
                        .withReturnReason("gvxp"));
        model = BinaryData.fromObject(model).toObject(RefundRequest.class);
        Assertions.assertEquals("c", model.properties().sessionId());
        Assertions.assertEquals("mdua", model.properties().scope());
        Assertions.assertEquals("xqpvfadmw", model.properties().reservationToReturn().reservationId());
        Assertions.assertEquals(448234135, model.properties().reservationToReturn().quantity());
        Assertions.assertEquals("gvxp", model.properties().returnReason());
    }
}
