public void ShouldDisplayContainersFor_IgnoreEmptyFilter_Sunday()
        {
            DateTime today = new DateTime(2020, 9, 15, 10, 8, 17);

            InitializeWithItems(CreateAllRangeItems(today), today, DayOfWeek.Sunday);
            var localization = new MRUGuiLocalization();

            viewMock.SetFilterValue("");

            Assert.IsTrue(viewMock.ShowedContainers.Count == 5, "Wrong containers count");

            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.PinnedItemsLabel, "Wrong container 0 caption");
            Assert.IsTrue(viewMock.ShowedContainers[1].ContainerCaption == localization.TodayItemsLabel, "Wrong container 1 caption");
            Assert.IsTrue(viewMock.ShowedContainers[2].ContainerCaption == localization.YesterdayItemsLabel, "Wrong container 2 caption");
            Assert.IsTrue(viewMock.ShowedContainers[3].ContainerCaption == localization.ThisWeekItemsLabel, "Wrong container 3 caption");
            Assert.IsTrue(viewMock.ShowedContainers[4].ContainerCaption == localization.ThisMonthItemsLabel, "Wrong container 4 caption");

            Assert.IsTrue(viewMock.ItemViews.Count == 5, "Wrong items count");

            viewMock.SetFilterValue(null);

            Assert.IsTrue(viewMock.ShowedContainers.Count == 5, "Wrong containers count");

            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.PinnedItemsLabel, "Wrong container 0 caption");
            Assert.IsTrue(viewMock.ShowedContainers[1].ContainerCaption == localization.TodayItemsLabel, "Wrong container 1 caption");
            Assert.IsTrue(viewMock.ShowedContainers[2].ContainerCaption == localization.YesterdayItemsLabel, "Wrong container 2 caption");
            Assert.IsTrue(viewMock.ShowedContainers[3].ContainerCaption == localization.ThisWeekItemsLabel, "Wrong container 3 caption");
            Assert.IsTrue(viewMock.ShowedContainers[4].ContainerCaption == localization.ThisMonthItemsLabel, "Wrong container 4 caption");

            Assert.IsTrue(viewMock.ItemViews.Count == 5, "Wrong items count");
        }
Ejemplo n.º 2
0
 public MRUGuiLogic(IMRUItemsView view, IMRUManager manager, MRUGuiLocalization localization)
 {
     this.view         = view;
     this.manager      = manager;
     this.localization = localization;
     PerformInitialize();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Init control: reads MRU items and shows them on 'view'
 /// </summary>
 /// <param name="manager">IMRUManager implementation instance</param>
 /// <param name="localization">localization instance</param>
 /// <param name="imageForItem">image for to use with given MRU item</param>
 public void Initialize(IMRUManager manager, MRUGuiLocalization localization, string imageForItem)
 {
     base.Initialize(manager, localization);
     this.imageForItem           = imageForItem;
     this.labelCaption.Text      = localization.Caption;
     this.linkLabelClearAll.Text = localization.ClearAllLabel;
     RepositionHeader();
 }
        public void ShouldDisplayContainersFor_FilterOnlyFileName_Sunday()
        {
            DateTime today = new DateTime(2020, 9, 15, 10, 8, 17);

            InitializeWithItems(CreateAllRangeItems(today), today, DayOfWeek.Sunday);
            var localization = new MRUGuiLocalization();

            viewMock.SetFilterValue("b2");

            Assert.IsTrue(viewMock.ShowedContainers.Count == 1, "Wrong containers count");
            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.YesterdayItemsLabel, "Wrong container 0 caption");
            Assert.IsTrue(viewMock.ItemViews.Count == 1, "Wrong items count");
        }
Ejemplo n.º 5
0
        public void ShouldUpdateMRUContainersOnItemPinChanged()
        {
            Initialize();

            MRUItemViewMock itemView = GetMockItemViewForPath("path1");

            itemView.InvokePinItemRequested();
            MRUGuiLocalization localization = new MRUGuiLocalization();

            Assert.IsTrue(viewMock.ShowedContainers.Count == 1, "Wrong containers count");
            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.TodayItemsLabel, "Wrong container caption");
            Assert.IsTrue(viewMock.ItemViews.Count == 2, "Wrong items count");
        }
        public void ShouldDisplayContainersFor_AllRanges_BeginOfMonth_Monday()
        {
            DateTime today = new DateTime(2020, 9, 1, 10, 8, 17);

            InitializeWithItems(CreateAllRangeItems(today), today, DayOfWeek.Monday);
            var localization = new MRUGuiLocalization();

            Assert.IsTrue(viewMock.ShowedContainers.Count == 4, "Wrong containers count");

            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.PinnedItemsLabel, "Wrong container 0 caption");
            Assert.IsTrue(viewMock.ShowedContainers[1].ContainerCaption == localization.TodayItemsLabel, "Wrong container 1 caption");
            Assert.IsTrue(viewMock.ShowedContainers[2].ContainerCaption == localization.YesterdayItemsLabel, "Wrong container 2 caption");
            Assert.IsTrue(viewMock.ShowedContainers[3].ContainerCaption == localization.OtherItemsLabel, "Wrong container 3 caption");

            Assert.IsTrue(viewMock.ItemViews.Count == 5, "Wrong items count");
        }
        public void ShouldDisplayContainersFor_CgangePinnedState_Monday()
        {
            DateTime today = new DateTime(2020, 9, 16, 10, 8, 17);

            InitializeWithItems(CreateAllRangeItems(today), today, DayOfWeek.Monday);
            var localization = new MRUGuiLocalization();
            // get today's not pinned item
            var itemView = GetMockItemViewForPath("C:/path2/A2");

            itemView.InvokePinItemRequested();

            Assert.IsTrue(viewMock.ShowedContainers.Count == 4, "Wrong containers count");

            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.PinnedItemsLabel, "Wrong container 0 caption");
            Assert.IsTrue(viewMock.ShowedContainers[1].ContainerCaption == localization.YesterdayItemsLabel, "Wrong container 1 caption");
            Assert.IsTrue(viewMock.ShowedContainers[2].ContainerCaption == localization.ThisWeekItemsLabel, "Wrong container 2 caption");
            Assert.IsTrue(viewMock.ShowedContainers[3].ContainerCaption == localization.ThisMonthItemsLabel, "Wrong container 3 caption");

            Assert.IsTrue(viewMock.ItemViews.Count == 5, "Wrong items count");
        }
        public void ShouldDisplayContainersFor_OtherContainerForItemsOlderThanThisMonth_Sunday()
        {
            DateTime today    = new DateTime(2020, 9, 15, 10, 8, 17);
            var      items    = CreateAllRangeItems(today);
            var      lastItem = items.Last();

            lastItem.LastAccessedDate = today.AddDays(-45);
            InitializeWithItems(items, today, DayOfWeek.Sunday);
            var localization = new MRUGuiLocalization();

            Assert.IsTrue(viewMock.ShowedContainers.Count == 5, "Wrong containers count");

            Assert.IsTrue(viewMock.ShowedContainers[0].ContainerCaption == localization.PinnedItemsLabel, "Wrong container 0 caption");
            Assert.IsTrue(viewMock.ShowedContainers[1].ContainerCaption == localization.TodayItemsLabel, "Wrong container 1 caption");
            Assert.IsTrue(viewMock.ShowedContainers[2].ContainerCaption == localization.YesterdayItemsLabel, "Wrong container 2 caption");
            Assert.IsTrue(viewMock.ShowedContainers[3].ContainerCaption == localization.ThisWeekItemsLabel, "Wrong container 3 caption");
            Assert.IsTrue(viewMock.ShowedContainers[4].ContainerCaption == localization.OtherItemsLabel, "Wrong container 4 caption");

            Assert.IsTrue(viewMock.ItemViews.Count == 5, "Wrong items count");
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Init control: reads MRU items and shows them on 'view'
 /// </summary>
 /// <param name="manager">IMRUManager implementation instance</param>
 /// <param name="localization">localization instance</param>
 public override void Initialize(IMRUManager manager, MRUGuiLocalization localization)
 {
     Initialize(manager, localization, string.Empty);
 }
Ejemplo n.º 10
0
 public void Initialize(IMRUManager manager, MRUGuiLocalization localization)
 {
     logic = new MRUGuiLogic(this, manager, localization);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Init control: reads MRU items and shows them on 'view'
 /// </summary>
 /// <param name="manager">IMRUManager implementation instance</param>
 /// <param name="localization">localization instance</param>
 public virtual void Initialize(IMRUManager manager, MRUGuiLocalization localization)
 {
     this.localization = localization;
     logic             = new MRUGuiLogic(this, manager, localization);
 }