Пример #1
0
        public void Dispatch_NoHandlerDefined_ThrowsException()
        {
            var commandDispatcher = new CommandDispatcher(t => { throw new Exception(); });
              var expectedMessage = string.Format("Can not resolve handler for ICommandHandler<{0}>", typeof(ICommand).Name);

              Assert.That(() => commandDispatcher.Dispatch(_command), Throws.InstanceOf<ResolverException>().And.Message.EqualTo(expectedMessage));
        }
Пример #2
0
        public void Dispatch_QueryHandlerResolved_CallsHandleMethod()
        {
            var commandDispatcher = new CommandDispatcher(t => _handler);

              commandDispatcher.Dispatch(_command);

              _handler.CallsTo(m => m.Handle(_command)).MustHaveHappened(Repeated.Exactly.Once);
        }
Пример #3
0
        public void Dispatch_CallsResolverWithExpectedType()
        {
            bool wasCalledWithExpectedType = false;
              var commandDispatcher = new CommandDispatcher(t =>
              {
            if (t == typeof(ICommandHandler<ICommand>))
            {
              wasCalledWithExpectedType = true;
            }
            return _handler;
              });

              commandDispatcher.Dispatch(_command);

              Assert.That(wasCalledWithExpectedType, Is.True);
        }
        public void ShouldDispatchCommandWithoutParameters(
			string commandArgument,
			string scope,
			string commandName,
			[Frozen]Mock<ITypeNameMatcher> typeNameMatcher,
			[Frozen]Mock<IKernel> kernel,
			Mock<FooCommand> command,
			CommandDispatcher commandDispatcher)
        {
            typeNameMatcher.Setup(x => x.IsSatisfiedBy(commandArgument)).Returns(true);
            typeNameMatcher.Setup(x => x.GetMatchedType(commandArgument)).Returns(FooCommandType);
            kernel.Setup(x => x.Resolve(FooCommandType)).Returns(command.Object);

            commandDispatcher.Dispatch(new string[] { scope, commandName });

            command.Verify(x => x.Execute(It.Is<string[]>(y => !y.Any())));
        }
        public void ShouldDispatchAliasCommandWithParameter(
			string commandArgument,
			string alias,
			string commandParameter,
			[Frozen]Mock<ITypeNameMatcher> typeNameMatcher,
			[Frozen]Mock<IAliasMatcher> aliasMatcher,
			[Frozen]Mock<IKernel> kernel,
			Mock<FooCommand> command,
			CommandDispatcher commandDispatcher)
        {
            typeNameMatcher.Setup(x => x.IsSatisfiedBy(It.IsAny<string>())).Returns(false);
            aliasMatcher.Setup(x => x.IsSatisfiedBy(alias)).Returns(true);

            aliasMatcher.Setup(x => x.GetMatchedType(alias)).Returns(FooCommandType);
            kernel.Setup(x => x.Resolve(FooCommandType)).Returns(command.Object);

            commandDispatcher.Dispatch(new string[] { alias, commandParameter });

            command.Verify(x => x.Execute(It.Is<string[]>(y => y.Length == 1 && y.Any(z => z == commandParameter))));
        }
        public void Dispatch_Command_With_ReturnValue()
        {
            //arrange
            var command = new TestCommandReturns();
            var commandHandler = MockRepository.GenerateMock<Handles<TestCommandReturns>>();
            commandHandler
                .Expect(handle => handle.Handle(command));

            ICommandDispatcher dispatcher = new CommandDispatcher();
            dispatcher.Register<TestCommandReturns>(commandHandler);

            //act
            dispatcher.Dispatch<TestCommandReturns>(command);

            //assert
            commandHandler.VerifyAllExpectations();

            //if we try to register the same command a second time we get an exception
            Assert.Throws<InvalidOperationException>(() => dispatcher.Register<TestCommandReturns>(commandHandler));
        }
Пример #7
0
        public void FrameNextPrevWithoutSelectionTest()
        {
            CreateNode <FooNode>("N0", Vector2.zero);
            CreateNode <FooNode>("N1", Vector2.zero);
            CreateNode <FooNode>("N2", Vector2.zero);
            CreateNode <FooNode>("N3", Vector2.zero);

            graphView.RebuildUI(GraphModel, CommandDispatcher);

            // Reset selection for next test
            CommandDispatcher.Dispatch(new ClearSelectionCommand());

            graphView.DispatchFrameNextCommand(e => true);
            AssertSingleSelectedElementTypeAndName(typeof(FooNode), "N0");

            // Reset selection for prev test
            CommandDispatcher.Dispatch(new ClearSelectionCommand());

            graphView.DispatchFramePrevCommand(e => true);
            AssertSingleSelectedElementTypeAndName(typeof(FooNode), "N3");
        }
Пример #8
0
        public IActionResult ChangeStatus(long id, bool status, string returnUrl = "Comment/List")
        {
            var result = _commandDispatcher.Dispatch(new ChangeStatusCommentCommand()
            {
                CommentId = id, CommentStatus = status
            });

            if (result.IsSuccess)
            {
                return(Redirect(returnUrl));
            }
            if (result.Message != null)
            {
                ModelState.AddModelError("", result.Message);
            }
            foreach (var item in result.Errors)
            {
                ModelState.AddModelError("", item);
            }
            return(Redirect(returnUrl));
        }
        public IEnumerator CanRedoSelectionAndEnterPlayMode()
        {
            // Note: this somewhat complex use case ensure that selection for redo
            // and persisted selection are kep in sync
            MarkGraphViewStateDirty();
            yield return(null);

            GetNodesAndSetViewDataKey(out Node node1, out Node node2, out Node node3);

            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Add, node1Model, node3Model));

            Undo.PerformUndo();
            Undo.PerformRedo();

            Assert.True(node1.IsSelected());
            Assert.False(node2.IsSelected());
            Assert.True(node3.IsSelected());

            // Allow 1 frame to let the persistence be saved
            yield return(null);

            // This will re-create the window, flushing all temporary state
            yield return(new EnterPlayMode());

            node1Model = CreateNode(key1, new Vector2(200, 200));
            node2Model = CreateNode(key2, new Vector2(400, 400));
            node3Model = CreateNode(key3, new Vector2(600, 600));

            MarkGraphViewStateDirty();
            yield return(null);

            GetNodesAndSetViewDataKey(out node1, out node2, out node3);

            // Allow 1 frame to let the persistence be restored
            yield return(null);

            Assert.True(node1.IsSelected());
            Assert.False(node2.IsSelected());
            Assert.True(node3.IsSelected());
        }
Пример #10
0
        public IEnumerator TestHighlightFieldSelection()
        {
            MarkGraphViewStateDirty();
            yield return(null);

            GetUI(out var intToken1, out _, out var stringToken1, out _,
                  out var intField, out var stringField);

            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Replace, (intField as GraphElement)?.Model));
            yield return(null);

            Assert.IsTrue(intToken1.Highlighted, "1. intToken1.highlighted");
            Assert.IsFalse(intField.Highlighted, "1. m_IntField.highlighted");
            Assert.IsFalse(stringToken1.Highlighted, "1. stringToken1.highlighted");
            Assert.IsFalse(stringField.Highlighted, "1. m_StringField.highlighted");

            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Add, (stringField as GraphElement)?.Model));
            yield return(null);

            Assert.IsTrue(intToken1.Highlighted, "2. intToken1.highlighted");
            Assert.IsFalse(intField.Highlighted, "2. m_IntField.highlighted");
            Assert.IsTrue(stringToken1.Highlighted, "2. stringToken1.highlighted");
            Assert.IsFalse(stringField.Highlighted, "2. m_StringField.highlighted");

            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Remove, (intField as GraphElement)?.Model));
            yield return(null);

            Assert.IsFalse(intToken1.Highlighted, "3. intToken1.highlighted");
            Assert.IsFalse(intField.Highlighted, "3. m_IntField.highlighted");
            Assert.IsTrue(stringToken1.Highlighted, "3. stringToken1.highlighted");
            Assert.IsFalse(stringField.Highlighted, "3. m_StringField.highlighted");

            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Remove, (stringField as GraphElement)?.Model));
            yield return(null);

            Assert.IsFalse(intToken1.Highlighted, "4. intToken1.highlighted");
            Assert.IsFalse(intField.Highlighted, "4. m_IntField.highlighted");
            Assert.IsFalse(stringToken1.Highlighted, "4. stringToken1.highlighted");
            Assert.IsFalse(stringField.Highlighted, "4. m_StringField.highlighted");
        }
Пример #11
0
        public virtual void CanAddMultipleDomainEventsToSingleEventProviderConcurrentlyWithConcurrencyException()
        {
            var command      = new Create(SequentialAtEndGuidGenerator.NewGuid(), 100);
            var domainEvents = AccountAggregateRoot.Create(command);

            domainEvents.AggregateRoot.State.ExternalStateTracker = GetStateTracker(domainEvents);

            Repository.Commit(new CommandHandlerContext(command), domainEvents.AggregateRoot as AccountAggregateRoot);

            var account = Repository.GetByIdentity(domainEvents.AggregateRoot.Identity);

            Assert.IsNotNull(account);

            var dispatcher = new CommandDispatcher(new CommandHandlerFactory(new CommandCatalog(new List <ICommandEntry> {
                new StaticCommandEntry(typeof(Deposit), new AggregateRootCommandHandler <AccountAggregateRoot, Deposit>(Repository))
            })), new CommandHandlerContextFactory(MetaFactories));

            Parallel.For(0, 30, (i) =>
            {
                dispatcher.Dispatch(new Deposit(account.Identity, i));
            });
        }
        public void Dispatch_Command_With_ReturnValue()
        {
            //arrange
            var command        = new TestCommandReturns();
            var commandHandler = MockRepository.GenerateMock <Handles <TestCommandReturns> >();

            commandHandler
            .Expect(handle => handle.Handle(command));

            ICommandDispatcher dispatcher = new CommandDispatcher();

            dispatcher.Register <TestCommandReturns>(commandHandler);

            //act
            dispatcher.Dispatch <TestCommandReturns>(command);

            //assert
            commandHandler.VerifyAllExpectations();

            //if we try to register the same command a second time we get an exception
            Assert.Throws <InvalidOperationException>(() => dispatcher.Register <TestCommandReturns>(commandHandler));
        }
Пример #13
0
        public IActionResult Add([FromBody] UrlModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = _commandDispatcher.Dispatch(new AddNewUrlCommand()
            {
                Url = model.Url
            });

            if (!result.IsSuccess)
            {
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError("", item);
                }
                return(BadRequest(ModelState));
            }

            return(Ok(new { url = result.DataResult }));
        }
Пример #14
0
        public override void SetUp()
        {
            base.SetUp();

            GraphViewSettings.UserSettings.EnableSnapToBorders = false;
            GraphViewSettings.UserSettings.EnableSnapToPort    = false;


            m_AssetModel = GraphAssetCreationHelpers <TestAssetModel> .CreateGraphAsset(typeof(TestStencil), "TestFile", k_FilePath);

            CommandDispatcher.Dispatch(new LoadGraphAssetCommand(m_AssetModel));

            m_NodeModel = CreateNode("Movable element", k_NodePos, 0, 1);

            // Add the minimap.
            var miniMap = new MiniMap();

            miniMap.style.left   = k_MinimapRect.x;
            miniMap.style.top    = k_MinimapRect.y;
            miniMap.style.width  = k_MinimapRect.width;
            miniMap.style.height = k_MinimapRect.height;
            graphView.Add(miniMap);
        }
Пример #15
0
        private static bool TryRunCommand(string cmd)
        {
            if (cmd.Length > 1 && cmd[0] == CommandDispatcher.Prefix[0])
            {
                var    command = cmd.Substring(1).Trim();
                int    idx;
                object argument = null;

                if ((idx = command.IndexOf(' ')) != -1)
                {
                    var str = command;
                    command  = command.Substring(0, idx);
                    argument = str.Substring(idx + 1, str.Length - idx - 1);
                }

                dispatcher.Dispatch(command, argument);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #16
0
        public void Execute()
        {
            string line;
            var    cmd            = new CommandDispatcher();
            var    logEntropyList = new List <LogEntropy>();
            // Read the file and display it line by line.
            var file =
                new System.IO.StreamReader(@"C:\Users\Brandon Curry\Documents\Visual Studio 2015\Projects\miRNAWeb\Jobs\Files\miRNA_LE_terms.txt");

            while ((line = file.ReadLine()) != null)
            {
                var temp = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                logEntropyList.AddRange(temp[2].Split(';').Where(le => le.Any()).Select(le => new LogEntropy
                {
                    Accession      = temp[0],
                    Symbol         = temp[1],
                    LogEntropyTerm = le
                }));
            }

            cmd.Dispatch(new BulkInsertLogEntropysCommand(logEntropyList));
            file.Close();
        }
Пример #17
0
        public void Execute()
        {
            string line;
            var    cmd          = new CommandDispatcher();
            var    abstractList = new List <Abstract>();
            // Read the file and display it line by line.
            var file =
                new System.IO.StreamReader(@"C:\Users\Brandon Curry\Documents\Visual Studio 2015\Projects\miRNAWeb\Jobs\Files\miRNA_PMID_mapping.txt");

            while ((line = file.ReadLine()) != null)
            {
                var temp = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                abstractList.AddRange(temp[3].Split(';').Where(pmid => pmid.Any()).Select(pmid => new Abstract
                {
                    Accession = temp[0],
                    Symbol    = temp[1],
                    Pmid      = pmid
                }));
            }

            cmd.Dispatch(new BulkInsertAbstractsCommand(abstractList));
            file.Close();
        }
Пример #18
0
        private static void Main(string[] args)
        {
            var container = ConfigureGriffinContainer();

            // will recieve any pipeline errors (i.e. failure to deliver the messages)
            var errorHandler = new ErrorHandler();

            // will also assign the pipeline
            var dispatcher = new PipelineDispatcherBuilder(errorHandler)
                             .AsyncDispatching(10)           // allow 10 commands to be dispatched simultaneosly
                             .RetryCommands(3)               // attempt to execute commands three times.
                             .UseGriffinContainer(container) // Use Griffin.Container (the "Griffin.Decoupled.Container" nuget package)
                             .UseRavenDbEmbedded()           // use RavenDb to store pending commands (the "Griffin.Decoupled.RavenDb.Embedded" nuget package)
                             .Build();                       // and lets go.

            // assign it
            CommandDispatcher.Assign(dispatcher);

            Console.WriteLine("We are on thread #" + Thread.CurrentThread.ManagedThreadId);
            CommandDispatcher.Dispatch(new SayHello());

            Console.ReadLine();
        }
        public IEnumerator DeletableElementCanBeDeleted()
        {
            yield return(null);

            var node1 = m_NodeModel1.GetUI <Node>(graphView);
            var node2 = m_NodeModel2.GetUI <Node>(graphView);

            Assert.IsNotNull(node1);
            Assert.IsNotNull(node2);

            Assert.True(m_NodeModel1.IsDeletable());
            Assert.False(m_NodeModel2.IsDeletable());

            // We need to get the graphView in focus for the commands to be properly sent.
            graphView.Focus();

            Assert.AreEqual(2, graphView.GraphElements.ToList().Count);

            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Replace, m_NodeModel1));
            yield return(null);

            helpers.ExecuteCommand("Delete");
            yield return(null);

            Assert.AreEqual(1, graphView.GraphElements.ToList().Count);

            // Node 2 is not deletable.
            // Selecting it and sending the Delete command should leave the node count unchanged.
            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Replace, m_NodeModel2));
            yield return(null);

            helpers.ExecuteCommand("Delete");
            yield return(null);

            Assert.AreEqual(1, graphView.GraphElements.ToList().Count);
            yield return(null);
        }
Пример #20
0
        protected override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
        {
            base.BuildContextualMenu(evt);

            if (!(Model is MixNodeModel mixNodeModel))
            {
                return;
            }

            if (evt.menu.MenuItems().Count > 0)
            {
                evt.menu.AppendSeparator();
            }

            evt.menu.AppendAction($"Add Ingredient", action: action =>
            {
                CommandDispatcher.Dispatch(new AddPortCommand(new[] { mixNodeModel }));
            });

            evt.menu.AppendAction($"Remove Ingredient", action: action =>
            {
                CommandDispatcher.Dispatch(new RemovePortCommand(new[] { mixNodeModel }));
            });
        }
        public IEnumerator SelectionIsRestoredWhenEnteringPlaymode_AddNodesAfterPersistence()
        {
            MarkGraphViewStateDirty();
            yield return(null);

            GetNodesAndSetViewDataKey(out Node node1, out Node node2, out Node node3);

            Assert.IsNotNull(node1);
            Assert.IsNotNull(node2);
            Assert.IsNotNull(node3);

            // Add two nodes to selection.
            CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Add, node1Model, node3Model));

            // Allow 1 frame to let the persistent data get saved
            yield return(null);

            // This will re-create the window, flushing all temporary state
            yield return(new EnterPlayMode());

            // Allow 1 frame to let the persistence be restored
            yield return(null);

            MarkGraphViewStateDirty();
            yield return(null);

            GetNodesAndSetViewDataKey(out node1, out node2, out node3);

            Assert.IsNotNull(node1);
            Assert.IsNotNull(node2);
            Assert.IsNotNull(node3);

            Assert.True(node1.IsSelected());
            Assert.False(node2.IsSelected());
            Assert.True(node3.IsSelected());
        }
Пример #22
0
        public void Execute()
        {
            int    count = 683;
            string line;
            var    cmd        = new CommandDispatcher();
            var    vectorData = new List <VectorJobData>();
            // Read the file and display it line by line.
            var file =
                new System.IO.StreamReader(@"C:\Users\Brandon Curry\Documents\Visual Studio 2015\Projects\miRNAWeb\Jobs\Files\final.txt");

            while ((line = file.ReadLine()) != null)
            {
                var temp = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                vectorData.Add(new VectorJobData
                {
                    VectorMetaData = new VectorMetaData
                    {
                        Name             = temp[0],
                        Type             = "term",
                        VectorMetaDataId = count
                    },
                    Vector = new Vector {
                        Values = Array.ConvertAll(temp.Skip(1).ToArray(), double.Parse)
                    }
                });

                count++;
            }


            //cmd.Dispatch(new BulkInsertAbstractsCommand(abstractList));
            file.Close();

            vectorData = vectorData.Skip(36372).ToList();
            vectorData.ForEach(x => cmd.Dispatch(new BulkInsertVectorsCommand(x)));
        }
Пример #23
0
        public CommandResult ExecuteCommand(Command command)
        {
            var commandDispatcher = new CommandDispatcher();

            return(commandDispatcher.Dispatch(command));
        }
Пример #24
0
 public override void Dispatch(CommandDispatcher commandDispatcher, long commandIndex, System.Action <Result> callback)
 {
     commandDispatcher.Dispatch(this, commandIndex, callback);
 }
Пример #25
0
 public ActionResult Create(string text)
 {
     CommandDispatcher.Dispatch(new CreateMessage(Guid.NewGuid(), text));
     return(RedirectToAction("Index"));
 }
        public void ShouldThrowDispatcherExceptionOnApiException(
			string commandArgument,
			[Frozen]Mock<ITypeNameMatcher> typeNameMatcher,
			[Frozen]Mock<IKernel> kernel,
			Mock<FooCommand> command,
			CommandDispatcher commandDispatcher)
        {
            typeNameMatcher.Setup(x => x.IsSatisfiedBy(commandArgument)).Returns(true);
            typeNameMatcher.Setup(x => x.GetMatchedType(It.IsAny<string>())).Returns(FooCommandType);
            kernel.Setup(x => x.Resolve(FooCommandType)).Returns(command.Object);

            command.Setup(x => x.Execute(new string[0])).Throws<ApiException>();

            Assert.Throws<DispatchException>(() => commandDispatcher.Dispatch(new string[] { commandArgument }));
        }
Пример #27
0
        public ActionResult Start(string name)
        {
            CommandDispatcher.Dispatch(new StartApplicationPool(name));

            return(NoContent());
        }
Пример #28
0
        public ActionResult Add(AddApplication command)
        {
            CommandDispatcher.Dispatch(command);

            return(Created($"applications/{command.ApplicationName}", null));
        }
        public void ShouldDispatchHelpWhenNoCommand(
			[Frozen]Mock<ITypeNameMatcher> typeNameMatcher,
			[Frozen]Mock<IKernel> kernel,
			Mock<FooCommand> command,
			CommandDispatcher commandDispatcher)
        {
            var helpArgument = "help";
            typeNameMatcher.Setup(x => x.IsSatisfiedBy(helpArgument)).Returns(true);
            typeNameMatcher.Setup(x => x.GetMatchedType(helpArgument)).Returns(FooCommandType);
            kernel.Setup(x => x.Resolve(FooCommandType)).Returns(command.Object);

            commandDispatcher.Dispatch(new string[0]);

            typeNameMatcher.VerifyAll();
        }
Пример #30
0
 public TResponse Handle <TType, TRequest, TResponse>(TRequest request)
     where TType : ICommand <TRequest, TResponse>, new()
     where TRequest : class
 {
     return(dispatcher.Dispatch <TType, TRequest, TResponse>(request));
 }
 public override void Execute()
 {
     CommandDispatcher.Dispatch(this);
 }
Пример #32
0
        public async Task MustGetMessageHandler()
        {
            await _sut.Dispatch <IMessage>(null, null);

            _serviceProvider.Verify(p => p.GetService(typeof(IMessageHandler <IMessage>)), Times.Once);
        }
Пример #33
0
        public ActionResult Delete(string name)
        {
            CommandDispatcher.Dispatch(new DeleteApplicationPool(name));

            return(NoContent());
        }
Пример #34
0
 public void Execute(IAPICommand command)
 {
     commandDispatcher.Dispatch <object>(command);
 }
Пример #35
0
        public IEnumerator AlignNodesHierarchiesCommandWorks([Values] TestingMode mode)
        {
            var constantA = GraphModel.CreateConstantNode(typeof(int).GenerateTypeHandle(), "constantA", Vector2.zero);
            var binary0   = GraphModel.CreateNode <Type0FakeNodeModel>("Node1", Vector2.one * 200);
            var binary1   = GraphModel.CreateNode <Type0FakeNodeModel>("Node2", Vector2.one * 500);

            GraphModel.CreateEdge(binary0.Input0, constantA.OutputPort);
            GraphModel.CreateEdge(binary1.Input0, binary0.Output0);

            MarkGraphViewStateDirty();
            yield return(null);

            void RefreshModelReferences()
            {
                constantA = GraphModel.NodeModels[0] as IConstantNodeModel;
                binary0   = GraphModel.NodeModels[1] as Type0FakeNodeModel;
                binary1   = GraphModel.NodeModels[2] as Type0FakeNodeModel;

                Assert.IsNotNull(constantA);
                Assert.IsNotNull(binary0);
                Assert.IsNotNull(binary1);
            }

            yield return(TestPrereqCommandPostreq(mode,
                                                  () =>
            {
                RefreshModelReferences();

                Assert.That(binary0.Input0, Is.ConnectedTo(constantA.OutputPort));
                Assert.That(binary1.Input0, Is.ConnectedTo(binary0.Output0));

                var port0UI = binary0.Output0.GetUI <Port>(GraphView);
                Assert.IsNotNull(port0UI);
                var port1UI = binary1.Input0.GetUI <Port>(GraphView);
                Assert.IsNotNull(port1UI);
                Assert.AreNotEqual(GetPortY(port0UI), GetPortY(port1UI));

                var port2UI = constantA.OutputPort.GetUI <Port>(GraphView);
                Assert.IsNotNull(port2UI);
                var port3UI = binary0.Input0.GetUI <Port>(GraphView);
                Assert.IsNotNull(port3UI);
                Assert.AreNotEqual(GetPortY(port2UI), GetPortY(port3UI));
            },
                                                  frame =>
            {
                switch (frame)
                {
                case 0:
                    CommandDispatcher.Dispatch(new AlignNodesCommand(GraphView, true, binary1));
                    return TestPhase.WaitForNextFrame;

                default:
                    return TestPhase.Done;
                }
            },
                                                  () =>
            {
                RefreshModelReferences();

                var port0UI = binary0.Output0.GetUI <Port>(GraphView);
                Assert.IsNotNull(port0UI);
                var port1UI = binary1.Input0.GetUI <Port>(GraphView);
                Assert.IsNotNull(port1UI);
                Assert.AreEqual(GetPortY(port0UI), GetPortY(port1UI));

                var port2UI = constantA.OutputPort.GetUI <Port>(GraphView);
                Assert.IsNotNull(port2UI);
                var port3UI = binary0.Input0.GetUI <Port>(GraphView);
                Assert.IsNotNull(port3UI);
                Assert.AreEqual(GetPortY(port2UI), GetPortY(port3UI));
            }));
        }
Пример #36
0
 internal static bool Dispatch(ICommandSource?source, string line) => dispatcher.Dispatch(source, line);
        public void ShouldThrowIfNoTypeMatcherAreSatisfied(string commandArgument,
			[Frozen]Mock<ITypeNameMatcher> typeNameMatcher,
			[Frozen]Mock<IAliasMatcher> aliasMatcher,
			CommandDispatcher commandDispatcher)
        {
            typeNameMatcher.Setup(x => x.IsSatisfiedBy(It.IsAny<string>())).Returns(false);
            aliasMatcher.Setup(x => x.IsSatisfiedBy(It.IsAny<string>())).Returns(false);

            Assert.Throws<DispatchException>(() => commandDispatcher.Dispatch(new string[] { commandArgument }));
        }
Пример #38
0
        public ActionResult Delete(DeleteApplication command)
        {
            CommandDispatcher.Dispatch(command);

            return(NoContent());
        }
Пример #39
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldApplyTransactionBatchAsSoonAsThereIsADifferentKindOfRequestInTheBatch()
        public virtual void ShouldApplyTransactionBatchAsSoonAsThereIsADifferentKindOfRequestInTheBatch()
        {
            using (CommandDispatcher dispatcher = _coreStateMachines.commandDispatcher())
            {
                dispatcher.Dispatch(_replicatedTransaction, 0, _callback);
                dispatcher.Dispatch(_replicatedTransaction, 1, _callback);

                dispatcher.Dispatch(_iAllocationRequest, 2, _callback);

                dispatcher.Dispatch(_replicatedTransaction, 3, _callback);
                dispatcher.Dispatch(_replicatedTransaction, 4, _callback);

                dispatcher.Dispatch(_relationshipTypeTokenRequest, 5, _callback);

                dispatcher.Dispatch(_replicatedTransaction, 6, _callback);
                dispatcher.Dispatch(_replicatedTransaction, 7, _callback);

                dispatcher.Dispatch(_lockTokenRequest, 8, _callback);

                dispatcher.Dispatch(_replicatedTransaction, 9, _callback);
                dispatcher.Dispatch(_replicatedTransaction, 10, _callback);
            }

            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 0, _callback);
            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 1, _callback);
            _verifier.verify(_txSM).ensuredApplied();

            _verifier.verify(_idAllocationSM).applyCommand(_iAllocationRequest, 2, _callback);

            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 3, _callback);
            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 4, _callback);
            _verifier.verify(_txSM).ensuredApplied();

            _verifier.verify(_relationshipTypeTokenSM).applyCommand(_relationshipTypeTokenRequest, 5, _callback);

            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 6, _callback);
            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 7, _callback);
            _verifier.verify(_txSM).ensuredApplied();

            _verifier.verify(_lockTokenSM).applyCommand(_lockTokenRequest, 8, _callback);

            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 9, _callback);
            _verifier.verify(_txSM).applyCommand(_replicatedTransaction, 10, _callback);
            _verifier.verify(_txSM).ensuredApplied();

            _verifier.verifyNoMoreInteractions();
        }