public void TestTaskbarListTestHelper()
 {
     TaskbarListTestHelper.DoWithNotImplementedHrInit(() => {
         var testWindow = new Window();
         testWindow.Show();
         try {
             Assert.IsNull(testWindow.TaskbarItemInfo);
             Assert.Throws <NotImplementedException>(() => testWindow.TaskbarItemInfo = new TaskbarItemInfo());
         } finally {
             testWindow.Close();
         }
     });
 }
        public void DoNotThrowsExceptionIfUserIsNotLoggedIn()
        {
            var testWindow = new Window();
            var service    = new TaskbarButtonService();

            try {
                TaskbarListTestHelper.DoWithNotImplementedHrInit(() => {
                    testWindow.Show();
                    EnqueueConditional(() => testWindow.IsLoaded);
                    Assert.IsNull(testWindow.TaskbarItemInfo);
                    Assert.DoesNotThrow(() => {
                        Interaction.GetBehaviors(testWindow).Add(service);
                        service.Description = "descr";
                    });
                    TaskbarListTestHelper.SendTaskBarButtonCreated(testWindow);
                });
            } finally {
                testWindow.Close();
            }
        }
示例#3
0
        public void DoNotThrowsExceptionIfUserIsNotLoggedInAndThusThereIsNoAnyTaskbarButton()
        {
            var testWindow = new Window();
            var service    = new TaskbarButtonService();

            try {
                TaskbarListTestHelper.DoWithNotImplementedHrInit(() => {
                    testWindow.Show();
                    EnqueueConditional(() => testWindow.IsLoaded);
                    Assert.IsNull(testWindow.TaskbarItemInfo);
                    Assert.DoesNotThrow(() => {
                        Interaction.GetBehaviors(testWindow).Add(service);
                        service.Description = "descr";
                    });
                    Assert.IsNotNull(testWindow.TaskbarItemInfo);
                });
                Assert.IsNull(testWindow.GetType().GetField("_taskbarList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(testWindow));
                TaskbarListTestHelper.SendTaskBarButtonCreated(testWindow);
                Assert.IsNotNull(testWindow.GetType().GetField("_taskbarList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(testWindow));
            } finally {
                testWindow.Close();
            }
        }