示例#1
0
        public void NodeService_CanRetrieveNodeId()
        {
            var nodeId = 1;
            var nodeService = new NodeService(nodeId);

            Assert.AreEqual(nodeService.NodeId, nodeId);
        }
示例#2
0
        public void NodeService_CanBePinged()
        {
            var nodeId = 1;
            var nodeService = new NodeService(nodeId);

            nodeService.Ping();
        }
示例#3
0
        /// <summary>
        /// Creates a DHT node service
        /// </summary>
        /// <param name="nodeId">The id of the node</param>
        /// <param name="endpoint">The endpoint to run on</param>
        /// <returns></returns>
        public static INodeService CreateNodeService(int nodeId, Uri endpoint)
        {
            // TODO Should ping the endpoint and check there is no node existing on that endpoint
            var nodeInstance = new NodeService(nodeId);
            var host = new WebServiceHost(nodeInstance, endpoint);
            host.Open();

            return nodeInstance;
        }
示例#4
0
        public void NodeService_CanCreate()
        {
            var nodeService = new NodeService(1);

            Assert.IsNotNull(nodeService);
        }