Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 1087fde

Browse files
committed
unit test fixes
1 parent 71a7e69 commit 1087fde

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/JpProject.Domain.Tests/ClientTests/ClientCommandHandlerTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,13 @@ public async Task ShouldNotAcceptNegativeDeviceCodeLifetime()
176176
public async Task ShouldUpdateClient()
177177
{
178178
var command = ClientCommandFaker.GenerateUpdateClientCommand().Generate();
179-
_clientRepository.Setup(s => s.UpdateWithChildrens(It.Is<Client>(a => a.ClientId == command.Client.ClientId))).Returns(Task.CompletedTask);
180-
_clientRepository.Setup(s => s.GetClient(It.Is<string>(a => a == command.Client.ClientId))).ReturnsAsync(EntityClientFaker.GenerateClient().Generate());
179+
180+
var clientId = command.Client.ClientId == command.OldClientId
181+
? command.Client.ClientId
182+
: command.OldClientId;
183+
184+
_clientRepository.Setup(s => s.UpdateWithChildrens(It.Is<Client>(a => a.ClientId == clientId))).Returns(Task.CompletedTask);
185+
_clientRepository.Setup(s => s.GetClient(It.Is<string>(a => a == clientId))).ReturnsAsync(EntityClientFaker.GenerateClient().Generate());
181186
_uow.Setup(s => s.Commit()).Returns(true);
182187

183188
var result = await _commandHandler.Handle(command, _tokenSource.Token);

0 commit comments

Comments
 (0)