public void Constructor_RegistersWithActivationManager()
        {
            MockActivationManager activationManager = new MockActivationManager();
            ShareTargetManager shareTargetManager = CreateShareTargetManager(activationManager: activationManager);

            Assert.Contains(shareTargetManager, activationManager.RegisteredServices);
        }
Пример #2
0
        public void Constructor_RegistersWithActivationManager()
        {
            MockActivationManager activationManager = new MockActivationManager();
            SearchManager searchManager = CreateSearchMananger(activationManager: activationManager);

            CollectionAssert.Contains(activationManager.RegisteredServices, searchManager);
        }
        public void Constructor_RegistersWithActivationManager()
        {
            MockActivationManager activationManager = new MockActivationManager();
            LaunchActivationHandler activationHandler = CreateLaunchActivationHandler(activationManager: activationManager);

            Assert.Contains(activationHandler, activationManager.RegisteredServices);
        }
Пример #4
0
        public void SearchPageName_Exception_CannotSetValueOnceActivated()
        {
            MockActivationManager activationManager = new MockActivationManager();
            SearchManager searchManager = CreateSearchMananger(activationManager: activationManager);

            activationManager.RaiseActivatedEvent(new MockActivatedEventArgs());

            Assert.ThrowsException<InvalidOperationException>(() => searchManager.SearchPageName = "MySearchPage");
        }
        public void Constructor_ThrowsException_IfNavigationManagerIsNull()
        {
            MockActivationManager activationManager = new MockActivationManager();

            var e = Assert.Throws<ArgumentNullException>(() => new SearchManager(null, activationManager));

            Assert.Equal("Value cannot be null.\r\nParameter name: navigationManager", e.Message);
            Assert.Equal("navigationManager", e.ParamName);
        }
        // *** Private Methods ***

        private TestableShareTargetManager CreateShareTargetManager(MockActivationManager activationManager = null, IViewFactory viewFactory = null, bool setShareTargetPageName = true)
        {
            if (activationManager == null)
                activationManager = new MockActivationManager();

            if (viewFactory == null)
                viewFactory = new MockViewFactory();

            TestableShareTargetManager shareTargetManager = new TestableShareTargetManager(activationManager, viewFactory);

            if (setShareTargetPageName)
                shareTargetManager.ShareTargetPageName = "ShareTarget";

            return shareTargetManager;
        }
Пример #7
0
        // *** Private Methods ***

        private TestableSearchManager CreateSearchMananger(MockNavigationManager navigationManager = null, MockActivationManager activationManager = null, bool setSearchPageName = true)
        {
            if (navigationManager == null)
                navigationManager = new MockNavigationManager();

            if (activationManager == null)
                activationManager = new MockActivationManager();

            TestableSearchManager searchManager = new TestableSearchManager(navigationManager, activationManager);

            if (setSearchPageName)
                searchManager.SearchPageName = "Search";

            return searchManager;
        }
Пример #8
0
        public void OnMultipleActivations_CallsRegisterQuerySubmittedOnlyOnce()
        {
            MockActivationManager activationManager = new MockActivationManager();
            TestableSearchManager searchManager = CreateSearchMananger(activationManager: activationManager);

            activationManager.RaiseActivatedEvent(new MockActivatedEventArgs());
            activationManager.RaiseActivatedEvent(new MockActivatedEventArgs());

            Assert.AreEqual(1, searchManager.RegisterQuerySubmittedCount);
        }
Пример #9
0
 public void BeforeFirstActivation_DoesNotCallRegisterQuerySubmitted()
 {
     MockActivationManager activationManager = new MockActivationManager();
     TestableSearchManager searchManager = CreateSearchMananger(activationManager: activationManager);
 
     Assert.AreEqual(0, searchManager.RegisterQuerySubmittedCount);
 }
        public void SearchPageName_Exception_CannotSetValueOnceActivated()
        {
            MockActivationManager activationManager = new MockActivationManager();
            SearchManager searchManager = CreateSearchMananger(activationManager: activationManager);

            activationManager.RaiseActivatedEvent(new MockActivatedEventArgs());

            var e = Assert.Throws<InvalidOperationException>(() => searchManager.SearchPageName = "MySearchPage");

            Assert.Equal("The 'SearchPageName' property cannot be set after the application has been activated.", e.Message);
        }
        // *** Private Methods ***

        private LaunchActivationHandler CreateLaunchActivationHandler(INavigationManager navigationManager = null, IActivationManager activationManager = null)
        {
            if (navigationManager == null)
                navigationManager = new MockNavigationManager();

            if (activationManager == null)
                activationManager = new MockActivationManager();

            return new LaunchActivationHandler(activationManager, navigationManager);
        }