Пример #1
0
        [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 ) );
            */
        }
Пример #2
0
        [SetUp] public void SetUp()
        {
            _core    = new TestCore();
            _storage = Core.ResourceStore;

            _storage.ResourceTypes.Register("Folder", "Name");
            _storage.ResourceTypes.Register("Email", "Name");
            _storage.ResourceTypes.Register("Person", "Name");
            _propFolder = _storage.PropTypes.Register("Folder", PropDataType.Link,
                                                      PropTypeFlags.CountUnread | PropTypeFlags.DirectedLink);

            _folder = _storage.NewResource("Folder");

            _wsManager = _core.WorkspaceManager;

            MockResourceTabProvider resourceTabProvider = (MockResourceTabProvider)_core.GetComponentInstanceOfType(typeof(MockResourceTabProvider));

            resourceTabProvider.SetResourceTab("Email", "Email");

            _unreadManager = _core.UnreadManager as UnreadManager;
            _propUnread    = Core.Props.IsUnread;
            _propSize      = _storage.PropTypes.Register("Size", PropDataType.Int);
        }