public async Task DeleteDAppOfferById() { //Arrange var product1 = new DAppOffer { Id = Guid.NewGuid(), Title = "Title1", Description = "Description1" }; var product2 = new DAppOffer { Id = Guid.NewGuid(), Title = "Title2", Description = "Description2" }; await _dAppRepository.CreateDAppOffer(product1); await _dAppRepository.CreateDAppOffer(product2); //Act await _dAppRepository.DeleteDAppOffer(product1.Id); var result = await _dAppRepository.GetDAppOffer(product1.Id); var resultAll = await _dAppRepository.GetAllDAppOffers(); //Assert Assert.Null(result); Assert.NotNull(resultAll); Assert.NotEmpty(resultAll); Assert.Single(resultAll); }
public async Task DeleteDAppOffer(Guid id, string jwt) { var offer = await _dAppRepository.GetDAppOffer(id); if (offer.Provider.Id != _jwtIdClaimReaderHelper.getUserIdFromToken(jwt)) //authorization { throw new NotAuthenticatedException(); } await _dAppRepository.DeleteDAppOffer(id); }