public async Task ReadTextAsync_Should_Rely_On_IpfsEngine_And_Return_Text_Content() { var cid = CidHelper.CreateCid(_hashProvider.ComputeUtf8MultiHash("file")); _ipfsEngine.FileSystem .ReadAllTextAsync(cid.Encode(), Arg.Any <CancellationToken>()) .Returns(c => "the other content"); var text = await _dfs.ReadTextAsync(cid.Encode()); text.Should().Be("the other content"); }
public async Task DFS_should_add_and_read_text() { var cts = new CancellationTokenSource(TimeSpan.FromSeconds(15)); const string text = "good morning"; var dfs = new Dfs(_ipfs, _hashProvider, _logger); var id = await dfs.AddTextAsync(text, cts.Token); var content = await dfs.ReadTextAsync(id, cts.Token); content.Should().Be(text); }