diff --git a/test/CTS/AssessmentControllerTest.cs b/test/CTS/AssessmentControllerTest.cs index 289fcd92f..c9b412246 100644 --- a/test/CTS/AssessmentControllerTest.cs +++ b/test/CTS/AssessmentControllerTest.cs @@ -263,7 +263,7 @@ private static bool IsForbidResult(ActionResult a) Assert.True(result != null || forbidResult != null); } - catch (Exception) + catch (Xunit.Sdk.XunitException) { return false; } @@ -279,7 +279,7 @@ private static bool IsNotFoundResult(ActionResult a) var result = a.Result as NotFoundResult; Assert.Equal((int)HttpStatusCode.NotFound, result?.StatusCode); } - catch (Exception) + catch (Xunit.Sdk.XunitException) { return false; } diff --git a/test/ClinicalScheduler/EmailNotificationTest.cs b/test/ClinicalScheduler/EmailNotificationTest.cs index be00573e6..508242f0a 100644 --- a/test/ClinicalScheduler/EmailNotificationTest.cs +++ b/test/ClinicalScheduler/EmailNotificationTest.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using NSubstitute; using NSubstitute.ExceptionExtensions; @@ -281,7 +282,7 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person { result = await _service.RemoveInstructorScheduleAsync(savedSchedule.InstructorScheduleId); } - catch (Exception ex) + catch (Exception ex) when (ex is InvalidOperationException or DbUpdateException or SqlException or OperationCanceledException) { caughtException = ex; System.Console.WriteLine($"Exception caught: {ex.GetType().Name}: {ex.Message}"); @@ -463,7 +464,7 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person { result = await _service.RemoveInstructorScheduleAsync(savedPrimarySchedule.InstructorScheduleId); } - catch (Exception ex) + catch (Exception ex) when (ex is InvalidOperationException or DbUpdateException or SqlException or OperationCanceledException) { caughtException = ex; System.Console.WriteLine($"Exception caught: {ex.GetType().Name}: {ex.Message}"); diff --git a/test/ClinicalScheduler/RotationServiceTest.cs b/test/ClinicalScheduler/RotationServiceTest.cs index 4c17e1580..905415e8f 100644 --- a/test/ClinicalScheduler/RotationServiceTest.cs +++ b/test/ClinicalScheduler/RotationServiceTest.cs @@ -95,7 +95,7 @@ private void SeedTestData() } _context.SaveChanges(); } - catch (Exception ex) + catch (Exception ex) when (ex is DbUpdateException or InvalidOperationException) { // Log the exception and provide a clear error message for debugging Console.WriteLine($"Error seeding test data: {ex.Message}"); diff --git a/web/Areas/ClinicalScheduler/Controllers/CliniciansController.cs b/web/Areas/ClinicalScheduler/Controllers/CliniciansController.cs index a762b76f1..c64f13e01 100644 --- a/web/Areas/ClinicalScheduler/Controllers/CliniciansController.cs +++ b/web/Areas/ClinicalScheduler/Controllers/CliniciansController.cs @@ -201,7 +201,7 @@ public async Task GetClinicianSchedule(string mothraId, [FromQuer fullName = $"Clinician {mothraId}", firstName = "", lastName = "", - role = (string?)null + role = default(string) }; } else diff --git a/web/Areas/Effort/Services/VerificationService.cs b/web/Areas/Effort/Services/VerificationService.cs index a84eac6b5..21afaa320 100644 --- a/web/Areas/Effort/Services/VerificationService.cs +++ b/web/Areas/Effort/Services/VerificationService.cs @@ -232,7 +232,7 @@ await _auditService.LogRecordChangeAsync( // Set verification timestamp var verifiedDate = DateTime.Now; - var oldValues = new { EffortVerified = (DateTime?)null }; + var oldValues = new { EffortVerified = default(DateTime?) }; instructor.EffortVerified = verifiedDate; diff --git a/web/Areas/Students/Services/PhotoExportService.cs b/web/Areas/Students/Services/PhotoExportService.cs index cf55dbb5d..7f4ad256d 100644 --- a/web/Areas/Students/Services/PhotoExportService.cs +++ b/web/Areas/Students/Services/PhotoExportService.cs @@ -891,6 +891,8 @@ public PhotoExportService( /// Loads all student photos upfront in parallel for faster export generation. /// Returns a dictionary keyed by student MailId for quick lookup during rendering. /// + private sealed record PhotoLookupResult(string MailId, byte[]? PhotoBytes); + private async Task> BatchLoadPhotosAsync(List students) { var photoCache = new Dictionary(); @@ -903,22 +905,22 @@ private async Task> BatchLoadPhotosAsync(List @* UC Davis Weill Header Image *@ + @{ + var baseUrl = ViewBag.BaseUrl as string; + } - @if (!string.IsNullOrWhiteSpace((string?)ViewBag.BaseUrl)) + @if (!string.IsNullOrWhiteSpace(baseUrl)) { - UC Davis Weill School of Veterinary Medicine