<commit_before>﻿using ComponentSpecification.AutomationLayer;
using TddXt.AnyRoot;
using Xunit;

namespace ComponentSpecification;

public class GivenAnOperationIsStarted
{

  [Fact]
  public void ShouldStartPluginOperation()
  {
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    //GIVEN
    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    //THEN
    context.Operations.AssertWasRun(operationName11);
  }


  [Fact]
  public void ShouldDisplayStartedOperationAsInProgress()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);

    //WHEN
    context.StartOperation(componentName1, operationName11);

    //THEN
    context.OperationsView.AssertSelectedOperationIsDisplayedAsInProgress();
  }

  [Fact]
  public void ShouldDisplayStoppedOperationAsStopped()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    //WHEN
    context.Operations.MakeRunningOperationStop();

    context.OperationsView.AssertSelectedOperationIsDisplayedAsStopped();
  }

  [Fact]
  public void ShouldDisplaySuccessfulOperationAsSuccessful()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    context.Operations.MakeRunningOperationSucceed();

    context.OperationsView.AssertSelectedOperationIsDisplayedAsSuccessful();
  }

  [Fact]
  public void ShouldDisplayFailedOperationAsFailed()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();
    var exception = Any.Exception();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    //WHEN
    context.Operations.MakeRunningOperationFailWith(exception);

    //THEN
    context.OperationsView.AssertSelectedOperationIsDisplayedAsFailedWith(exception);
  }

}<commit_msg>Update GivenAnOperationIsStarted.cs<commit_after>﻿using ComponentSpecification.AutomationLayer;
using TddXt.AnyRoot;
using Xunit;

namespace ComponentSpecification;

public class GivenAnOperationIsStarted
{
  [Fact]
  public void ShouldStartPluginOperation()
  {
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    //GIVEN
    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    //THEN
    context.Operations.AssertWasRun(operationName11);
  }

  [Fact]
  public void ShouldDisplayStartedOperationAsInProgress()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);

    //WHEN
    context.StartOperation(componentName1, operationName11);

    //THEN
    context.OperationsView.AssertSelectedOperationIsDisplayedAsInProgress();
  }

  [Fact]
  public void ShouldDisplayStoppedOperationAsStopped()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    //WHEN
    context.Operations.MakeRunningOperationStop();

    context.OperationsView.AssertSelectedOperationIsDisplayedAsStopped();
  }

  [Fact]
  public void ShouldDisplaySuccessfulOperationAsSuccessful()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    context.Operations.MakeRunningOperationSucceed();

    context.OperationsView.AssertSelectedOperationIsDisplayedAsSuccessful();
  }

  [Fact]
  public void ShouldDisplayFailedOperationAsFailed()
  {
    //GIVEN
    var context = new ComponentBasedTestToolDriver();
    var componentName1 = Any.ComponentName();
    var operationName11 = Any.OperationName();
    var exception = Any.Exception();

    context.ComponentsSetup.Add(componentName1)
      .WithOperation(operationName11);

    context.StartApplication();
    context.ComponentsView.AddInstanceOf(componentName1);
    context.StartOperation(componentName1, operationName11);

    //WHEN
    context.Operations.MakeRunningOperationFailWith(exception);

    //THEN
    context.OperationsView.AssertSelectedOperationIsDisplayedAsFailedWith(exception);
  }
}
{'fraction_non_alphanumeric': 0.09042636264251132, 'fraction_numerical': 0.016242386381383728, 'mean_word_length': 4.677304964539007, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5327469', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1702, 'n_words': 267}