private StubTrigger SetupRemoveAction(DependencyObject target) { StubTrigger trigger = new StubTrigger(); RemoveElementAction action = new RemoveElementAction(); trigger.Actions.Add(action); trigger.Attach(target); return(trigger); }
public void Invoke_TargetObjectSetButNotAttached_DoesNotRemove() { Grid grid = new Grid(); Rectangle rectangle = new Rectangle(); RemoveElementAction action = new RemoveElementAction(); StubTrigger trigger = new StubTrigger(); trigger.Actions.Add(action); grid.Children.Add(rectangle); action.TargetObject = rectangle; trigger.FireStubTrigger(); Assert.AreEqual(rectangle.Parent, grid, "Because the action is not attached to anything, invoking it should not do anything."); }