-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathScopeTests.cs
More file actions
56 lines (52 loc) · 1.76 KB
/
ScopeTests.cs
File metadata and controls
56 lines (52 loc) · 1.76 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
using Xunit;
using Platform.Scopes;
using Platform.Memory;
using Platform.Data.Doublets.Decorators;
using Platform.Reflection;
using Platform.Data.Doublets.Memory.United.Generic;
using TLinkAddress = System.UInt64;
namespace Platform.Data.Doublets.Tests
{
public static class ScopeTests
{
[Fact]
public static void SingleDependencyTest()
{
using (var scope = new Scope())
{
scope.IncludeAssemblyOf<IMemory>();
var instance = scope.Use<IDirectMemory>();
Assert.IsType<HeapResizableDirectMemory>(instance);
}
}
[Fact]
public static void CascadeDependencyTest()
{
using (var scope = new Scope())
{
scope.Include<TemporaryFileMappedResizableDirectMemory>();
scope.Include<UnitedMemoryLinks<TLinkAddress>>();
var instance = scope.Use<ILinks<TLinkAddress>>();
Assert.IsType<UnitedMemoryLinks<TLinkAddress>>(instance);
}
}
[Fact(Skip = "Would be fixed later.")]
public static void FullAutoResolutionTest()
{
using (var scope = new Scope(autoInclude: true, autoExplore: true))
{
var instance = scope.Use<CombinedDecorator<TLinkAddress>>();
Assert.IsType<TLinkAddress>(instance);
}
}
[Fact]
public static void TypeParametersTest()
{
using (var scope = new Scope<Types<HeapResizableDirectMemory, UnitedMemoryLinks<TLinkAddress>>>())
{
var links = scope.Use<ILinks<TLinkAddress>>();
Assert.IsType<UnitedMemoryLinks<TLinkAddress>>(links);
}
}
}
}