public async Task PublishArtifacts_ItemNotExists_ThrowsResourceNotFoundException() { _versionControlRepository.Setup( a => a.GetDiscardPublishStates(It.IsAny <int>(), It.IsAny <IEnumerable <int> >(), It.IsAny <IDbTransaction>())) .ReturnsAsync(new List <SqlDiscardPublishState> { new SqlDiscardPublishState { NotExist = true } }); var versionControlService = new VersionControlService( _versionControlRepository.Object, _publishRepository.Object, _revisionRepository.Object, _sqlHelper.Object); var publishParameters = new PublishParameters { ArtifactIds = new List <int>() { 1 } }; await versionControlService.PublishArtifacts(publishParameters); }
public async Task PublishArtifacts_EmptyListIds_ThrowsBadRequestException() { var versionControlService = new VersionControlService( _versionControlRepository.Object, _publishRepository.Object, _revisionRepository.Object, _sqlHelper.Object); var publishParameters = new PublishParameters { ArtifactIds = new List <int>() }; await versionControlService.PublishArtifacts(publishParameters); }
public async Task PublishArtifacts_ItemCountMismatch_ThrowsBadRequestException() { _versionControlRepository.Setup( a => a.GetDiscardPublishStates(It.IsAny <int>(), It.IsAny <IEnumerable <int> >(), It.IsAny <IDbTransaction>())) .ReturnsAsync(new List <SqlDiscardPublishState> { new SqlDiscardPublishState() }); var versionControlService = new VersionControlService( _versionControlRepository.Object, _publishRepository.Object, _revisionRepository.Object, _sqlHelper.Object); var publishParameters = new PublishParameters { ArtifactIds = new List <int>() { 1, 2, 3 } }; await versionControlService.PublishArtifacts(publishParameters); }