public async Task AddTextAsync_Should_Rely_On_IpfsEngine_And_Return_Record_Id() { _ipfsEngine.FileSystem.AddTextAsync("good morning", Arg.Any <AddFileOptions>(), Arg.Any <CancellationToken>()) .Returns(c => Task.FromResult(_addedRecord)); var record = await _dfs.AddTextAsync("good morning"); record.Should().Be(_expectedCid); }
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); }