コード例 #1
0
        public void GetManager_BehaviorIsLocatedInDifferentAncestorDisntances_ReturnsNearestManager()
        {
            var behavior = new UndoRootBehavior();

            var grandparent1 = new ViewModelStub(new UndoRootBehavior());

            var parent1 = new ViewModelStub();

            parent1.Kernel.Parents.Add(grandparent1);

            var parent2         = new ViewModelStub(behavior);
            var expectedManager = behavior.GetUndoManager(parent2.GetContext());

            var rootVM = new ViewModelStub();

            rootVM.Kernel.Parents.Add(parent1);
            rootVM.Kernel.Parents.Add(parent2);

            var foundManager = UndoManager.GetManager(rootVM);

            Assert.IsNotNull(foundManager);
            Assert.AreSame(expectedManager, foundManager);
        }