package com.szpg.db.test;

import static org.junit.Assert.assertEquals;

import java.util.Calendar;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.szpg.db.dao.PgWsDao;
import com.szpg.db.dao.impl.PgWsDaoImpl;
import com.szpg.util.TimeFormat;

public class PgWSDaoTest {
	
	private PgWsDao dao;

	@Before
	public void setUp() throws Exception {
		dao = new PgWsDaoImpl();
	}

//	@Test
	public void testAddParamRecord() {
		assertEquals(1, dao.addWsdzRecord((float) 35.5, (float) 63.3, TimeFormat.formatTimestamp(Calendar.getInstance().getTime()), 7));
	}

	@Test
	public void testFindAllParam() {
		assertEquals("20180116163234", dao.findAllWsdz().get(0).getTmStrGB());
	}
	
	@Test
	public void testFindParamById() {
		Assert.assertEquals(dao.findWsdzById(2).getTmStrGB(), "20180116163234");
	}
	
//	@Test
	public void testAddStatusRecord() {
		assertEquals(1, dao.addWsdbjRecord(false, false, TimeFormat.formatTimestamp(Calendar.getInstance().getTime()), 7));
	}

	@Test
	public void testFindAllStatus() {
		assertEquals("20180116163233", dao.findAllWsdbj().get(0).getTmStrGB());
	}
	
	@Test
	public void testFindStatusById() {
		Assert.assertEquals(dao.findWsdbjById(2).getTmStrGB(), "20180116163233");
	}

}
