diff --git a/test/RAPS/RolesTests.cs b/test/RAPS/RolesTests.cs index c3d57d607..ea6d64afb 100644 --- a/test/RAPS/RolesTests.cs +++ b/test/RAPS/RolesTests.cs @@ -19,8 +19,8 @@ public class RolesTests /// /// Use the _sqlLiteConnection (see RejectAddRole_WhenDuplicateRoleId() to validate unique contraints or to do create, edit, delete actions /// - static SqliteConnection _sqlLiteConnection = new SqliteConnection("Filename=:memory:"); - static DbContextOptions _sqlLiteContextOptions = new DbContextOptionsBuilder() + static readonly SqliteConnection _sqlLiteConnection = new SqliteConnection("Filename=:memory:"); + static readonly DbContextOptions _sqlLiteContextOptions = new DbContextOptionsBuilder() .UseSqlite(_sqlLiteConnection) .Options; diff --git a/test/Students/EmergencyContactControllerTests.cs b/test/Students/EmergencyContactControllerTests.cs index ed48b4943..2efc6b194 100644 --- a/test/Students/EmergencyContactControllerTests.cs +++ b/test/Students/EmergencyContactControllerTests.cs @@ -318,8 +318,8 @@ public async Task UpdateStudentContact_ArgumentException_ReturnsValidationProble // but in unit tests without an HttpContext it stays null — assert the body shape. var objectResult = Assert.IsType(result.Result); var problem = Assert.IsType(objectResult.Value); - Assert.True(problem.Errors.ContainsKey("PhoneValidation")); - Assert.Contains("Invalid phone number: 12345", problem.Errors["PhoneValidation"]); + Assert.True(problem.Errors.TryGetValue("PhoneValidation", out var phoneErrors)); + Assert.Contains("Invalid phone number: 12345", phoneErrors); } [Fact] diff --git a/web/Areas/ClinicalScheduler/Controllers/RotationsController.cs b/web/Areas/ClinicalScheduler/Controllers/RotationsController.cs index e0bf5c64b..fcf16888b 100644 --- a/web/Areas/ClinicalScheduler/Controllers/RotationsController.cs +++ b/web/Areas/ClinicalScheduler/Controllers/RotationsController.cs @@ -562,8 +562,8 @@ private List BuildRecentCliniciansList(IEnumerable mothraIds, Di .Select(mothraId => new { mothraId, - fullName = personData.ContainsKey(mothraId) - ? personData[mothraId].PersonDisplayFullName + fullName = personData.TryGetValue(mothraId, out var person) + ? person.PersonDisplayFullName : $"Clinician {mothraId}" }) .OrderBy(c => c.fullName) diff --git a/web/Areas/Directory/Services/VMACSService.cs b/web/Areas/Directory/Services/VMACSService.cs index bc71f751a..c1ff1c4f1 100644 --- a/web/Areas/Directory/Services/VMACSService.cs +++ b/web/Areas/Directory/Services/VMACSService.cs @@ -7,7 +7,7 @@ namespace Viper.Areas.Directory.Services { public class VMACSService { - private static HttpClient sharedClient = new() + private static readonly HttpClient sharedClient = new() { BaseAddress = new Uri("https://vmacs-vmth.vetmed.ucdavis.edu"), };