package com.izouma.wenlvju.service;

import com.izouma.wenlvju.ApplicationTests;
import com.izouma.wenlvju.domain.ExamRoom;
import com.izouma.wenlvju.dto.PageQuery;
import com.izouma.wenlvju.repo.ExamRoomRepo;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class ExamRoomServiceTest extends ApplicationTests {

    @Autowired
    private ExamRoomService examRoomService;
    @Autowired
    private ExamRoomRepo    examRoomRepo;


    @Test
    public void addDevice() {
        ExamRoom examRoom = examRoomRepo.findById(874L).orElseThrow(null);
        examRoomService.addDevice(examRoom.getDeviceSerial(), examRoom.getValidateCode());

    }

    @Test
    public void show() {
        System.out.println(examRoomService.showDevice());
    }

    @Test
    public void on() {
//        ExamRoom examRoom = examRoomRepo.findById(874L).orElseThrow(null);
        examRoomService.encryptOn("F75663984");
    }

    @Test
    public void off() {
        ExamRoom examRoom = examRoomRepo.findById(874L).orElseThrow(null);
        examRoomService.encryptOff(examRoom.getDeviceSerial(), examRoom.getValidateCode());
    }

    @Test
    public void showVideo() {
//        List<ExamRoom> show = examRoomService.byToday(8L, null);
//        show.forEach(System.out::println);
        System.out.println(examRoomService.byToday(new PageQuery(), null));
    }

}