forked from sarbian/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProtoUrlConfigTest.cs
More file actions
87 lines (70 loc) · 2.5 KB
/
Copy pathProtoUrlConfigTest.cs
File metadata and controls
87 lines (70 loc) · 2.5 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using Xunit;
using TestUtils;
using ModuleManager;
namespace ModuleManagerTests
{
public class ProtoUrlConfigTest
{
[Fact]
public void TestContructor__UrlFileNull()
{
ArgumentNullException ex = Assert.Throws<ArgumentNullException>(delegate
{
new ProtoUrlConfig(null, new ConfigNode());
});
Assert.Equal("urlFile", ex.ParamName);
}
[Fact]
public void TestContructor__NodeNull()
{
ArgumentNullException ex = Assert.Throws<ArgumentNullException>(delegate
{
new ProtoUrlConfig(UrlBuilder.CreateFile("foo/bar"), null);
});
Assert.Equal("node", ex.ParamName);
}
[Fact]
public void TestUrlFile()
{
UrlDir.UrlFile urlFile = UrlBuilder.CreateFile("abc/def.cfg");
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(urlFile, new ConfigNode());
Assert.Same(urlFile, protoUrlConfig.UrlFile);
}
[Fact]
public void TestNode()
{
ConfigNode node = new ConfigNode("NODE");
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("foo/bar"), node);
Assert.Same(node, protoUrlConfig.Node);
}
[Fact]
public void TestFileUrl()
{
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("abc/def.cfg"), new ConfigNode());
Assert.Equal("abc/def.cfg", protoUrlConfig.FileUrl);
}
[Fact]
public void TestNodeType()
{
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("abc/def"), new ConfigNode("SOME_NODE"));
Assert.Equal("SOME_NODE", protoUrlConfig.NodeType);
}
[Fact]
public void TestFullUrl()
{
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("abc/def.cfg"), new ConfigNode("SOME_NODE"));
Assert.Equal("abc/def.cfg/SOME_NODE", protoUrlConfig.FullUrl);
}
[Fact]
public void TestFullUrl__NameValue()
{
ConfigNode node = new TestConfigNode("SOME_NODE")
{
{ "name", "some_value" },
};
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("abc/def.cfg"), node);
Assert.Equal("abc/def.cfg/SOME_NODE[some_value]", protoUrlConfig.FullUrl);
}
}
}