-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathProcessorPipelineTests.cs
More file actions
74 lines (64 loc) · 2.81 KB
/
ProcessorPipelineTests.cs
File metadata and controls
74 lines (64 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System.Linq;
using Shouldly;
using TestStack.BDDfy.Configuration;
using TestStack.BDDfy.Processors;
using TestStack.BDDfy.Reporters;
using TestStack.BDDfy.Tests.Concurrency;
using Xunit;
namespace TestStack.BDDfy.Tests.Configuration
{
[Collection(TestCollectionName.ModifiesConfigurator)]
public class ProcessorPipelineTests
{
[Fact]
public void ReturnsDefaultPipelineByDefault()
{
var processors = Configurator.Processors.GetProcessors(new Story(null)).ToList();
processors.Any(p => p is ConsoleReporter).ShouldBe(true);
processors.Any(p => p is StoryCache).ShouldBe(true);
processors.Any(p => p is TestRunner).ShouldBe(true);
processors.Any(p => p is ExceptionProcessor).ShouldBe(true);
}
[Fact]
public void DoesNotReturnConsoleReportWhenItIsDeactivated()
{
Configurator.Processors.ConsoleReport.Disable();
var processors = Configurator.Processors.GetProcessors(new Story(null)).ToList();
processors.Any(p => p is ConsoleReporter).ShouldBe(false);
processors.Any(p => p is StoryCache).ShouldBe(true);
processors.Any(p => p is TestRunner).ShouldBe(true);
processors.Any(p => p is ExceptionProcessor).ShouldBe(true);
Configurator.Processors.ConsoleReport.Enable();
}
[Fact]
public void DoesNotReturnConsoleReportForExcludedStories()
{
Configurator.Processors.ConsoleReport.RunsOn(s => s.Metadata != null);
var processors = Configurator.Processors.GetProcessors(new Story(null)).ToList();
processors.Any(p => p is ConsoleReporter).ShouldBe(false);
Configurator.Processors.ConsoleReport.RunsOn(s => true);
}
[Fact]
public void DoesNotReturnTestRunnerWhenItIsDeactivated()
{
Configurator.Processors.TestRunner.Disable();
var processors = Configurator.Processors.GetProcessors(new Story(null)).ToList();
processors.Any(p => p is ConsoleReporter).ShouldBe(true);
processors.Any(p => p is TestRunner).ShouldBe(false);
processors.Any(p => p is StoryCache).ShouldBe(true);
processors.Any(p => p is ExceptionProcessor).ShouldBe(true);
Configurator.Processors.TestRunner.Enable();
}
[Fact]
public void CanAddCustomProcessor()
{
var processors = Configurator
.Processors
.Add(() => new CustomProcessor())
.GetProcessors(new Story(null)).ToList();
processors.Any(p => p is CustomProcessor).ShouldBe(true);
processors.Any(p => p is StoryCache).ShouldBe(true);
processors.Any(p => p is ConsoleReporter).ShouldBe(true);
}
}
}