package com.izouma.dingdong.contorller;

import com.izouma.dingdong.domain.merchant.MerchantClassification;
import com.izouma.dingdong.service.merchant.MerchantClassificationService;
import com.izouma.dingdong.web.merchant.MerchantClassificationController;
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 ClassificationControllerTest {

    @Autowired
    private MerchantClassificationController controller;
    @Autowired
    private MerchantClassificationService service;

    @Test
    public void testDel(){
        controller.del(1L);
    }

    @Test
    public void testDelGoods(){
        controller.delGoods(1L,109L);
    }

    @Test
    public void testSave(){
        MerchantClassification classification = new MerchantClassification();

        //classification.setId(205L);
        classification.setName("培良");
        classification.setSort(1);
        classification.setMerchantId(189L);
        classification.setGoodsIds("310,311");
        classification.setIsOpen(false);
        classification.setIsShow(true);
        classification.setEnabled(true);
        System.out.println(service.add(188L,classification));


    }

    @Test
    public void show(){
        System.out.println(controller.allGoods(475L));
    }
}
