public void GetDateTableTest() { PTManager target = new PTManager(); DataTable expected = new DataTable("Dates"); expected.Columns.Add("Date", Type.GetType("System.DateTime")); DataRow newRow = expected.NewRow(); newRow["Date"] = DateTime.Today; expected.Rows.Add(newRow); string expectedProcessName = "name1"; DateTime expectedDateTime = DateTime.Today; List <PTRecord> recordList = PTManager.MakeRecords(expectedProcessName, expectedDateTime); recordList = PTManager.MakeRecords(expectedProcessName, expectedDateTime); PTDatabase.HandleRecord(recordList[0]); DataTable actual = target.GetDateTable(); Assert.IsTrue(DataTableComparer.AreEqual(expected, actual)); }
public void GetProcessInfoTableForDateTest() { string expectedProcessName = "name1"; PTManager target = new PTManager(); DataTable expected = new DataTable("ProcessInfos"); expected.Columns.Add("Name", Type.GetType("System.String")); expected.Columns.Add("ActiveTime", Type.GetType("System.Int32")); DataRow newRow = expected.NewRow(); newRow["Name"] = expectedProcessName; newRow["ActiveTime"] = 0; expected.Rows.Add(newRow); DateTime expectedDateTime = DateTime.Today; List <PTRecord> recordList = PTManager.MakeRecords(expectedProcessName, expectedDateTime); recordList = PTManager.MakeRecords(expectedProcessName, expectedDateTime); PTDatabase.HandleRecord(recordList[0]); DataTable actual = target.GetProcessInfoTableForDate(expectedDateTime); Assert.IsTrue(DataTableComparer.AreEqual(expected, actual)); }