package com.izouma.jiashanxia.service;

import cn.hutool.core.collection.CollUtil;
import com.izouma.jiashanxia.dto.OrderInfoVO;
import com.izouma.jiashanxia.enums.OrderInfoStatus;
import com.izouma.jiashanxia.enums.PayMethod;
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.data.domain.Pageable;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

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

    @Autowired
    private OrderInfoService orderInfoService;

    @Test
    public void order() {
        System.out.println(orderInfoService.createOrder(46L, 17L, PayMethod.WEIXIN));
    }

    @Test
    public void completed() {
        orderInfoService.completed(47L, "11000001");
    }

    @Test
    public void cancel() {
        System.out.println(orderInfoService.cancelOrder(58L));
    }

    @Test
    public void test() {
        List<OrderInfoVO> contents = orderInfoService.my(Pageable.unpaged(), 68L, null).getContent();
        contents.forEach(content -> System.out.println(content.getCreatedAt()));
    }
}