/Tests/TechTalk.SpecFlow.Specs/StepDefinitions/ExecutionSteps.cs

http://github.com/techtalk/SpecFlow · C# · 55 lines · 47 code · 8 blank · 0 comment · 0 complexity · 2c493627745a282306c59cbd41e63f3e MD5 · raw file

  1. using TechTalk.SpecFlow.Specs.Drivers;
  2. using TechTalk.SpecFlow.TestProjectGenerator.Driver;
  3. namespace TechTalk.SpecFlow.Specs.StepDefinitions
  4. {
  5. [Binding]
  6. public class ExecutionSteps
  7. {
  8. private readonly ExecutionDriver _executionDriver;
  9. private readonly CompilationDriver _compilationDriver;
  10. public ExecutionSteps(ExecutionDriver executionDriver, CompilationDriver compilationDriver)
  11. {
  12. _executionDriver = executionDriver;
  13. _compilationDriver = compilationDriver;
  14. }
  15. [When(@"I execute the tests")]
  16. public void WhenIExecuteTheTests()
  17. {
  18. _executionDriver.ExecuteTests();
  19. }
  20. [When(@"I execute the tests (once|twice|\d+ times)")]
  21. public void WhenIExecuteTheTestsTwice(uint times)
  22. {
  23. _executionDriver.ExecuteTestsTimes(times);
  24. }
  25. [When(@"I execute the tests tagged with '@(.+)'")]
  26. public void WhenIExecuteTheTestsTaggedWithTag(string tag)
  27. {
  28. _executionDriver.ExecuteTestsWithTag(tag);
  29. }
  30. [Given(@"'(dotnet msbuild|dotnet build|MSBuild)' is used for compiling")]
  31. public void GivenIsUsedForCompiling(BuildTool buildTool)
  32. {
  33. _compilationDriver.SetBuildTool(buildTool);
  34. }
  35. [When(@"I build the solution using '(dotnet msbuild|dotnet build|MSBuild)'")]
  36. [When(@"I compile the solution using '(dotnet msbuild|dotnet build|MSBuild)'")]
  37. public void WhenIBuildTheSolutionUsing(BuildTool buildTool)
  38. {
  39. _compilationDriver.CompileSolution(buildTool);
  40. }
  41. [When(@"the solution is built (once|twice|\d+ times)")]
  42. public void WhenTheSolutionIsBuiltTwice(uint times)
  43. {
  44. _compilationDriver.CompileSolutionTimes(times);
  45. }
  46. }
  47. }