예제 #1
0
        public void TestAddProject()
        {
            int count = projectAutocomplete.Count;

            string guid         = "07fba193-91c4-0ec8-2894-820df0548a8f";
            ulong  workspace_id = 123456789;
            ulong  client_id    = 0;
            string client_guid  = null;
            string project_name = "testing project adding";
            bool   is_private   = false;

            string project_guid = TogglDesktop.Toggl.AddProject(guid,
                                                                workspace_id,
                                                                client_id,
                                                                client_guid,
                                                                project_name,
                                                                is_private);

            Assert.IsNotNull(project_guid);
            Assert.AreNotEqual("", project_guid);

            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.AreEqual(project_name, te.ProjectLabel);

            Assert.IsNotNull(projectAutocomplete);
            Assert.AreEqual(count + 1, projectAutocomplete.Count);
        }
예제 #2
0
        public void Initialize()
        {
            openTimeEntryList = false;
            timeentries       = null;

            openTimeEntryEditor = false;
            focusedFieldName    = null;
            editorTimeEntry     = new TogglDesktop.Toggl.TogglTimeEntryView();

            openSettings = false;
            settings     = new TogglDesktop.Toggl.TogglSettingsView();

            running        = false;
            timerTimeEntry = new TogglDesktop.Toggl.TogglTimeEntryView();

            openLogin = false;
            userID    = 0;

            clients = null;

            projectAutocomplete = null;

            string path = Path.Combine(Directory.GetCurrentDirectory(), "me.json");

            Assert.AreNotEqual("", path);
            Assert.IsNotNull(path);

            string json = File.ReadAllText(path);

            Assert.AreNotEqual("", json);
            Assert.IsNotNull(json);
            Assert.IsTrue(TogglDesktop.Toggl.SetLoggedInUser(json));
        }
예제 #3
0
        public void Initialize()
        {
            openTimeEntryList = false;
            timeentries = null;

            openTimeEntryEditor = false;
            focusedFieldName = null;
            editorTimeEntry = new TogglDesktop.Toggl.TogglTimeEntryView();

            openSettings = false;
            settings = new TogglDesktop.Toggl.TogglSettingsView();

            running = false;
            timerTimeEntry = new TogglDesktop.Toggl.TogglTimeEntryView();

            openLogin = false;
            userID = 0;

            clients = null;

            projectAutocomplete = null;

            string path = Path.Combine(Directory.GetCurrentDirectory(), "me.json");
            Assert.AreNotEqual("", path);
            Assert.IsNotNull(path);

            string json = File.ReadAllText(path);
            Assert.AreNotEqual("", json);
            Assert.IsNotNull(json);
            Assert.IsTrue(TogglDesktop.Toggl.SetLoggedInUser(json));
        }
예제 #4
0
        public void TestSetTimeEntryDescription()
        {
            string guid = "07fba193-91c4-0ec8-2894-820df0548a8f";

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryDescription(guid, "blah"));
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.AreEqual("blah", te.Description);
        }
예제 #5
0
        public void TestSetTimeEntryEnd()
        {
            string guid = "07fba193-91c4-0ec8-2894-820df0548a8f";

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryEnd(guid, "23:45"));
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.AreEqual("23:45", te.EndTimeString);
        }
예제 #6
0
        public void TestViewTimeEntryList()
        {
            string guid = "07fba193-91c4-0ec8-2894-820df0548a8f";

            TogglDesktop.Toggl.ViewTimeEntryList();
            Assert.IsNotNull(timeentries);
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.AreEqual(guid, te.GUID);
        }
예제 #7
0
        public void TestSetTimeEntryProject()
        {
            string guid         = "07fba193-91c4-0ec8-2894-820df0548a8f";
            uint   task_id      = 0;
            uint   project_id   = 2567324;
            string project_guid = null;

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryProject(guid, task_id, project_id, project_guid));
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.AreEqual(project_id, te.PID);
        }
예제 #8
0
        public void TestSetTimeEntryBillable()
        {
            string guid = "07fba193-91c4-0ec8-2894-820df0548a8f";

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryBillable(guid, true));
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.IsTrue(te.Billable);

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryBillable(guid, false));
            te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            Assert.IsFalse(te.Billable);
        }
예제 #9
0
        public void TestSetTimeEntryTags()
        {
            string        guid = "07fba193-91c4-0ec8-2894-820df0548a8f";
            List <string> tags = new List <string>()
            {
                "John", "Anna", "Monica"
            };

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryTags(guid, tags));
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            string[] assignedTags = te.Tags.Split('\t');
            Assert.AreEqual(tags.Count, assignedTags.Length);
        }
예제 #10
0
        public void TestSetTimeEntryDate()
        {
            DateTime now  = DateTime.Now;
            string   guid = "07fba193-91c4-0ec8-2894-820df0548a8f";

            Assert.IsTrue(TogglDesktop.Toggl.SetTimeEntryDate(guid, now));
            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);
            DateTime started = TogglDesktop.Toggl.DateTimeFromUnix(te.Started);

            Assert.AreEqual(now.Year, started.Year);
            Assert.AreEqual(now.Month, started.Month);
            Assert.AreEqual(now.Day, started.Day);
        }
예제 #11
0
        public void TestDeleteTimeEntry()
        {
            TogglDesktop.Toggl.ViewTimeEntryList();

            string guid = "6c97dc31-582e-7662-1d6f-5e9d623b1685";

            TogglDesktop.Toggl.TogglTimeEntryView te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNotNull(te);

            Assert.IsTrue(TogglDesktop.Toggl.DeleteTimeEntry(guid));

            Assert.IsNotNull(timeentries);

            te = timeentries.Find(x => guid == x.GUID);
            Assert.IsNull(te);
        }
예제 #12
0
 static void Toggl_OnStoppedTimerState()
 {
     running        = false;
     timerTimeEntry = new TogglDesktop.Toggl.TogglTimeEntryView();
 }
예제 #13
0
 static void Toggl_OnStoppedTimerState()
 {
     running = false;
     timerTimeEntry = new TogglDesktop.Toggl.TogglTimeEntryView();
 }
예제 #14
0
 static void Toggl_OnTimeEntryEditor(bool open, TogglDesktop.Toggl.TogglTimeEntryView te, string focused_field_name)
 {
     openTimeEntryEditor = open;
     editorTimeEntry = te;
     focusedFieldName = focused_field_name;
 }
예제 #15
0
 static void Toggl_OnRunningTimerState(TogglDesktop.Toggl.TogglTimeEntryView te)
 {
     running        = true;
     timerTimeEntry = te;
 }
예제 #16
0
 static void Toggl_OnTimeEntryEditor(bool open, TogglDesktop.Toggl.TogglTimeEntryView te, string focused_field_name)
 {
     openTimeEntryEditor = open;
     editorTimeEntry     = te;
     focusedFieldName    = focused_field_name;
 }
예제 #17
0
 static void Toggl_OnRunningTimerState(TogglDesktop.Toggl.TogglTimeEntryView te)
 {
     running = true;
     timerTimeEntry = te;
 }