예제 #1
0
        public void enqueue_two_elements_test()
        {
            int       size   = 1;
            FixedList target = new FixedList(size);

            target.Enqueue("elem1");
            target.Enqueue("elem2");

            Assert.IsTrue(target.Size == 1);
            Assert.IsTrue(target[0] == "elem2");

            Assert.IsTrue(target.Size == 1);
        }
예제 #2
0
        public void enqueue_three_elements_test()
        {
            int       size   = 3;
            FixedList target = new FixedList(size);

            target.Enqueue("elem1"); // this one should be remove !
            target.Enqueue("elem2");
            target.Enqueue("elem3");
            target.Enqueue("elem4");

            Assert.IsTrue(target.Size == 3);
            Assert.IsTrue(target[0] == "elem2");
            Assert.IsTrue(target[1] == "elem3");

            Assert.IsTrue(target.Size == 3);
        }
예제 #3
0
        public void NewFileOpened(object sender, EventArg <string> e)
        {
            BeforeOpeningNewFile(sender, e);

            string path = e.Data;

            if (string.IsNullOrEmpty(path))
            {
                path = _view.DisplayOpenDialog();
            }

            if (!string.IsNullOrEmpty(path))
            {
                string ext = System.IO.Path.GetExtension(path);
                if (ext != ".vcf")
                {
                    _view.DisplayMessage("Only vcf extension accepted!", "Error");
                    return;
                }

                FixedList MRUList = ConfigRepository.Instance.Paths;
                if (!MRUList.Contains(path))
                {
                    MRUList.Enqueue(path);
                    _view.UpdateMRUMenu(MRUList);
                }

                _repository.LoadContacts(path);
                _view.DisplayContacts(_repository.Contacts);
            }
        }
예제 #4
0
        public void enqueue_one_element_test()
        {
            int       size   = 1;
            FixedList target = new FixedList(size);
            string    elem   = "test";

            target.Enqueue(elem);

            Assert.IsTrue(target.Size == 1);
            Assert.IsTrue(target[0] == "test");
        }
예제 #5
0
        public void NewFileOpened(object sender, EventArg <string> e)
        {
            string path = e.Data;

            if (!string.IsNullOrEmpty(path))
            {
                FixedList MRUList = ConfigRepository.Instance.Paths;

                if (!MRUList.Contains(path))
                {
                    MRUList.Enqueue(path);
                    // ConfigRepository.Instance.Paths.Clear();
                    _view.UpdateMRUMenu(MRUList);
                }

                _repository.LoadContacts(path);
                _view.DisplayContacts(_repository.Contacts);
            }
        }