public void DoesMarkSessionTypeExist_InvalidMarkSessionType_ReturnsFalse() { // Arrange var markSessionType = "invalid"; // Act var result = EnumUtil.DoesMarkSessionTypeExist(markSessionType); // Assert Assert.False(result); }
public void DoesMarkSessionTypeExist_ToBeDeletedMarkSessionType_ReturnsTrue() { // Arrange var markSessionType = MarkSessionTypeEnum.ToBeDeleted; // Act var result = EnumUtil.DoesMarkSessionTypeExist(markSessionType); // Assert Assert.True(result); }
public async Task <IActionResult> GetMarkSessionsByMarkSessionType( [FromQuery(Name = "markSessionType")] string markSessionType ) { if (!EnumUtil.DoesMarkSessionTypeExist(markSessionType)) { return(BadRequest("markSessionType is not specified or the type is invalid!")); } var markSessionModels = await _markSessionHandler.GetMarkSessionsByMarkSessionType(markSessionType); return(Ok( _mapper.Map <List <MarkSessionForReturnDto> >(markSessionModels) )); }
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> UpdateMarkSessionType( string markSessionId, [FromQuery(Name = "markSessionType")] string markSessionType ) { if (string.IsNullOrEmpty(markSessionId)) { return(BadRequest("markSessionId is not specified!")); } if (!EnumUtil.DoesMarkSessionTypeExist(markSessionType)) { return(BadRequest("markSessionType is not specified or the type is invalid!")); } await _markSessionHandler.UpdateMarkSessionType(markSessionId, markSessionType); return(Ok()); }