diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/DeviceRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Repositories/DeviceRepositoryTests.cs index d7623e037dca..2e946e5cb20d 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/DeviceRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Repositories/DeviceRepositoryTests.cs @@ -164,7 +164,7 @@ SqlAuthRepo.AuthRequestRepository sqlAuthRequestRepository } [CiSkippedTheory, EfDeviceAutoData] - public async Task GetManyByUserIdWithDeviceAuth_WorksWithNoAuthRequest_ReturnsExpectedResults( + public async Task GetManyByUserIdWithDeviceAuth_WorksWithNoAuthRequestAndMultipleDevices_ReturnsExpectedResults( Device device, User user, List efSuts, @@ -193,10 +193,14 @@ public async Task GetManyByUserIdWithDeviceAuth_WorksWithNoAuthRequest_ReturnsEx // Create device device.UserId = efUser.Id; + + device.Identifier = Guid.NewGuid().ToString(); device.Name = "test-ef-chrome"; + await efSuts[i].CreateAsync(device); + device.Identifier = Guid.NewGuid().ToString(); + device.Name = "test-ef-chrome-2"; await efSuts[i].CreateAsync(device); - efSut.ClearChangeTracking(); } // Dapper Repo @@ -207,9 +211,15 @@ public async Task GetManyByUserIdWithDeviceAuth_WorksWithNoAuthRequest_ReturnsEx // Create device device.UserId = sqlUser.Id; + + device.Identifier = Guid.NewGuid().ToString(); device.Name = "test-sql-chrome"; await sqlSut.CreateAsync(device); + device.Identifier = Guid.NewGuid().ToString(); + device.Name = "test-ef-chrome-2"; + await sqlSut.CreateAsync(device); + // Act // Entity Framework Responses @@ -230,6 +240,7 @@ public async Task GetManyByUserIdWithDeviceAuth_WorksWithNoAuthRequest_ReturnsEx { Assert.NotNull(response.First()); Assert.Null(response.First().DevicePendingAuthRequest); + Assert.True(response.Count == 2); } } @@ -246,7 +257,7 @@ public async Task GetManyByUserIdWithDeviceAuth_Fails_ReturnsExpectedResults( SqlAuthRepo.AuthRequestRepository sqlAuthRequestRepository ) { - var testCases = new[] + var casesThatCauseNoAuthDataInResponse = new[] { new { @@ -268,12 +279,12 @@ SqlAuthRepo.AuthRequestRepository sqlAuthRequestRepository } }; - foreach (var testCase in testCases) + foreach (var testCase in casesThatCauseNoAuthDataInResponse) { // Arrange var allResponses = new List>(); var userIdsToSearchOn = new List(); - var expirationTime = 15; + const int expirationTime = 15; // Configure data for successful responses. user.Email = $"{user.Id.ToString().Substring(0, 5)}@test.com";