package com.izouma.dingdong.service;

import com.izouma.dingdong.domain.Appraisal;
import com.izouma.dingdong.enums.AppraisalSort;
import com.izouma.dingdong.repo.AppraisalRepo;
import com.izouma.dingdong.web.AppraisalController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class AppraisalServiceTest {

    @Autowired
    private AppraisalService appraisalService;

    @Autowired
    private AppraisalRepo appraisalRepo;

    @Autowired
    private AppraisalController appraisalController;

    @Test
    public void test() {

//        System.out.println(shoppingCartRepo.findById(322L).orElse(null));
        Appraisal appraisal = Appraisal.builder()
                .goodsLike(true)
                .orderInfoId(1760L)
                .merchantId(1731L)
                .goodsAppraise("商品不好，很差")
                .riderLike(1)
                .riderAppraise("外卖送货慢！")
                .build();
        System.out.println(appraisalService.userAppraisal(appraisal));
    }

    @Test
    public void testMy() {
        // System.out.println(orderInfoRepo.findById(386L).orElse(null));
        System.out.println(appraisalRepo.findAllByMerchantId(356L));
    }

    @Test
    public void testReply() {
        appraisalController.merchantApply(418L,"谢谢@！！！");
    }

    @Test
    public void testShow(){
        System.out.println(appraisalService.appraisalsSort(1252L, AppraisalSort.HAVE_PIC));
    }
}
