Ejemplo n.º 1
0
        public void InsertProcessInfoTest()
        {
            string   name     = "name";
            TimeSpan time     = new TimeSpan(0, 10, 0);
            PTDate   date     = new PTDate(1, DateTime.Today);
            bool     expected = true;
            bool     actual   = PTDatabase.InsertProcessInfo(name, time, date);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void GetInfoForProcessOnDateTest()
        {
            string        processName      = "name";
            PTDate        date             = new PTDate(1, DateTime.Today);
            string        otherProcessName = "otherName";
            PTProcessInfo expected         = new PTProcessInfo(1, processName, new TimeSpan(0, 10, 0));
            PTProcessInfo otherInfo        = new PTProcessInfo(2, otherProcessName, new TimeSpan(0, 10, 0));

            PTDatabase.InsertDate(date);
            PTDatabase.InsertProcessInfo(expected, date);
            PTDatabase.InsertProcessInfo(otherInfo, date);
            PTProcessInfo actual = PTDatabase.GetInfoForProcessOnDate(processName, date);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void insertProcessInfoTest()
        {
            PTProcessInfo info;

            info.index      = 1;
            info.name       = "name";
            info.activeTime = new TimeSpan(2, 3, 30);
            PTDate date;

            date.index = 1;
            date.date  = DateTime.Now.Date;
            bool expected = true;
            bool actual   = PTDatabase.InsertProcessInfo(info, date);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void updateProcessTimeSuccessfulTest()
        {
            string        name = "name";
            TimeSpan      time = new TimeSpan(0, 20, 0);
            PTProcessInfo info;

            info.index      = 1;
            info.name       = name;
            info.activeTime = time;
            PTDate date;

            date.index = 1;
            date.date  = DateTime.Now.Date;
            bool expected = true;
            bool inserted = PTDatabase.InsertProcessInfo(info, date);
            bool actual   = PTDatabase.UpdateProcessTime(name, date, time);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void processInfoForDateTest()
        {
            PTDate date      = new PTDate(1, DateTime.Now.Date);
            PTDate otherDate = new PTDate(2, DateTime.Today + new TimeSpan(1, 0, 0, 0));
            List <PTProcessInfo> expected = new List <PTProcessInfo>()
            {
                new PTProcessInfo(1, "name1", new TimeSpan(0, 5, 0)),
                new PTProcessInfo(2, "name2", new TimeSpan(0, 75, 0)),
                new PTProcessInfo(3, "name3", new TimeSpan(1, 5, 0))
            };
            PTProcessInfo otherInfo = new PTProcessInfo(4, "name4", new TimeSpan(1, 25, 0));

            PTDatabase.InsertProcessInfo(expected[0], date);
            PTDatabase.InsertProcessInfo(expected[1], date);
            PTDatabase.InsertProcessInfo(expected[2], date);
            PTDatabase.InsertProcessInfo(otherInfo, otherDate);
            List <PTProcessInfo> actual = PTDatabase.ProcessInfoForDate(date);

            CollectionAssert.AreEqual(expected, actual);
        }