File tree Expand file tree Collapse file tree 2 files changed +32
-11
lines changed Expand file tree Collapse file tree 2 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,28 @@ namespace Ipfs.Api
11
11
[ TestClass ]
12
12
public class DhtApiTest
13
13
{
14
- const string marsId = "QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3" ;
15
- const string marsPublicKey = "CAASogEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKGUtbRQf+a9SBHFEruNAUatS/tsGUnHuCtifGrlbYPELD3UyyhWf/FYczBCavx3i8hIPEW2jQv4ehxQxi/cg9SHswZCQblSi0ucwTBFr8d40JEiyB9CcapiMdFQxdMgGvXEOQdLz1pz+UPUDojkdKZq8qkkeiBn7KlAoGEocnmpAgMBAAE=" ;
16
14
const string helloWorldID = "QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o" ;
17
15
18
16
[ TestMethod ]
19
17
public async Task FindPeer ( )
20
18
{
21
19
var ipfs = TestFixture . Ipfs ;
22
- var peer = await ipfs . Dht . FindPeerAsync ( marsId ) ;
20
+ Peer node ;
21
+ foreach ( var peer in await ipfs . Bootstrap . ListAsync ( ) )
22
+ {
23
+ try
24
+ {
25
+ node = await ipfs . Dht . FindPeerAsync ( peer . PeerId ) ;
26
+ }
27
+ catch ( Exception )
28
+ {
29
+ continue ;
30
+ }
23
31
24
- // If DHT can't find a peer, it will return a 'closer' peer.
25
- Assert . IsNotNull ( peer ) ;
32
+ // If DHT can't find a peer, it will return a 'closer' peer.
33
+ Assert . IsNotNull ( peer ) ;
34
+ break ;
35
+ }
26
36
}
27
37
28
38
[ TestMethod ]
Original file line number Diff line number Diff line change 2
2
using Newtonsoft . Json . Linq ;
3
3
using System ;
4
4
using System . Text ;
5
-
5
+ using System . Threading . Tasks ;
6
+
6
7
namespace Ipfs . Api
7
8
{
8
9
[ TestClass ]
9
10
public class GenericApiTest
10
11
{
11
- const string marsId = "QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3" ;
12
-
13
12
[ TestMethod ]
14
13
public void Local_Node_Info ( )
15
14
{
@@ -19,11 +18,23 @@ public void Local_Node_Info()
19
18
}
20
19
21
20
[ TestMethod ]
22
- public void Mars_Node_Info ( )
21
+ public async Task Peer_Node_Info ( )
23
22
{
24
23
var ipfs = TestFixture . Ipfs ;
25
- var node = ipfs . IdAsync ( marsId ) . Result ;
26
- Assert . IsInstanceOfType ( node , typeof ( Peer ) ) ;
24
+ Peer node ;
25
+ foreach ( var peer in await ipfs . Bootstrap . ListAsync ( ) )
26
+ {
27
+ try
28
+ {
29
+ node = await ipfs . IdAsync ( peer . PeerId ) ;
30
+ }
31
+ catch ( Exception )
32
+ {
33
+ continue ;
34
+ }
35
+ Assert . IsInstanceOfType ( node , typeof ( Peer ) ) ;
36
+ break ;
37
+ }
27
38
}
28
39
29
40
[ TestMethod ]
You can’t perform that action at this time.
0 commit comments