public void ReportRequest_Grid_Success() { var reportParameters = LoadMandatoryReportParameters(); var reportRequest = new ReportRequest(ReportType.Grid, "Grid Report", reportParameters); reportRequest.Validate(); }
public void ReportRequest_Summary_Success() { var reportParameters = LoadMandatoryReportParameters(); var reportRequest = new ReportRequest(ReportType.Summary, "3D Summary Report", reportParameters); reportRequest.Validate(); }
public IActionResult GetGridReport([FromBody] ReportRequest reportRequest) { reportRequest.ReportTypeEnum = ReportType.Grid; Log.LogInformation($"{nameof(GetGridReport)} request: {reportRequest}"); reportRequest.Validate(); return(StatusCode((int)HttpStatusCode.InternalServerError, $"{nameof(GetGridReport)} not supported yet")); }
public void ReportRequest_ValidationFailure(string reportType, string reportTitle, int errorCode, string errorMessage) { var reportParameters = new List <ReportParameter>(); var reportRequest = new ReportRequest(Enum.Parse <ReportType>(reportType), reportTitle, reportParameters); var ex = Assert.Throws <ServiceException>(() => reportRequest.Validate()); ex.Code.Should().Be(HttpStatusCode.BadRequest); ex.GetResult.Code.Should().Be(errorCode); ex.GetResult.Message.Should().Be(errorMessage); }
public void ReportRequest_StationOffset_ParameterValidationFailure(string reportColumn, string svcMethod, string queryURL, string mapURL, int errorCode, string errorMessage) { var reportParameters = LoadMandatoryReportParameters(); // replace if exist, otherwise add if (!string.IsNullOrEmpty(reportColumn)) { reportParameters.Remove(reportParameters.FirstOrDefault(rp => rp.ReportParameterType == reportColumn)); reportParameters.Add(new ReportParameter(reportColumn, svcMethod, queryURL, mapURL)); } var reportRequest = new ReportRequest(ReportType.StationOffset, "Station Offset Report", reportParameters); var ex = Assert.Throws <ServiceException>(() => reportRequest.Validate()); ex.Code.Should().Be(HttpStatusCode.BadRequest); ex.GetResult.Code.Should().Be(errorCode); ex.GetResult.Message.Should().Be(errorMessage); }