cs-codex-dist-tests/Tests/CodexDistTest.cs

57 lines
1.4 KiB
C#
Raw Normal View History

2023-09-13 12:24:43 +00:00
using CodexPlugin;
using DistTestCore;
using DistTestCore.Helpers;
namespace Tests
{
public class CodexDistTest : DistTest
{
2023-09-19 09:51:59 +00:00
private readonly List<ICodexNode> onlineCodexNodes = new List<ICodexNode>();
2023-09-13 12:24:43 +00:00
2023-09-19 09:51:59 +00:00
public ICodexNode AddCodex()
2023-09-13 12:24:43 +00:00
{
return AddCodex(s => { });
}
2023-09-19 09:51:59 +00:00
public ICodexNode AddCodex(Action<ICodexSetup> setup)
2023-09-13 12:24:43 +00:00
{
return AddCodex(1, setup)[0];
}
public ICodexNodeGroup AddCodex(int numberOfNodes)
{
return AddCodex(numberOfNodes, s => { });
}
public ICodexNodeGroup AddCodex(int numberOfNodes, Action<ICodexSetup> setup)
{
var group = Ci.SetupCodexNodes(numberOfNodes, s =>
{
setup(s);
OnCodexSetup(s);
});
onlineCodexNodes.AddRange(group);
return group;
}
public PeerConnectionTestHelpers CreatePeerConnectionTestHelpers()
{
return new PeerConnectionTestHelpers(GetTestLog());
}
public PeerDownloadTestHelpers CreatePeerDownloadTestHelpers()
{
return new PeerDownloadTestHelpers(GetTestLog(), Get().GetFileManager());
}
2023-09-19 09:51:59 +00:00
public IEnumerable<ICodexNode> GetAllOnlineCodexNodes()
2023-09-13 12:24:43 +00:00
{
return onlineCodexNodes;
}
protected virtual void OnCodexSetup(ICodexSetup setup)
{
}
}
}