[Test] public void SeveralResTypeChosenForTab() { IResource condition = _registry.RecreateStandardCondition( "Today", "Today", null, "Date", ConditionOp.InRange, "Today", "+1" ); IResource today = _registry.RegisterView( "Today", new IResource[ 1 ]{ condition }, null ); _engine.InitializeCriteria(); //Console.WriteLine( "After view is initialized: " + _unreads.GetUnreadCount( today ) + " + " + _unreads.GetPersistentUnreadCount( today ) ); Assert.AreEqual( 3, Core.UnreadManager.GetUnreadCount( today ) ); _mockResourceTabProvider.SetResourceTab( "Email", "MyTab" ); _mockResourceTabProvider.SetResourceTab( "RSSFeed", "MyTab" ); UnreadState myTabState = _unreads.SetUnreadState( "MyTab", null ); /* _registry.UpdateCountersOnTab( new string[2] { "Email", "RSSFeed" } ); Console.WriteLine( "After Tab is set to Email and RSSFed: " + _unreads.GetUnreadCount( today ) + " + " + _unreads.GetPersistentUnreadCount( today ) ); */ Assert.AreEqual( 2, myTabState.GetUnreadCount( today ) ); Console.WriteLine( "(AUX): " + _unreads.GetUnreadCount( today ) + " + " + _unreads.GetPersistentUnreadCount( today ) ); /* _registry.UpdateCountersOnTab( null ); Console.WriteLine( _unreads.GetUnreadCount( today ) + " + " + _unreads.GetPersistentUnreadCount( today ) ); Assert.AreEqual( 3, _unreads.GetUnreadCount( today ) ); _registry.UpdateCountersOnTab( new string[2] { "Email", "NewsArticle" } ); Assert.AreEqual( 2, _unreads.GetUnreadCount( today ) ); */ }
[Test] public void UnreadState() { Assert.AreEqual(0, _unreadManager.GetUnreadCount(_folder)); IResource email = NewUnreadResource("Email", _folder); Assert.AreEqual(1, _unreadManager.GetUnreadCount(_folder)); IResource person = NewUnreadResource("Person", _folder); Assert.AreEqual(2, _unreadManager.GetUnreadCount(_folder)); UnreadState emailState = _unreadManager.SetUnreadState("Email", null); Assert.AreEqual(1, emailState.GetUnreadCount(_folder)); UnreadState defaultState = _unreadManager.SetUnreadState("", null); Assert.AreEqual(2, defaultState.GetUnreadCount(_folder)); IResource person2 = NewUnreadResource("Person", _folder); Assert.AreEqual(3, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(1, emailState.GetUnreadCount(_folder)); IResource email2 = NewUnreadResource("Email", _folder); Assert.AreEqual(4, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(2, emailState.GetUnreadCount(_folder)); email2.SetProp(_propUnread, false); Assert.AreEqual(3, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(1, emailState.GetUnreadCount(_folder)); person2.SetProp(_propUnread, false); Assert.AreEqual(2, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(1, emailState.GetUnreadCount(_folder)); email2.SetProp(_propUnread, true); Assert.AreEqual(3, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(2, emailState.GetUnreadCount(_folder)); person2.SetProp(_propUnread, true); Assert.AreEqual(4, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(2, emailState.GetUnreadCount(_folder)); email2.Delete(); Assert.AreEqual(3, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(1, emailState.GetUnreadCount(_folder)); person2.Delete(); Assert.AreEqual(2, defaultState.GetUnreadCount(_folder)); Assert.AreEqual(1, emailState.GetUnreadCount(_folder)); IResource folder2 = _storage.NewResource("Folder"); Assert.AreEqual(0, defaultState.GetUnreadCount(folder2)); Assert.AreEqual(0, emailState.GetUnreadCount(folder2)); }
/// <summary> /// Update the filter list based on the active tab and workspace. /// </summary> private void UpdateResourceBrowserFilterList() { IResourceList tabFilterList = null; if (_curTabFilter != null) { tabFilterList = _curTabFilter.GetFilterList(true); } if (_activeWorkspaceFilterList != null) { Trace.WriteLine("Intersecting tab filter list with workspace filter list"); tabFilterList = _activeWorkspaceFilterList.Intersect(tabFilterList); } _resourceBrowser.SetFilterResourceList(tabFilterList); _curUnreadState = _unreadManager.SetUnreadState(CurrentTabId, _activeWorkspace); }