package com.ruoyi.web.modules.diagnosis.support;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Date;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.ruoyi.web.modules.diagnosis.MedicalResourceTestSamples;
import com.ruoyi.web.modules.diagnosis.domain.BizMedicalResource;

@DisplayName("MedicalResourcePublishStatusResolver")
class MedicalResourcePublishStatusResolverTest
{

    @Test
    @DisplayName("三态解析")
    void displayStatus()
    {
        assertEquals(MedicalResourceRules.QUERY_PUBLISH_UNPUBLISHED,
                MedicalResourcePublishStatusResolver.resolveDisplayCode(0, null));
        assertEquals(MedicalResourceRules.QUERY_PUBLISH_PUBLISHED,
                MedicalResourcePublishStatusResolver.resolveDisplayCode(1, null));
        assertEquals(MedicalResourceRules.QUERY_PUBLISH_OFFLINE,
                MedicalResourcePublishStatusResolver.resolveDisplayCode(0, new Date()));

        BizMedicalResource row = MedicalResourceTestSamples.sampleVetDraft();
        MedicalResourcePublishStatusResolver.applyDisplayStatus(row);
        assertEquals("未发布", row.getDisplayPublishStatusName());
        assertEquals(Boolean.TRUE, row.getCanEdit());
        assertEquals(Boolean.TRUE, row.getCanAssignAccount());
    }
}
