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

public final class RefundRequestPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RefundRequestProperties model =
            BinaryData
                .fromString(
                    "{\"sessionId\":\"omzlfmi\",\"scope\":\"wbnb\",\"reservationToReturn\":{\"reservationId\":\"dawkzbali\",\"quantity\":12612409},\"returnReason\":\"hakauhashsf\"}")
                .toObject(RefundRequestProperties.class);
        Assertions.assertEquals("omzlfmi", model.sessionId());
        Assertions.assertEquals("wbnb", model.scope());
        Assertions.assertEquals("dawkzbali", model.reservationToReturn().reservationId());
        Assertions.assertEquals(12612409, model.reservationToReturn().quantity());
        Assertions.assertEquals("hakauhashsf", model.returnReason());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RefundRequestProperties model =
            new RefundRequestProperties()
                .withSessionId("omzlfmi")
                .withScope("wbnb")
                .withReservationToReturn(
                    new ReservationToReturn().withReservationId("dawkzbali").withQuantity(12612409))
                .withReturnReason("hakauhashsf");
        model = BinaryData.fromObject(model).toObject(RefundRequestProperties.class);
        Assertions.assertEquals("omzlfmi", model.sessionId());
        Assertions.assertEquals("wbnb", model.scope());
        Assertions.assertEquals("dawkzbali", model.reservationToReturn().reservationId());
        Assertions.assertEquals(12612409, model.reservationToReturn().quantity());
        Assertions.assertEquals("hakauhashsf", model.returnReason());
    }
}
