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

package com.azure.resourcemanager.billing.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountProperties;
import com.azure.resourcemanager.billing.models.Department;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EnrollmentAccountPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EnrollmentAccountProperties model =
            BinaryData
                .fromString(
                    "{\"accountName\":\"dkcglhsl\",\"costCenter\":\"jdyggdtji\",\"accountOwner\":\"b\",\"accountOwnerEmail\":\"ofqweykhmenevfye\",\"status\":\"whybcib\",\"startDate\":\"2021-05-14T16:24:46Z\",\"endDate\":\"2021-01-31T06:13:45Z\",\"department\":{\"properties\":{\"departmentName\":\"ynnaam\",\"costCenter\":\"ctehfiqscjey\",\"status\":\"hezrkgq\",\"enrollmentAccounts\":[]},\"id\":\"refovgmkqsleyyvx\",\"name\":\"qjpkcattpngjcrc\",\"type\":\"zsqpjhvmdajvny\"}}")
                .toObject(EnrollmentAccountProperties.class);
        Assertions.assertEquals("dkcglhsl", model.accountName());
        Assertions.assertEquals("jdyggdtji", model.costCenter());
        Assertions.assertEquals("b", model.accountOwner());
        Assertions.assertEquals("ofqweykhmenevfye", model.accountOwnerEmail());
        Assertions.assertEquals("whybcib", model.status());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-14T16:24:46Z"), model.startDate());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T06:13:45Z"), model.endDate());
        Assertions.assertEquals("ynnaam", model.department().departmentName());
        Assertions.assertEquals("ctehfiqscjey", model.department().costCenter());
        Assertions.assertEquals("hezrkgq", model.department().status());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EnrollmentAccountProperties model =
            new EnrollmentAccountProperties()
                .withAccountName("dkcglhsl")
                .withCostCenter("jdyggdtji")
                .withAccountOwner("b")
                .withAccountOwnerEmail("ofqweykhmenevfye")
                .withStatus("whybcib")
                .withStartDate(OffsetDateTime.parse("2021-05-14T16:24:46Z"))
                .withEndDate(OffsetDateTime.parse("2021-01-31T06:13:45Z"))
                .withDepartment(
                    new Department()
                        .withDepartmentName("ynnaam")
                        .withCostCenter("ctehfiqscjey")
                        .withStatus("hezrkgq")
                        .withEnrollmentAccounts(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(EnrollmentAccountProperties.class);
        Assertions.assertEquals("dkcglhsl", model.accountName());
        Assertions.assertEquals("jdyggdtji", model.costCenter());
        Assertions.assertEquals("b", model.accountOwner());
        Assertions.assertEquals("ofqweykhmenevfye", model.accountOwnerEmail());
        Assertions.assertEquals("whybcib", model.status());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-14T16:24:46Z"), model.startDate());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T06:13:45Z"), model.endDate());
        Assertions.assertEquals("ynnaam", model.department().departmentName());
        Assertions.assertEquals("ctehfiqscjey", model.department().costCenter());
        Assertions.assertEquals("hezrkgq", model.department().status());
    }
}
