/Source/Reporting/Machine.Specifications.Reporting.Specs/Visitors/FailedSpecificationLinkerSpecs.cs
C# | 73 lines | 58 code | 15 blank | 0 comment | 0 complexity | c18055472e099f493bd2ae09d55bd9bd MD5 | raw file
Possible License(s): MIT, CC-BY-SA-3.0
- using System;
-
- using FluentAssertions;
-
- using Machine.Specifications.Reporting.Model;
- using Machine.Specifications.Reporting.Visitors;
-
- namespace Machine.Specifications.Reporting.Specs.Visitors
- {
- [Subject(typeof(FailedSpecificationLinker))]
- public class when_failed_specifications_are_linked : ReportSpecs
- {
- static FailedSpecificationLinker Linker;
- static Run Report;
- static Specification Specification;
- static Specification First;
- static Specification Second;
- static Specification Last;
-
- Establish context = () =>
- {
- Linker = new FailedSpecificationLinker();
-
- First = Spec("it", "a 1 c 1 c 1 specification 1", Result.Failure(new Exception()));
- Second = Spec("it", "a 2 c 1 c 1 specification 1", Result.Failure(new Exception()));
- Last = Spec("it", "a 2 c 1 c 2 specification 1", Result.Failure(new Exception()));
-
- Report = Run(Assembly("assembly 1",
- Concern("a 1 concern 1",
- Context("a 1 c 1 context 1",
- First,
- Spec("it", "a 1 c 1 c 1 specification 2", Result.Pass())
- )
- )
- ),
- Assembly("assembly 2",
- Concern("a 2 concern 1",
- Context("a 2 c 1 context 1",
- Spec("it", "a 2 c 1 c 1 specification 2", Result.Pass()),
- Second),
- Context("a 2 c 1 context 2",
- Last,
- Spec("it", "a 2 c 1 c 2 specification 2", Result.Pass()))))
- );
- };
-
- Because of = () => Linker.Visit(Report);
-
- It should_not_assign_a__previous__link_to_the_report =
- () => Report.PreviousFailed.Should().BeNull();
-
- It should_assign_a__next__link_to_the_report =
- () => Report.NextFailed.Should().Be(First);
-
- It should_assign_a__next__link_to_the_first_failed_spec =
- () => First.NextFailed.Should().Be(Second);
-
- It should_not_assign_a__previous__link_to_the_first_failed_spec =
- () => First.PreviousFailed.Should().BeNull();
-
- It should_assign_a__next__link_to_the_second_failed_spec =
- () => Second.NextFailed.Should().Be(Last);
-
- It should_assign_a__previous__link_to_the_second_failed_spec =
- () => Second.PreviousFailed.Should().Be(First);
-
- It should_not_assign_a__next__link_to_the_last_failed_spec =
- () => Last.NextFailed.Should().BeNull();
-
- It should_assign_a__previous__link_to_the_last_failed_spec =
- () => Last.PreviousFailed.Should().Be(Second);
- }
- }