-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBridgeAbstractionsImplTests.cs
More file actions
49 lines (38 loc) · 1.39 KB
/
BridgeAbstractionsImplTests.cs
File metadata and controls
49 lines (38 loc) · 1.39 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
using GofPatterns.Structural.BridgePattern.Implementations;
using Moq;
using NUnit.Framework;
namespace GofPatternsTests.Structural.BridgePattern.Implementations;
[TestFixture]
[TestOf(typeof(BridgeAbstractionsImpl<>))]
internal class BridgeAbstractionsImplTests : BaseTest
{
private readonly IBridgeAbstractionsImpl<IBridgeImplementationImpl> sut =
new BridgeAbstractionsImpl<IBridgeImplementationImpl>();
[Test]
public void Add_AssignsImplementation()
{
// arrange
const int expectedCount = 2;
var impl1 = new TestBridgeImplementationImpl(MockConsoleLogger.Object);
var impl2 = new TestBridgeImplementationImpl(MockConsoleLogger.Object);
// act
sut.Add(impl1, impl2);
// assert
Assert.That(sut.ImplementationCount, Is.EqualTo(expectedCount));
}
[Test]
public void Execute_RunsImplementation()
{
// arrange
const int expectedCount = 3;
var impl1 = new TestBridgeImplementationImpl(MockConsoleLogger.Object);
var impl2 = new TestBridgeImplementationImpl(MockConsoleLogger.Object);
sut.Add(impl1, impl2);
var impl3 = new TestBridgeImplementationImpl(MockConsoleLogger.Object);
sut.Add(impl3);
// act
sut.Execute();
// assert
MockConsoleLogger.Verify(x => x.Log(It.IsAny<string>()), Times.Exactly(expectedCount));
}
}