public void DoesResourceTypeExist_EmptryResourceType_ReturnsFalse() { // Arrange var resourceType = ""; // Act var result = EnumUtil.DoesResourceTypeExist(resourceType); // Assert Assert.False(result); }
public void DoesResourceTypeExist_ProjectResourceType_ReturnsTrue() { // Arrange var resourceType = ResourceTypeEnum.Project; // Act var result = EnumUtil.DoesResourceTypeExist(resourceType); // Assert Assert.True(result); }
public async Task <IActionResult> CreateMarkSession( string resourceType, string resourceId, [FromQuery(Name = "markSessionType")] string markSessionType, [FromQuery(Name = "projectId")] string projectId ) { if (string.IsNullOrEmpty(resourceId)) { return(BadRequest("resourceId is not specified!")); } if (!EnumUtil.DoesMarkSessionTypeExist(markSessionType)) { return(BadRequest("markSessionType is not specified or the type is invalid!")); } if (string.IsNullOrEmpty(projectId)) { if (resourceType == ResourceTypeEnum.Project) { projectId = resourceId; } else { return(BadRequest("projectId is not specified!")); } } if (!EnumUtil.DoesResourceTypeExist(resourceType)) { return(BadRequest("resourceType is not specified or the type is invalid!")); } var createdMarkSessionModel = await _markSessionHandler.CreateMarkSession( resourceId, projectId, resourceType, markSessionType ); return(Ok( _mapper.Map <MarkSessionForReturnDto>(createdMarkSessionModel) )); }
public async Task<IActionResult> DeleteResources( string resourceType, string resourceId, [FromQuery(Name = "projectId")] string projectId ) { if (string.IsNullOrEmpty(resourceType)) { return BadRequest("resourceType is not specified!"); } if (string.IsNullOrEmpty(resourceId)) { return BadRequest("resourceId is not specified!"); } if (string.IsNullOrEmpty(projectId)) { if (resourceType == ResourceTypeEnum.Project) { projectId = resourceId; } else { return BadRequest("projectId is not specified!"); } } if (!EnumUtil.DoesResourceTypeExist(resourceType)) { return BadRequest("resourceType is not specified or is invalid!"); } var backgroundJobId = await _deleteControllerHandler.CreateMarkSessionAndDeleteDependantResurces( resourceType, resourceId, projectId ); return Accepted( value: backgroundJobId ); }