Skip to content

Commit 5d1340e

Browse files
committed
SemanticCardProcessorLoggerDecoratorTests added
1 parent de2537e commit 5d1340e

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

CodeCoverage.runsettings

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<Exclude>
2626
<Function>.*get_.*</Function>
2727
<Function>.*set_.*</Function>
28+
<Function>.*Logger*</Function>
2829
</Exclude>
2930
</Functions>
3031

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using NSubstitute;
2+
using NUnit.Framework;
3+
using System.Threading.Tasks;
4+
using ygo_scheduled_tasks.core.Model;
5+
using ygo_scheduled_tasks.domain.ETL.SemanticSearch.Processor;
6+
using ygo_scheduled_tasks.domain.ETL.SemanticSearch.Processor.Decorator;
7+
using ygo_scheduled_tasks.domain.ETL.SemanticSearch.Processor.Model;
8+
9+
namespace ygo_scheduled_tasks.domain.integration.tests.ETLTests.SemanticSearchTests.ProcessorTests.DecoratorTest
10+
{
11+
[TestFixture]
12+
public class SemanticCardProcessorLoggerDecoratorTests
13+
{
14+
private SemanticCardProcessorLoggerDecorator _sut;
15+
private ISemanticCardProcessor _semanticCardProcessor;
16+
17+
[SetUp]
18+
public void Setup()
19+
{
20+
_semanticCardProcessor = Substitute.For<ISemanticCardProcessor>();
21+
22+
_sut = new SemanticCardProcessorLoggerDecorator(_semanticCardProcessor);
23+
}
24+
25+
[Test]
26+
public async Task Given_A_Category_And_A_SemanticCard_Should_Execute_Process()
27+
{
28+
// Arrange
29+
var category = "Flip";
30+
var semanticCard = new SemanticCard {Name = "Red-Eyes Black Dragon"};
31+
_semanticCardProcessor.Process(Arg.Any<string>(), Arg.Any<SemanticCard>()).Returns(new SemanticSearchTaskResult());
32+
33+
// Act
34+
await _sut.Process(category, semanticCard);
35+
36+
// Assert
37+
await _semanticCardProcessor.Received(1).Process(Arg.Any<string>(), Arg.Any<SemanticCard>());
38+
}
39+
}
40+
}

tests/integration/ygo-scheduled-tasks.domain.integration.tests/ygo-scheduled-tasks.domain.integration.tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
</Reference>
173173
</ItemGroup>
174174
<ItemGroup>
175+
<Compile Include="ETLTests\SemanticSearchTests\ProcessorTests\DecoratorTest\SemanticCardProcessorLoggerDecoratorTests.cs" />
175176
<Compile Include="ETLTests\SemanticSearchTests\ProcessorTests\ProcessTests\SemanticSearchFlipMonstersProcessorTests.cs" />
176177
<Compile Include="ETLTests\SemanticSearchTests\ProcessorTests\ProcessTests\SemanticSearchNormalMonstersProcessorTests.cs" />
177178
<Compile Include="Properties\AssemblyInfo.cs" />

0 commit comments

Comments
 (0)