Skip to content

Commit b473999

Browse files
authored
Merge pull request #84 from quantori/switch-logs-to-nunit
Removed custom made logs to use NUnit ones
2 parents 3c5adaa + 6c00dca commit b473999

File tree

7 files changed

+3
-90
lines changed

7 files changed

+3
-90
lines changed

Behavioral.Automation.DemoBindings/Bootstrapper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public void Bootstrap()
3333
Assert.SetRunner(_runner);
3434
_objectContainer.RegisterTypeAs<UserInterfaceBuilder, IUserInterfaceBuilder>();
3535
_servicesBuilder.Build();
36-
Assert.SetConsumer(_objectContainer.Resolve<IScenarioExecutionConsumer>());
3736
_browserRunner.OpenChrome();
3837
}
3938
}

src/Behavioral.Automation.UnitTests/AssertionBuilderTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ public void OneTimeSetup()
2222
Mock<ITestRunnerWrapper> wrapperMock = new Mock<ITestRunnerWrapper>();
2323
wrapperMock.Setup(w => w.StepInfoText).Returns("TEST");
2424

25-
Mock<IScenarioExecutionConsumer> consumerMock = new Mock<IScenarioExecutionConsumer>();
26-
consumerMock.Setup(c => c.Get()).Returns(new[] { "TEST STEP" });
27-
2825
BAssert.SetRunner(wrapperMock.Object);
29-
BAssert.SetConsumer(consumerMock.Object);
3026
}
3127

3228
[TestCase(0, false)]

src/Behavioral.Automation/Bindings/ExecutionObserverBinding.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/Behavioral.Automation/FluentAssertions/Assert.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Behavioral.Automation.FluentAssertions.Abstractions;
77
using Behavioral.Automation.Model;
88
using Behavioral.Automation.Services;
9+
using NUnit.Framework;
910
using OpenQA.Selenium;
1011
using TechTalk.SpecFlow;
1112

@@ -15,7 +16,6 @@ public static class Assert
1516
{
1617
private const int DefaultAttempts = 30;
1718
private static ITestRunnerWrapper _runner;
18-
private static IScenarioExecutionConsumer _consumer;
1919

2020
public static void SetRunner(ITestRunner runner)
2121
{
@@ -27,11 +27,6 @@ public static void SetRunner(ITestRunnerWrapper runner)
2727
_runner = runner;
2828
}
2929

30-
public static void SetConsumer(IScenarioExecutionConsumer consumer)
31-
{
32-
_consumer = consumer;
33-
}
34-
3530
public static T ShouldGet<T>(Func<T> predicate)
3631
{
3732
return TryGetValue(predicate, TimeSpan.FromMilliseconds(500));
@@ -93,7 +88,8 @@ public static void True(bool condition, string message)
9388
{
9489
if (!condition)
9590
{
96-
NUnit.Framework.Assert.Fail(BuildMessage(message));
91+
TestContext.WriteLine($"\nActual:\n{message}");
92+
NUnit.Framework.Assert.Fail();
9793
}
9894
}
9995

@@ -107,17 +103,6 @@ public static string BehaviorAppendix(this AssertionBehavior behavior)
107103
return string.Empty;
108104
}
109105

110-
private static string BuildMessage(string message)
111-
{
112-
IEnumerable<string> executedSteps = _consumer.Get();
113-
string aggregatedSteps = "";
114-
if (executedSteps.Any())
115-
{
116-
aggregatedSteps = _consumer.Get().Aggregate((x, y) => $"{x}\n{y}");
117-
}
118-
return $"{aggregatedSteps}\n\nExpected:\n{_runner.StepInfoText}\nActual:\n{message}";
119-
}
120-
121106
private static T TryGetValue<T>(Func<T> getValue, TimeSpan wait, int attempts = 10)
122107
{
123108
var counter = 0;

src/Behavioral.Automation/Services/IScenarioExecutionConsumer.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Behavioral.Automation/Services/ScenarioExecutionConsumer.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Behavioral.Automation/TestServicesBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public TestServicesBuilder(IObjectContainer objectContainer)
1616

1717
public void Build()
1818
{
19-
_objectContainer.RegisterTypeAs<ScenarioExecutionConsumer, IScenarioExecutionConsumer>();
2019
_objectContainer.RegisterTypeAs<DriverService, IDriverService>();
2120
_objectContainer.RegisterTypeAs<ElementSelectionService, IElementSelectionService>();
2221
_objectContainer.RegisterTypeAs<VirtualizedElementsSelectionService, IVirtualizedElementsSelectionService>();

0 commit comments

Comments
 (0)