-
Notifications
You must be signed in to change notification settings - Fork 46
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
c8713c2
commit 34d534d
Showing
7 changed files
with
73 additions
and
34 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
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
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
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,49 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.IO; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace Ipfs.Engine | ||
{ | ||
[TestClass] | ||
public class RandomWalkTest | ||
{ | ||
[TestMethod] | ||
public async Task CanStartAndStop() | ||
{ | ||
var walk = new RandomWalk(); | ||
await walk.StartAsync(); | ||
await walk.StopAsync(); | ||
|
||
await walk.StartAsync(); | ||
await walk.StopAsync(); | ||
} | ||
|
||
[TestMethod] | ||
public void CannotStartTwice() | ||
{ | ||
var walk = new RandomWalk(); | ||
walk.StartAsync().Wait(); | ||
ExceptionAssert.Throws<Exception>(() => | ||
{ | ||
walk.StartAsync().Wait(); | ||
}); | ||
} | ||
|
||
[TestMethod] | ||
public async Task CanStopMultipletimes() | ||
{ | ||
var walk = new RandomWalk(); | ||
await walk.StartAsync(); | ||
await walk.StopAsync(); | ||
await walk.StopAsync(); | ||
await walk.StartAsync(); | ||
await walk.StopAsync(); | ||
} | ||
} | ||
} |