public async Task Delete_UserIdIsNotSet_SetsCorrectResourceAndMethod() { var sut = new KeyRepository(_requestFactory); await sut.Delete(0); _requestFactory.Received().Create("user/keys/{id}", Method.Delete); }
public async Task Delete_UserIdIsSet_AddsUserIdUrlSegment() { const uint expected = 0; var sut = new KeyRepository(_requestFactory); await sut.Delete(0, expected); _request.Received().AddUrlSegmentIfNotNull("userId", expected); }
public async Task Delete_ValidParameters_AddsIdUrlSegment() { const uint expected = 0; var sut = new KeyRepository(_requestFactory); await sut.Delete(expected); _request.Received().AddUrlSegment("id", expected); }
public async Task DeleteKeyFromFileRepositoryTest() { this.Initialize(); var keyRepository = new KeyRepository(VaultName); var isInserted = await keyRepository.Add(KeyWithIdentifier); Assert.IsTrue(isInserted); Assert.IsTrue(keyRepository.GetAll().Result.Count() == 1); var newKeyRepository = new KeyRepository(VaultName); Assert.IsTrue(newKeyRepository.GetAll().Result.Count() == 1); var isDeleted = await newKeyRepository.Delete(newKeyRepository.GetAll().Result.First()); Assert.IsTrue(isDeleted); Assert.IsTrue(!newKeyRepository.GetAll().Result.Any()); newKeyRepository = new KeyRepository(VaultName); Assert.IsTrue(!newKeyRepository.GetAll().Result.Any()); }