PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Reporting/Machine.Specifications.Reporting.Specs/Visitors/FailedSpecificationLinkerSpecs.cs

https://github.com/machine/machine.specifications
C# | 73 lines | 58 code | 15 blank | 0 comment | 0 complexity | c18055472e099f493bd2ae09d55bd9bd MD5 | raw file
Possible License(s): MIT, CC-BY-SA-3.0
  1. using System;
  2. using FluentAssertions;
  3. using Machine.Specifications.Reporting.Model;
  4. using Machine.Specifications.Reporting.Visitors;
  5. namespace Machine.Specifications.Reporting.Specs.Visitors
  6. {
  7. [Subject(typeof(FailedSpecificationLinker))]
  8. public class when_failed_specifications_are_linked : ReportSpecs
  9. {
  10. static FailedSpecificationLinker Linker;
  11. static Run Report;
  12. static Specification Specification;
  13. static Specification First;
  14. static Specification Second;
  15. static Specification Last;
  16. Establish context = () =>
  17. {
  18. Linker = new FailedSpecificationLinker();
  19. First = Spec("it", "a 1 c 1 c 1 specification 1", Result.Failure(new Exception()));
  20. Second = Spec("it", "a 2 c 1 c 1 specification 1", Result.Failure(new Exception()));
  21. Last = Spec("it", "a 2 c 1 c 2 specification 1", Result.Failure(new Exception()));
  22. Report = Run(Assembly("assembly 1",
  23. Concern("a 1 concern 1",
  24. Context("a 1 c 1 context 1",
  25. First,
  26. Spec("it", "a 1 c 1 c 1 specification 2", Result.Pass())
  27. )
  28. )
  29. ),
  30. Assembly("assembly 2",
  31. Concern("a 2 concern 1",
  32. Context("a 2 c 1 context 1",
  33. Spec("it", "a 2 c 1 c 1 specification 2", Result.Pass()),
  34. Second),
  35. Context("a 2 c 1 context 2",
  36. Last,
  37. Spec("it", "a 2 c 1 c 2 specification 2", Result.Pass()))))
  38. );
  39. };
  40. Because of = () => Linker.Visit(Report);
  41. It should_not_assign_a__previous__link_to_the_report =
  42. () => Report.PreviousFailed.Should().BeNull();
  43. It should_assign_a__next__link_to_the_report =
  44. () => Report.NextFailed.Should().Be(First);
  45. It should_assign_a__next__link_to_the_first_failed_spec =
  46. () => First.NextFailed.Should().Be(Second);
  47. It should_not_assign_a__previous__link_to_the_first_failed_spec =
  48. () => First.PreviousFailed.Should().BeNull();
  49. It should_assign_a__next__link_to_the_second_failed_spec =
  50. () => Second.NextFailed.Should().Be(Last);
  51. It should_assign_a__previous__link_to_the_second_failed_spec =
  52. () => Second.PreviousFailed.Should().Be(First);
  53. It should_not_assign_a__next__link_to_the_last_failed_spec =
  54. () => Last.NextFailed.Should().BeNull();
  55. It should_assign_a__previous__link_to_the_last_failed_spec =
  56. () => Last.PreviousFailed.Should().Be(Second);
  57. }
  58. }