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

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dataprotection.fluent.models.OperationResourceInner;
import com.azure.resourcemanager.dataprotection.models.OperationExtendedInfo;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class OperationResourceInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationResourceInner model =
            BinaryData
                .fromString(
                    "{\"endTime\":\"2021-03-26T22:16:08Z\",\"id\":\"qytbciq\",\"name\":\"uflmm\",\"properties\":{\"objectType\":\"OperationExtendedInfo\"},\"startTime\":\"2021-11-09T02:15:09Z\",\"status\":\"odmgl\"}")
                .toObject(OperationResourceInner.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-26T22:16:08Z"), model.endTime());
        Assertions.assertEquals("qytbciq", model.id());
        Assertions.assertEquals("uflmm", model.name());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-09T02:15:09Z"), model.startTime());
        Assertions.assertEquals("odmgl", model.status());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationResourceInner model =
            new OperationResourceInner()
                .withEndTime(OffsetDateTime.parse("2021-03-26T22:16:08Z"))
                .withId("qytbciq")
                .withName("uflmm")
                .withProperties(new OperationExtendedInfo())
                .withStartTime(OffsetDateTime.parse("2021-11-09T02:15:09Z"))
                .withStatus("odmgl");
        model = BinaryData.fromObject(model).toObject(OperationResourceInner.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-26T22:16:08Z"), model.endTime());
        Assertions.assertEquals("qytbciq", model.id());
        Assertions.assertEquals("uflmm", model.name());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-09T02:15:09Z"), model.startTime());
        Assertions.assertEquals("odmgl", model.status());
    }
}
