package com.tarena.oss.admin.dao;

import java.util.Collection;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.tarena.oss.admin.pojo.Admin;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class AdminMgmtDAOTest extends TestCase {
	private AdminMgmtDAO dao;
	private ApplicationContext context;
	public AdminMgmtDAOTest(String arg0) {
		super(arg0);
	}

	protected void setUp() throws Exception {
		context=new ClassPathXmlApplicationContext("applicationContext.xml");
		dao=(AdminMgmtDAO) context.getBean("adminbDAO");
	}

	protected void tearDown() throws Exception {
		context=null;
		dao=null;
	}

	public void testValidate() {
		dao.validate("admin", "admin");
	}

	public void testInsertAdmin() {
//		Admin a=new Admin(null,"haii","haii","haii","123456","30402046@163.com",2008-2-22);
//		dao.insertAdmin(a);
	}

	public void testUpdateAdmin() {
		Admin a=new Admin(2,"Lee1","Lee2","Lee3","1234","1234@163.com");
//		dao.updateAdmin(a);
	}

	public void testDeleteAdmin() {
		Admin a=new Admin(3,"","","","","",null);
//		dao.deleteAdmin(a);
	}

	public void testQueryadmins() {
		Collection<Admin> c=dao.queryadmins();
//		System.out.println(c);
	}

	public void testQueryadminsString() {
		
	}

	public void testQueryadmin() {
		Admin a =dao.queryadmin(4);
		System.out.println(a);
	}

	public void testQueryadminsStringInt() {
		Admin a=new Admin();
//		a.setName("haha");
//		dao.queryadmins(a, 1);
//		return null;
	}

	public void testQueryPricingCnt() {
		fail("Not yet implemented");
	}
	public static Test suited(){
		TestSuite suite =new TestSuite();
		suite.addTest(new AdminMgmtDAOTest("testInsertAdmin"));
		return suite;
	}
	
}
