[Test] public void UnreadResourceEntersWorkspace() { Core.ResourceStore.ResourceTypes.Register("Folder", "Name"); int propInFolder = Core.ResourceStore.PropTypes.Register("InFolder", PropDataType.Link, PropTypeFlags.CountUnread); _wsManager.RegisterWorkspaceType("Folder", new int[] { propInFolder }, WorkspaceResourceType.Container); IResource ws = _wsManager.CreateWorkspace("Test"); IResource folder = _storage.NewResource("Folder"); _wsManager.AddResourceToWorkspace(ws, folder); UnreadState theState = _unreadManager.SetUnreadState("", ws); Assert.AreEqual(0, theState.GetUnreadCount(folder)); IResource email = _storage.NewResource("Email"); email.SetProp(_propUnread, true); Assert.AreEqual(0, theState.GetUnreadCount(folder)); email.AddLink("InFolder", folder); Assert.AreEqual(1, theState.GetUnreadCount(folder)); email.DeleteLink("InFolder", folder); Assert.AreEqual(0, theState.GetUnreadCount(folder)); }
[SetUp] public void SetUp() { _core = new TestCore(); _storage = _core.ResourceStore; _workspaceManager = Core.WorkspaceManager; _workspaceManager.RegisterWorkspaceType("Category", new int[] { (Core.CategoryManager as CategoryManager).PropCategory }, WorkspaceResourceType.Filter); _workspace = _workspaceManager.CreateWorkspace("WS"); _storage.ResourceTypes.Register("Folder", "Name"); _storage.ResourceTypes.Register("Email", "Name"); _treePane = new ViewsCategoriesPane(); }
[Test] public void UnreadCountersForViewsInWorkspace() { Core.ResourceStore.ResourceTypes.Register( "Folder", "Name" ); int propInFolder = Core.ResourceStore.PropTypes.Register( "InFolder", PropDataType.Link ); _wsManager.RegisterWorkspaceType( "Folder", new int[] { propInFolder }, WorkspaceResourceType.Container ); IResource condition = _registry.RecreateStandardCondition( "Today", "Today", null, "Date", ConditionOp.InRange, "Today", "+1" ); IResource today = _registry.RegisterView( "Today", new IResource[ 1 ]{ condition }, null ); _engine.InitializeCriteria(); IResource ws = _wsManager.CreateWorkspace( "Test" ); IResource folder = _storage.NewResource( "Folder" ); _wsManager.AddResourceToWorkspace( ws, folder ); UnreadState theState = _unreads.SetUnreadState( "", ws ); Assert.AreEqual( 0, theState.GetUnreadCount( today ) ); _emailResource.AddLink( propInFolder, folder ); Assert.AreEqual( 1, theState.GetUnreadCount( today ) ); }