package com.poyee.act;

import com.alibaba.fastjson.JSON;
import com.poyee.BaseTest;
import com.tzy.PoyiApplication;
import com.tzy.common.dto.InDto;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;

import java.util.HashMap;
import java.util.Map;

/**
 * @author by po'yi
 * @Classname AppActControllerTest
 * @Description TODO
 * @Date 2022/11/14 18:47
 */
@Slf4j
@SpringBootTest(classes = PoyiApplication.class)
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
class AppActControllerTest extends BaseTest {
	@Autowired
	private MockMvc mockMvc;

	@Test
	void getPrize() {

	}

	@Test
	void getSimpleActInfo() {
	}

	@Test
	void getActInfo() {
	}

	@Test
	void getUserActRecord() {
	}

	@Test
	void getActRecord() {
	}

	@Test
	void luckDraw() {
	}

	@Test
	void getGuessActInfo() throws Exception {
		Map<String, Object> data = new HashMap(){{
			put("actId",28);
		}};
		InDto param = buildUserIndto(data);
		MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/api/v1.7/act/guess/info")
				.accept(MediaType.APPLICATION_JSON_UTF8).contentType(MediaType.APPLICATION_JSON_UTF8)
				.content(JSON.toJSONString(param)))
				.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
		int status = mvcResult.getResponse().getStatus();
		System.out.println(status);
		//String result = mvcResult.getResponse().getContentAsString();
		//System.out.println(result);

	}

	@Test
	void getGuessActTeams() {
	}

	@Test
	void getUserGuessRecord() {
	}

	@Test
	void userGuessTeam() {
	}

	@Test
	void getTeamGuessNums() {
	}

	@Test
	void getActRankList() {

	}
}