public void BeamActionReference() { var actionsGraph = Setup.ActionGraph; var modifierRegister = new ModifierRegister(); modifierRegister.Register(actionsGraph); Setup.Document.Transact(); BuildPoint(Setup.Document, _point1); BuildPoint(Setup.Document, _point2); Setup.Document.Commit("Draw initial shapes"); Setup.SwitchUserAction(ModifierNames.None); Assert.AreEqual(2, Setup.Document.Root.Children.Count, "The first two shapes aren't drawn"); Setup.SwitchUserAction(Constant.ActionBeam); var container = ((MetaActionContainer)Setup.ActionGraph.ModifierContainer[Constant.ActionBeam]); var dependency = container.Dependency; var firstPoint = new SceneSelectedEntity(Setup.Document.Root.Children[0]); var secondPoint = new SceneSelectedEntity(Setup.Document.Root.Children[1]); dependency.ProposeCandidate(firstPoint); container.PushValue(firstPoint); dependency.ProposeCandidate(secondPoint); container.PushValue(secondPoint); Setup.SwitchUserAction(ModifierNames.None); Assert.AreEqual(3, Setup.Document.Root.Children.Count); }
public void RegisterAction() { var actionsGraph = Setup.ActionGraph; Assert.IsNotNull(actionsGraph); var input = actionsGraph[InputNames.ListCommandInput]; Assert.IsNotNull(input); var dataPackage = input.GetData(NotificationNames.GetValue); Assert.IsNotNull(dataPackage); var commandList = dataPackage.Get <CommandList>(); Assert.IsNotNull(commandList); // Does not allways work, because the Setup.ResetSetupEnvironment doesn't remove the entries. var action = commandList.GetAction(Constant.ActionBeam); Assert.IsNull(action); _sut.Register(actionsGraph); action = commandList.GetAction(Constant.ActionBeam); Assert.IsNotNull(action); }
public void ConfigureTestEnvironment() { _setup = new SetupUtils(); _setup.InitializeModifiersSetup(); var actionsGraph = _setup.ActionGraph; var modifierRegister = new ModifierRegister(); modifierRegister.Register(actionsGraph); var functionFactory = actionsGraph[InputNames.FunctionFactoryInput].GetData(NotificationNames.GetValue).Get <IFunctionFactory>(); _sut = functionFactory.Get(Constant.FunctionBeam.GetHashCode()); }
public void RegisterFunction() { Assert.AreEqual(ApartmentState.STA, Thread.CurrentThread.GetApartmentState()); var actionsGraph = Setup.ActionGraph; Assert.IsNotNull(actionsGraph); var input = actionsGraph.InputContainer[InputNames.FunctionFactoryInput]; Assert.IsNotNull(input); var dataPackage = input.GetData(NotificationNames.GetValue); Assert.IsNotNull(dataPackage); var functionFactory = dataPackage.Get <IFunctionFactory>(); Assert.IsNotNull(functionFactory); _sut.Register(actionsGraph); const string functionName = "TwoPointLineFunction"; var functionBase = functionFactory.Get(functionName.GetHashCode()); Assert.AreEqual(functionBase.Name, functionName); }
public void RegisterNullArgument() { _sut.Register(null); }