style(backend): apply dotnet format whitespace normalization
- Applied dotnet format to 24 files in backend/ - Corrects spacing, indentation, and formatting consistency - No functional changes to code logic Ultraworked with Sisyphus <https://github.com/code-yeongyu/oh-my-opencode> Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -19,7 +19,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
{
|
||||
using var scope = Factory.Services.CreateScope();
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
// Clean up existing test data
|
||||
context.ShiftSignups.RemoveRange(context.ShiftSignups);
|
||||
context.Shifts.RemoveRange(context.Shifts);
|
||||
@@ -31,7 +31,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
{
|
||||
// Arrange
|
||||
var clubId = Guid.NewGuid();
|
||||
|
||||
|
||||
SetTenant("tenant1");
|
||||
AuthenticateAs("manager@test.com", new Dictionary<string, string> { ["tenant1"] = "Manager" });
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
|
||||
|
||||
|
||||
var result = await response.Content.ReadFromJsonAsync<ShiftDetailResponse>();
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal("Morning Shift", result.Title);
|
||||
@@ -64,7 +64,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
{
|
||||
// Arrange
|
||||
var clubId = Guid.NewGuid();
|
||||
|
||||
|
||||
SetTenant("tenant1");
|
||||
AuthenticateAs("viewer@test.com", new Dictionary<string, string> { ["tenant1"] = "Viewer" });
|
||||
|
||||
@@ -90,11 +90,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
// Shift in date range
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
@@ -109,7 +109,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
// Shift outside date range
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
@@ -124,7 +124,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
||||
var result = await response.Content.ReadFromJsonAsync<ShiftListResponse>();
|
||||
Assert.NotNull(result);
|
||||
Assert.Single(result.Items);
|
||||
@@ -155,11 +155,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var createdBy = Guid.NewGuid();
|
||||
var memberId = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -175,7 +175,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
context.ShiftSignups.Add(new ShiftSignup
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
@@ -184,7 +184,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
MemberId = memberId,
|
||||
SignedUpAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
||||
var result = await response.Content.ReadFromJsonAsync<ShiftDetailResponse>();
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(shiftId, result.Id);
|
||||
@@ -213,11 +213,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -231,7 +231,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
||||
var result = await response.Content.ReadFromJsonAsync<ShiftDetailResponse>();
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal("Updated Title", result.Title);
|
||||
@@ -264,11 +264,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -282,7 +282,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
|
||||
|
||||
|
||||
// Verify shift is deleted
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
@@ -312,11 +312,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -330,7 +330,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -352,11 +352,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -370,7 +370,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
||||
// Verify signup was created
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
@@ -400,11 +400,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -418,7 +418,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
// Add one signup to fill capacity
|
||||
context.ShiftSignups.Add(new ShiftSignup
|
||||
{
|
||||
@@ -428,7 +428,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
MemberId = Guid.NewGuid(),
|
||||
SignedUpAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -450,11 +450,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -468,7 +468,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now.AddDays(-1),
|
||||
UpdatedAt = now.AddDays(-1)
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -491,11 +491,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var createdBy = Guid.NewGuid();
|
||||
var memberId = Guid.Parse("00000000-0000-0000-0000-000000000001"); // Fixed member ID
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -509,7 +509,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
// Add existing signup
|
||||
context.ShiftSignups.Add(new ShiftSignup
|
||||
{
|
||||
@@ -519,7 +519,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
MemberId = memberId,
|
||||
SignedUpAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -542,11 +542,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var createdBy = Guid.NewGuid();
|
||||
var memberId = Guid.Parse("00000000-0000-0000-0000-000000000001");
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -560,7 +560,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
context.ShiftSignups.Add(new ShiftSignup
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
@@ -569,7 +569,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
MemberId = memberId,
|
||||
SignedUpAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
||||
// Verify signup was deleted
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
@@ -599,11 +599,11 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
var clubId = Guid.NewGuid();
|
||||
var createdBy = Guid.NewGuid();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
|
||||
|
||||
context.Shifts.Add(new Shift
|
||||
{
|
||||
Id = shiftId,
|
||||
@@ -617,7 +617,7 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
});
|
||||
|
||||
|
||||
// Add one signup (leaving one slot)
|
||||
context.ShiftSignups.Add(new ShiftSignup
|
||||
{
|
||||
@@ -627,29 +627,29 @@ public class ShiftCrudTests : IntegrationTestBase
|
||||
MemberId = Guid.NewGuid(),
|
||||
SignedUpAt = now
|
||||
});
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
SetTenant("tenant1");
|
||||
|
||||
|
||||
// Act - Simulate two concurrent requests
|
||||
var member1 = Guid.NewGuid();
|
||||
var member2 = Guid.NewGuid();
|
||||
|
||||
|
||||
AuthenticateAs("member1@test.com", new Dictionary<string, string> { ["tenant1"] = "Member" }, member1.ToString());
|
||||
var response1Task = Client.PostAsync($"/api/shifts/{shiftId}/signup", null);
|
||||
|
||||
|
||||
AuthenticateAs("member2@test.com", new Dictionary<string, string> { ["tenant1"] = "Member" }, member2.ToString());
|
||||
var response2Task = Client.PostAsync($"/api/shifts/{shiftId}/signup", null);
|
||||
|
||||
|
||||
var responses = await Task.WhenAll(response1Task, response2Task);
|
||||
|
||||
// Assert - One should succeed (200), one should fail (409)
|
||||
var statuses = responses.Select(r => r.StatusCode).OrderBy(s => s).ToList();
|
||||
Assert.Contains(HttpStatusCode.OK, statuses);
|
||||
Assert.Contains(HttpStatusCode.Conflict, statuses);
|
||||
|
||||
|
||||
// Verify only 2 total signups exist (capacity limit enforced)
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user