forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptHostTests.cs
More file actions
52 lines (41 loc) · 1.85 KB
/
ScriptHostTests.cs
File metadata and controls
52 lines (41 loc) · 1.85 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
using Moq;
using ScriptCs.Contracts;
using Should;
using Xunit;
namespace ScriptCs.Tests
{
public class ScriptHostTests
{
public class TheGetMethod
{
private readonly Mock<IScriptPackContext> _mockContext = new Mock<IScriptPackContext>();
private readonly Mock<IScriptPackManager> _mockScriptPackManager = new Mock<IScriptPackManager>();
private readonly Mock<IConsole> _mockConsole = new Mock<IConsole>();
private readonly Mock<IObjectSerializer> _mockSerializer = new Mock<IObjectSerializer>();
private readonly ScriptHost _scriptHost;
public TheGetMethod()
{
_scriptHost = new ScriptHost(_mockScriptPackManager.Object, new ScriptEnvironment(new string[0], _mockConsole.Object, new Printers(_mockSerializer.Object)));
_mockScriptPackManager.Setup(s => s.Get<IScriptPackContext>()).Returns(_mockContext.Object);
}
[Fact]
public void ShoulGetScriptPackFromScriptPackManagerWhenInvoked()
{
_scriptHost.Require<IScriptPackContext>();
_mockScriptPackManager.Verify(s => s.Get<IScriptPackContext>());
}
}
public class TheConstructor
{
private readonly Mock<IConsole> _mockConsole = new Mock<IConsole>();
private readonly Mock<IObjectSerializer> _mockSerializer = new Mock<IObjectSerializer>();
[Fact]
public void ShouldSetScriptEnvironment()
{
var environment = new ScriptEnvironment(new string[0], _mockConsole.Object, new Printers(_mockSerializer.Object));
var scriptHost = new ScriptHost(new Mock<IScriptPackManager>().Object, environment);
scriptHost.Env.ShouldEqual(environment);
}
}
}
}