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

package com.azure.resourcemanager.education.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.education.fluent.models.Amount;
import com.azure.resourcemanager.education.fluent.models.StudentProperties;
import com.azure.resourcemanager.education.models.StudentRole;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class StudentPropertiesTests {
    @Test
    public void testDeserialize() {
        StudentProperties model =
            BinaryData
                .fromString(
                    "{\"firstName\":\"idf\",\"lastName\":\"zwdzuh\",\"email\":\"ymwisdkft\",\"role\":\"Admin\",\"budget\":{\"currency\":\"mnteiwao\",\"value\":6.2815723},\"subscriptionId\":\"ijcmmx\",\"expirationDate\":\"2021-07-13T15:29:37Z\",\"status\":\"Active\",\"effectiveDate\":\"2021-10-30T06:34:46Z\",\"subscriptionAlias\":\"rpymzidnsez\",\"subscriptionInviteLastSentDate\":\"2021-01-24T00:04:31Z\"}")
                .toObject(StudentProperties.class);
        Assertions.assertEquals("idf", model.firstName());
        Assertions.assertEquals("zwdzuh", model.lastName());
        Assertions.assertEquals("ymwisdkft", model.email());
        Assertions.assertEquals(StudentRole.ADMIN, model.role());
        Assertions.assertEquals("mnteiwao", model.budget().currency());
        Assertions.assertEquals(6.2815723F, model.budget().value());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-13T15:29:37Z"), model.expirationDate());
        Assertions.assertEquals("rpymzidnsez", model.subscriptionAlias());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-24T00:04:31Z"), model.subscriptionInviteLastSentDate());
    }

    @Test
    public void testSerialize() {
        StudentProperties model =
            new StudentProperties()
                .withFirstName("idf")
                .withLastName("zwdzuh")
                .withEmail("ymwisdkft")
                .withRole(StudentRole.ADMIN)
                .withBudget(new Amount().withCurrency("mnteiwao").withValue(6.2815723F))
                .withExpirationDate(OffsetDateTime.parse("2021-07-13T15:29:37Z"))
                .withSubscriptionAlias("rpymzidnsez")
                .withSubscriptionInviteLastSentDate(OffsetDateTime.parse("2021-01-24T00:04:31Z"));
        model = BinaryData.fromObject(model).toObject(StudentProperties.class);
        Assertions.assertEquals("idf", model.firstName());
        Assertions.assertEquals("zwdzuh", model.lastName());
        Assertions.assertEquals("ymwisdkft", model.email());
        Assertions.assertEquals(StudentRole.ADMIN, model.role());
        Assertions.assertEquals("mnteiwao", model.budget().currency());
        Assertions.assertEquals(6.2815723F, model.budget().value());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-13T15:29:37Z"), model.expirationDate());
        Assertions.assertEquals("rpymzidnsez", model.subscriptionAlias());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-24T00:04:31Z"), model.subscriptionInviteLastSentDate());
    }
}
