Skip to content

Commit

Permalink
Add ResetCount method to ITestCounter.
Browse files Browse the repository at this point in the history
  • Loading branch information
maliming committed Mar 15, 2024
1 parent d3e81a5 commit 84c6999
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ public interface ITestCounter
int Increment(string name);

int GetValue(string name);

void ResetCount(string name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ public int GetValue(string name)
return _values.GetOrDefault(name);
}
}

public void ResetCount(string name)
{
lock (_values)
{
_values[name] = 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ public void Should_Register_Handler()
[Fact]
public async Task Should_Trigger_Distributed_EntityUpdated_Event()
{
_testCounter.ResetCount("EntityUpdatedEto<UserEto>");
using (var uow = _unitOfWorkManager.Begin())
{
_testCounter.GetValue("EntityUpdatedEto<UserEto>").ShouldBe(0);

var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"));
await _userManager.SetEmailAsync(user, "john.nash_UPDATED@abp.io");

Expand Down

0 comments on commit 84c6999

Please sign in to comment.