Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e6a465
commit a0c1dfc
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
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); | ||
} | ||
} | ||
} |