public async Task <Reply> DeleteByPkgHash(R2Package package, CancellationToken cancelTkn) { var list = await ListByPkgHash(package, cancelTkn); foreach (var item in list) { var reply = await _client.DeleteNode(item.nid, cancelTkn); if (reply.Failed) { return(reply); } } return(Reply.Success()); }
public async void CanPostDeletePackagePart() { (await _sut.EnableWriteAccess(_creds)).Should().BeTrue(); var sampl = SamplePkgPart(); var fNme = sampl.PackageFilename; var hash = sampl.PackageHash; var list = await _parts.ListByPkgHash(fNme, hash, new CancellationToken()); list.Should().HaveCount(0); var reply = await _sut.PostNode(sampl, new CancellationToken()); reply.Should().NotBeNull(); reply.IsSuccessful.Should().BeTrue(); reply.Nid.Should().BeGreaterThan(1); list = await _parts.ListByPkgHash(fNme, hash, new CancellationToken()); list.Should().HaveCount(1); var delRep = await _sut.DeleteNode(reply.Nid, new CancellationToken()); delRep.IsSuccessful.Should().BeTrue(); list = await _parts.ListByPkgHash(fNme, hash, new CancellationToken()); list.Should().HaveCount(0); }