コード例 #1
0
        public void WhenIAddTheConsumedMessageToTheAgent(string type, string name, string agentName)
        {
            scenarioContext.WaitForSilentPulse();

            TreeViewModel  viewModel      = scenarioContext.Get <TreeViewModel>(StringConstants.TreeViewModelCreated);
            AgentViewModel agentViewModel = viewModel.Flatten().OfType <AgentViewModel>()
                                            .FirstOrDefault(m => m.Name == agentName);

            agentViewModel.Should().NotBeNull($"the message should be in the view model:{Environment.NewLine}" +
                                              string.Join(Environment.NewLine, viewModel.Flatten()));
            scenarioContext.Get <IMessageBoard>().Publish(new SelectedTreeViewItemChanged(agentViewModel, scenarioContext.Get <InitializeMessage>()));
            scenarioContext.WaitForSilentPulse();

            switch (type)
            {
            case "consumed":
                agentViewModel.NewConsumingMessage = name;
                break;

            case "produced":
                agentViewModel.NewProducingMessage = name;
                break;

            case "intercepted":
                agentViewModel.NewInterceptingMessage = name;
                break;
            }
        }
コード例 #2
0
        public void WhenISelectTheAgent(string agentName)
        {
            scenarioContext.WaitForSilentPulse();
            TreeViewModel viewModel = scenarioContext.Get <TreeViewModel>(StringConstants.TreeViewModelCreated);

            AgentViewModel viewItem = viewModel.Flatten().OfType <AgentViewModel>()
                                      .FirstOrDefault(
                m => m.Name == agentName && m.AgentType == AgentType.Agent);

            viewItem.Should().NotBeNull($"the agent {agentName} should be visible.");
            viewItem.Select();
            scenarioContext.Get <IMessageBoard>().Publish(new SelectedTreeViewItemChanged(viewItem, scenarioContext.Get <InitializeMessage>()));
        }