Beispiel #1
0
        public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
        {
            ActivityOutcomeData data = configuration.GetMetadata <ActivityOutcomeData>();

            _outcomeButtons[data.Result].Checked = true;
            randomOutcome_CheckBox.Checked       = data.RandomResult;
        }
Beispiel #2
0
        private PluginResult DetermineOutcome(ActivityOutcomeData activityData)
        {
            if (activityData.RandomResult)
            {
                var outcome = (new Random()).Next(8);
                switch (outcome)
                {
                case 0:
                case 1:
                    return(PluginResult.Skipped);

                case 2:
                    return(PluginResult.Failed);

                case 3:
                    return(PluginResult.Error);

                case 4:
                    throw new Exception("Intentional exception");

                default:
                    return(PluginResult.Passed);
                }
            }
            else
            {
                return(activityData.Result);
            }
        }
Beispiel #3
0
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            ActivityOutcomeData activityData = executionData.GetMetadata <ActivityOutcomeData>();
            var retryManager = new PluginRetryManager(executionData, UpdateStatus);

            return(retryManager.Run(() => DoActivity(executionData, activityData)));
        }
Beispiel #4
0
        public PluginConfigurationData GetConfiguration()
        {
            ActivityOutcomeData data = new ActivityOutcomeData()
            {
                Result       = _outcomeButtons.First(n => n.Value.Checked).Key,
                RandomResult = randomOutcome_CheckBox.Checked
            };

            return(new PluginConfigurationData(data, "1.0"));
        }
Beispiel #5
0
        private PluginExecutionResult DoActivity(PluginExecutionData executionData, ActivityOutcomeData activityData)
        {
            UpdateStatus("Starting activity");
            Wait(2);
            PluginResult result = DetermineOutcome(activityData);

            Wait(2);
            PluginExecutionResult executionResult = GetExecutionResult(result);

            UpdateStatus("Result = " + executionResult.Message);
            return(executionResult);
        }