Skip to content

Commit bbca09c

Browse files
committed
chore(quality): shorten reference qualifiers across solution
- Bulk-applied via `jb cleanupcode --profile=ShortenReferences` then `dotnet format`. Replaces inline `Namespace.Type` with imported `Type` (or `using Alias = Namespace.Type;` for ambiguous names). Compiler-equivalent — no behavior change. - PhotoExportService.cs gets the largest single diff because it juggles four DocumentFormat.OpenXml sub-namespaces with conflicting type names (`Picture`, `Paragraph`, `Run`, etc.); aliases at the top replace the inline full qualifiers throughout.
1 parent 0dadd27 commit bbca09c

89 files changed

Lines changed: 520 additions & 392 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/CTS/SetupAssessments.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Viper.Areas.CTS.Services;
44
using Viper.Classes.SQLContext;
55
using Viper.Models.CTS;
6+
using Viper.Models.VIPER;
67

78
namespace Viper.test.CTS
89
{
@@ -17,7 +18,7 @@ internal static class SetupAssessments
1718
EnteredOn = DateTime.Now,
1819
StudentUserId = SetupUsers.studentUser1.AaudUserId,
1920
EncounterType = (int)EncounterCreationService.EncounterType.Epa,
20-
Student = new Models.VIPER.Person()
21+
Student = new Person()
2122
{
2223
FullName = SetupUsers.studentUser1.DisplayLastName + ", " + SetupUsers.studentUser1.DisplayFirstName,
2324
MailId = "",
@@ -32,7 +33,7 @@ internal static class SetupAssessments
3233
EnteredOn = DateTime.Now,
3334
StudentUserId = SetupUsers.studentUser1.AaudUserId,
3435
EncounterType = (int)EncounterCreationService.EncounterType.Epa,
35-
Student = new Models.VIPER.Person()
36+
Student = new Person()
3637
{
3738
FullName = SetupUsers.studentUser1.DisplayLastName + ", " + SetupUsers.studentUser1.DisplayFirstName,
3839
MailId = "",
@@ -47,7 +48,7 @@ internal static class SetupAssessments
4748
EnteredOn = DateTime.Now,
4849
StudentUserId = SetupUsers.studentUser2.AaudUserId,
4950
EncounterType = (int)EncounterCreationService.EncounterType.Epa,
50-
Student = new Models.VIPER.Person()
51+
Student = new Person()
5152
{
5253
FullName = SetupUsers.studentUser2.DisplayLastName + ", " + SetupUsers.studentUser2.DisplayFirstName,
5354
MailId = "",
@@ -72,7 +73,7 @@ public static void SetupEncountersTable(VIPERContext context)
7273
.Do(callInfo =>
7374
{
7475
var e = callInfo.Arg<Encounter>();
75-
e.Student = new Models.VIPER.Person()
76+
e.Student = new Person()
7677
{
7778
PersonId = e.StudentUserId,
7879
};

test/ClinicalScheduler/ClinicalSchedulerContextTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.EntityFrameworkCore;
22
using Viper.Classes.SQLContext;
3+
using Viper.Models.ClinicalScheduler;
34

45
namespace Viper.test.ClinicalScheduler
56
{
@@ -81,7 +82,7 @@ public void ClinicalSchedulerContext_ServiceIgnoredPropertiesNotIncluded()
8182

8283
// Act
8384
using var context = new ClinicalSchedulerContext(options);
84-
var serviceEntityType = context.Model.FindEntityType(typeof(Viper.Models.ClinicalScheduler.Service));
85+
var serviceEntityType = context.Model.FindEntityType(typeof(Service));
8586

8687
// Assert - Verify that Encounters and Epas navigation properties are ignored
8788
Assert.NotNull(serviceEntityType);

test/ClinicalScheduler/EmailNotificationTest.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private async Task AddTestPersonAsync(string mothraId, string firstName = "Test"
101101
{
102102
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == mothraId))
103103
{
104-
await _context.Persons.AddAsync(new Viper.Models.ClinicalScheduler.Person
104+
await _context.Persons.AddAsync(new Person
105105
{
106106
IdsMothraId = mothraId,
107107
PersonDisplayFullName = $"{lastName}, {firstName}",
@@ -237,7 +237,7 @@ await _context.Services.AddAsync(new Service
237237
// Add Person entity for the instructor
238238
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == "test123"))
239239
{
240-
await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
240+
await _context.Persons.AddAsync(new Person
241241
{
242242
IdsMothraId = "test123",
243243
PersonDisplayFullName = "Test Instructor",
@@ -272,7 +272,7 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
272272
.Include(s => s.Rotation)
273273
.Include(s => s.Person)
274274
.FirstOrDefaultAsync(s => s.InstructorScheduleId == savedSchedule.InstructorScheduleId);
275-
System.Console.WriteLine($"Debug schedule found: {debugSchedule != null}, Rotation: {debugSchedule?.Rotation?.Name}, Person: {debugSchedule?.Person?.PersonDisplayFullName}");
275+
Console.WriteLine($"Debug schedule found: {debugSchedule != null}, Rotation: {debugSchedule?.Rotation?.Name}, Person: {debugSchedule?.Person?.PersonDisplayFullName}");
276276

277277
// Act
278278
(bool success, bool wasPrimaryEvaluator, string? instructorName) result = (false, false, null);
@@ -284,17 +284,17 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
284284
catch (Exception ex)
285285
{
286286
caughtException = ex;
287-
System.Console.WriteLine($"Exception caught: {ex.GetType().Name}: {ex.Message}");
287+
Console.WriteLine($"Exception caught: {ex.GetType().Name}: {ex.Message}");
288288
}
289289

290290
// Debug: Check if schedule exists after calling service
291291
var scheduleExistsAfterCall = await _context.InstructorSchedules
292292
.AnyAsync(s => s.InstructorScheduleId == savedSchedule.InstructorScheduleId);
293-
System.Console.WriteLine($"Schedule exists after call: {scheduleExistsAfterCall}, ID: {savedSchedule.InstructorScheduleId}");
294-
System.Console.WriteLine($"Result: success={result.success}, wasPrimary={result.wasPrimaryEvaluator}, name={result.instructorName}");
293+
Console.WriteLine($"Schedule exists after call: {scheduleExistsAfterCall}, ID: {savedSchedule.InstructorScheduleId}");
294+
Console.WriteLine($"Result: success={result.success}, wasPrimary={result.wasPrimaryEvaluator}, name={result.instructorName}");
295295
if (caughtException != null)
296296
{
297-
System.Console.WriteLine($"Exception: {caughtException}");
297+
Console.WriteLine($"Exception: {caughtException}");
298298
}
299299

300300
// Assert
@@ -402,7 +402,7 @@ await _context.Services.AddAsync(new Service
402402
// Also add minimal Person for mothraId to allow Include query to work, but with minimal data to test graceful handling
403403
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == "other456"))
404404
{
405-
await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
405+
await _context.Persons.AddAsync(new Person
406406
{
407407
IdsMothraId = "other456",
408408
PersonDisplayFullName = "Other Person",
@@ -415,7 +415,7 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
415415
// Add minimal Person for unknown123 to allow Include query to work
416416
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == mothraId))
417417
{
418-
await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
418+
await _context.Persons.AddAsync(new Person
419419
{
420420
IdsMothraId = mothraId,
421421
// Deliberately use empty strings to test graceful handling of missing name data
@@ -454,7 +454,7 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
454454
.Include(s => s.Rotation)
455455
.Include(s => s.Person)
456456
.FirstOrDefaultAsync(s => s.InstructorScheduleId == savedPrimarySchedule.InstructorScheduleId);
457-
System.Console.WriteLine($"Debug schedule found: {debugSchedule != null}, Rotation: {debugSchedule?.Rotation?.Name}, Person: {debugSchedule?.Person?.PersonDisplayFullName}");
457+
Console.WriteLine($"Debug schedule found: {debugSchedule != null}, Rotation: {debugSchedule?.Rotation?.Name}, Person: {debugSchedule?.Person?.PersonDisplayFullName}");
458458

459459
// Act
460460
(bool success, bool wasPrimaryEvaluator, string? instructorName) result = (false, false, null);
@@ -466,13 +466,13 @@ await _context.Persons.AddAsync(new Models.ClinicalScheduler.Person
466466
catch (Exception ex)
467467
{
468468
caughtException = ex;
469-
System.Console.WriteLine($"Exception caught: {ex.GetType().Name}: {ex.Message}");
469+
Console.WriteLine($"Exception caught: {ex.GetType().Name}: {ex.Message}");
470470
}
471471

472-
System.Console.WriteLine($"Result: success={result.success}, wasPrimary={result.wasPrimaryEvaluator}, name={result.instructorName}");
472+
Console.WriteLine($"Result: success={result.success}, wasPrimary={result.wasPrimaryEvaluator}, name={result.instructorName}");
473473
if (caughtException != null)
474474
{
475-
System.Console.WriteLine($"Exception: {caughtException}");
475+
Console.WriteLine($"Exception: {caughtException}");
476476
}
477477

478478
// Assert
@@ -653,7 +653,7 @@ public async Task SetPrimaryEvaluatorAsync_ReplacingPrimaryEvaluator_DoesNotSend
653653
// Add the current user person - need to manually set the display name to match expected output
654654
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == "currentuser"))
655655
{
656-
await _context.Persons.AddAsync(new Viper.Models.ClinicalScheduler.Person
656+
await _context.Persons.AddAsync(new Person
657657
{
658658
IdsMothraId = "currentuser",
659659
PersonDisplayFullName = "Current User", // Set exact display name expected in test
@@ -722,7 +722,7 @@ public async Task AddInstructorAsync_AsPrimaryEvaluator_DoesNotSendReplacementEm
722722
// Add the current user person - need to manually set the display name to match expected output
723723
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == "currentuser"))
724724
{
725-
await _context.Persons.AddAsync(new Viper.Models.ClinicalScheduler.Person
725+
await _context.Persons.AddAsync(new Person
726726
{
727727
IdsMothraId = "currentuser",
728728
PersonDisplayFullName = "Current User", // Set exact display name expected in test
@@ -789,7 +789,7 @@ public async Task SetPrimaryEvaluatorAsync_UnsettingPrimaryEvaluator_SendsRemova
789789
// Add the current user person - need to manually set the display name to match expected output
790790
if (!await _context.Persons.AnyAsync(p => p.IdsMothraId == "currentuser"))
791791
{
792-
await _context.Persons.AddAsync(new Viper.Models.ClinicalScheduler.Person
792+
await _context.Persons.AddAsync(new Person
793793
{
794794
IdsMothraId = "currentuser",
795795
PersonDisplayFullName = "Current User", // Set exact display name expected in test

test/ClinicalScheduler/GradYearServiceTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Reflection;
12
using Microsoft.EntityFrameworkCore;
23
using Microsoft.Extensions.Logging;
34
using NSubstitute;
@@ -39,7 +40,7 @@ public void GradYearService_HasCorrectPublicMethods()
3940
var serviceType = typeof(GradYearService);
4041

4142
// Act
42-
var methods = serviceType.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
43+
var methods = serviceType.GetMethods(BindingFlags.Public | BindingFlags.Instance)
4344
.Where(m => m.DeclaringType == serviceType)
4445
.Select(m => m.Name)
4546
.ToList();

test/ClinicalScheduler/InstructorScheduleControllerTest.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
using Microsoft.Extensions.Logging;
55
using NSubstitute;
66
using Viper.Areas.ClinicalScheduler.Controllers;
7+
using Viper.Areas.ClinicalScheduler.Models;
78
using Viper.Areas.ClinicalScheduler.Models.DTOs.Requests;
9+
using Viper.Areas.ClinicalScheduler.Models.DTOs.Responses;
810
using Viper.Areas.ClinicalScheduler.Services;
911
using Viper.Areas.ClinicalScheduler.Validators;
12+
using Viper.Models.ClinicalScheduler;
1013

1114
namespace Viper.test.ClinicalScheduler
1215
{
@@ -193,7 +196,7 @@ public async Task AddInstructor_ValidRequest_ReturnsOkWithResponse()
193196
request.GradYear.Value,
194197
request.RotationId.Value,
195198
Arg.Any<CancellationToken>())
196-
.Returns(new List<Viper.Models.ClinicalScheduler.InstructorSchedule>());
199+
.Returns(new List<InstructorSchedule>());
197200

198201
_mockScheduleEditService.AddInstructorAsync(
199202
request.MothraId,
@@ -202,7 +205,7 @@ public async Task AddInstructor_ValidRequest_ReturnsOkWithResponse()
202205
request.GradYear.Value,
203206
request.IsPrimaryEvaluator,
204207
Arg.Any<CancellationToken>())
205-
.Returns(new List<Viper.Models.ClinicalScheduler.InstructorSchedule>
208+
.Returns(new List<InstructorSchedule>
206209
{
207210
new() { InstructorScheduleId = 1, MothraId = TestUserMothraId, WeekId = 1, RotationId = CardiologyRotationId, Evaluator = false },
208211
new() { InstructorScheduleId = 2, MothraId = TestUserMothraId, WeekId = 2, RotationId = CardiologyRotationId, Evaluator = false }
@@ -223,7 +226,7 @@ public async Task AddInstructor_ValidRequest_ReturnsOkWithResponse()
223226

224227
// OkObjectResult inherently has a 200 status code, so no need to check
225228
Assert.Equal(200, okResult.StatusCode ?? 200);
226-
var actualResponse = Assert.IsType<Viper.Areas.ClinicalScheduler.Models.DTOs.Responses.AddInstructorResponse>(okResult.Value);
229+
var actualResponse = Assert.IsType<AddInstructorResponse>(okResult.Value);
227230

228231
Assert.Equal(2, actualResponse.Schedules.Count);
229232
Assert.Null(actualResponse.WarningMessage);
@@ -291,7 +294,7 @@ public async Task AddInstructor_InvalidRequest_ReturnsBadRequest()
291294

292295
// Assert
293296
var badRequestResult = Assert.IsType<BadRequestObjectResult>(result);
294-
var errorResponse = Assert.IsType<Viper.Areas.ClinicalScheduler.Models.ErrorResponse>(badRequestResult.Value);
297+
var errorResponse = Assert.IsType<ErrorResponse>(badRequestResult.Value);
295298

296299
Assert.NotNull(errorResponse.UserMessage);
297300
Assert.Contains("required", errorResponse.UserMessage, StringComparison.OrdinalIgnoreCase);

test/ClinicalScheduler/Integration/ControllerServiceIntegrationTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.ComponentModel.DataAnnotations;
12
using Microsoft.AspNetCore.Http;
23
using Microsoft.AspNetCore.Mvc;
34
using Microsoft.Extensions.Logging;
@@ -314,7 +315,7 @@ public Task CompleteRequestFlow_WithDTOValidation_WorksEndToEnd()
314315
IsPrimaryEvaluator = false
315316
};
316317

317-
var validationContext = new System.ComponentModel.DataAnnotations.ValidationContext(invalidRequest);
318+
var validationContext = new ValidationContext(invalidRequest);
318319
var validationResults = invalidRequest.Validate(validationContext);
319320

320321
Assert.NotEmpty(validationResults);

test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Viper.Areas.ClinicalScheduler.Extensions;
44
using Viper.Areas.ClinicalScheduler.Models.DTOs.Responses;
55
using Viper.Areas.ClinicalScheduler.Services;
6+
using Viper.Areas.CTS.Models;
67
using Viper.Models.ClinicalScheduler;
78
using CtsModels = Viper.Models.CTS;
89

@@ -37,14 +38,14 @@ public ServiceLayerIntegrationTest()
3738
var weekId = callInfo.ArgAt<int?>(4);
3839

3940
// Return mock data that matches the test scenarios
40-
var mockData = new List<Viper.Areas.CTS.Models.ClinicalScheduledStudent>();
41+
var mockData = new List<ClinicalScheduledStudent>();
4142

4243
// Add mock student data that matches the test expectations
4344
if ((rotationId == null || rotationId == CardiologyRotationId) &&
4445
(mothraId == null || mothraId == "12345") &&
4546
(weekId == null || weekId == 1))
4647
{
47-
mockData.Add(new Viper.Areas.CTS.Models.ClinicalScheduledStudent
48+
mockData.Add(new ClinicalScheduledStudent
4849
{
4950
MothraId = "12345",
5051
FirstName = "Student",
@@ -65,7 +66,7 @@ public ServiceLayerIntegrationTest()
6566
(mothraId == null || mothraId == "12345") &&
6667
(weekId == null || weekId == 10))
6768
{
68-
mockData.Add(new Viper.Areas.CTS.Models.ClinicalScheduledStudent
69+
mockData.Add(new ClinicalScheduledStudent
6970
{
7071
MothraId = "12345",
7172
FirstName = "Student",
@@ -176,7 +177,7 @@ public ServiceLayerIntegrationTest()
176177
public async Task ServiceDecomposition_StudentScheduleService_WorksIndependently()
177178
{
178179
// Arrange - Setup mock to return test data
179-
var testStudent = new Viper.Areas.CTS.Models.ClinicalScheduledStudent
180+
var testStudent = new ClinicalScheduledStudent
180181
{
181182
MothraId = "student1"
182183
};
@@ -185,7 +186,7 @@ public async Task ServiceDecomposition_StudentScheduleService_WorksIndependently
185186
mockService.GetStudentScheduleAsync(
186187
Arg.Any<int?>(), Arg.Any<string>(), CardiologyRotationId, Arg.Any<int?>(),
187188
Arg.Any<int?>(), Arg.Any<DateTime?>(), Arg.Any<DateTime?>())
188-
.Returns(new List<Viper.Areas.CTS.Models.ClinicalScheduledStudent> { testStudent });
189+
.Returns(new List<ClinicalScheduledStudent> { testStudent });
189190

190191
// Act
191192
var schedules = await mockService.GetStudentScheduleAsync(

test/ClinicalScheduler/IntegrationTestBase.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Security.Claims;
12
using Microsoft.AspNetCore.Http;
23
using Microsoft.AspNetCore.Mvc;
34
using Microsoft.EntityFrameworkCore;
@@ -165,9 +166,9 @@ protected void SetupControllerContext(ControllerBase controller)
165166

166167
var httpContext = new DefaultHttpContext();
167168
httpContext.RequestServices = serviceProvider;
168-
httpContext.User = new System.Security.Claims.ClaimsPrincipal(
169-
new System.Security.Claims.ClaimsIdentity(
170-
new[] { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, TestUserLoginId) },
169+
httpContext.User = new ClaimsPrincipal(
170+
new ClaimsIdentity(
171+
new[] { new Claim(ClaimTypes.Name, TestUserLoginId) },
171172
"test"
172173
)
173174
);
@@ -198,15 +199,15 @@ protected void SeedCliniciansTestData(int? baseYear = null)
198199
// Add instructor schedules with numeric MothraIds
199200
var instructorSchedules = new[]
200201
{
201-
new Models.ClinicalScheduler.InstructorSchedule
202+
new InstructorSchedule
202203
{
203204
InstructorScheduleId = 100,
204205
MothraId = "12345",
205206
RotationId = CardiologyRotationId,
206207
WeekId = 10,
207208
Evaluator = false
208209
},
209-
new Models.ClinicalScheduler.InstructorSchedule
210+
new InstructorSchedule
210211
{
211212
InstructorScheduleId = 101,
212213
MothraId = "67890",

test/ClinicalScheduler/PermissionsControllerTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using NSubstitute.ExceptionExtensions;
55
using Viper.Areas.ClinicalScheduler.Controllers;
66
using Viper.Areas.ClinicalScheduler.Services;
7+
using Viper.Models.ClinicalScheduler;
78

89
namespace Viper.test.ClinicalScheduler
910
{
@@ -113,7 +114,7 @@ public async Task GetUserPermissions_WithValidUser_ReturnsOkWithPermissions()
113114
MockUserHelper.GetCurrentUser().Returns(testUser);
114115

115116
var servicePermissions = TestDataBuilder.ServicePermissionScenarios.CardiologyOnly;
116-
var editableServices = new List<Viper.Models.ClinicalScheduler.Service> { Context.Services.First(s => s.ServiceId == CardiologyServiceId) };
117+
var editableServices = new List<Service> { Context.Services.First(s => s.ServiceId == CardiologyServiceId) };
117118

118119
_mockPermissionService.GetUserServicePermissionsAsync(Arg.Any<CancellationToken>())
119120
.Returns(servicePermissions);

0 commit comments

Comments
 (0)