public void ShouldRemoveShare() { // Arrange this.shareTableRepository = Substitute.For <IShareTableRepository>(); this.shareTableRepository.ContainsById(Arg.Is(55)).Returns(true); SharesService sharesService = new SharesService(this.shareTableRepository); // Act sharesService.RemoveShare(55); // Assert this.shareTableRepository.Received(1).Deactivate(55); this.shareTableRepository.Received(1).SaveChanges(); }
public async Task <ActionResult <string> > Remove([FromBody] ShareToRemove share) { bool isDeleted = false; if (share != null) { isDeleted = sharesService.RemoveShare(share.ShareId); } if (isDeleted == false) { return(new ActionResult <string>("Record not found")); } return(new ActionResult <string>("Record deleted")); }