RunCodeAsSTA() public static method

public static RunCodeAsSTA ( AutoResetEvent are, ThreadStart originalDelegate ) : void
are System.Threading.AutoResetEvent
originalDelegate ThreadStart
return void
Example #1
0
        public void FilteredNavigationViewModel_WhereFilterReset_Expects_OriginalExpandState()
        {
            IExplorerItemModel resourceVM = null;

            var reset = new AutoResetEvent(false);

            ThreadExecuter.RunCodeAsSTA(reset,
                                        () =>
            {
                Init(false, true);
                resourceVM = _vm.FindChild(_mockResourceModel.Object);
                IExplorerItemModel resourceVM2_1 = _vm.FindChild(_mockResourceModel1.Object);
                IExplorerItemModel resourceVM2_2 = _vm.FindChild(_mockResourceModel2.Object);

                Assert.IsTrue(resourceVM.Parent.IsExplorerExpanded == false);
                Assert.IsTrue(resourceVM2_1.Parent.IsExplorerExpanded == false);
                Assert.IsTrue(resourceVM2_2.Parent.IsExplorerExpanded == false);

                _vm.UpdateSearchFilter("Mock2");

                _vm.UpdateSearchFilter("");
            });
            reset.WaitOne();

            Assert.IsTrue(resourceVM.Parent.IsExplorerExpanded == false);
        }