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

package com.azure.resourcemanager.graphservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.graphservices.models.AccountResourceSystemData;
import com.azure.resourcemanager.graphservices.models.CreatedByType;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class AccountResourceSystemDataTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AccountResourceSystemData model =
            BinaryData
                .fromString(
                    "{\"createdByType\":\"Key\",\"createdAt\":\"2021-06-19T00:38:01Z\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2021-12-05T14:26:12Z\"}")
                .toObject(AccountResourceSystemData.class);
        Assertions.assertEquals(CreatedByType.KEY, model.createdByType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T00:38:01Z"), model.createdAt());
        Assertions.assertEquals(CreatedByType.APPLICATION, model.lastModifiedByType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-12-05T14:26:12Z"), model.lastModifiedAt());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AccountResourceSystemData model =
            new AccountResourceSystemData()
                .withCreatedByType(CreatedByType.KEY)
                .withCreatedAt(OffsetDateTime.parse("2021-06-19T00:38:01Z"))
                .withLastModifiedByType(CreatedByType.APPLICATION)
                .withLastModifiedAt(OffsetDateTime.parse("2021-12-05T14:26:12Z"));
        model = BinaryData.fromObject(model).toObject(AccountResourceSystemData.class);
        Assertions.assertEquals(CreatedByType.KEY, model.createdByType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T00:38:01Z"), model.createdAt());
        Assertions.assertEquals(CreatedByType.APPLICATION, model.lastModifiedByType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-12-05T14:26:12Z"), model.lastModifiedAt());
    }
}
