Fixes crash in marketBuffer
This commit is contained in:
parent
2b7ba61543
commit
0c4d3be912
|
@ -50,10 +50,10 @@ namespace CodexTests.UtilityTests
|
|||
|
||||
apiCalls.Stop();
|
||||
|
||||
Assert.That(receivedEvents.Count(e => e.Contains("Created as New.")), Is.EqualTo(1));
|
||||
Assert.That(receivedEvents.Count(e => e.Contains("SlotFilled")), Is.EqualTo(GetNumberOfRequiredHosts()));
|
||||
Assert.That(receivedEvents.Count(e => e.Contains("Transit: New -> Started")), Is.EqualTo(1));
|
||||
Assert.That(receivedEvents.Count(e => e.Contains("Transit: Started -> Finished")), Is.EqualTo(1));
|
||||
AssertEventOccurance("Created as New.", 1);
|
||||
AssertEventOccurance("SlotFilled", Convert.ToInt32(GetNumberOfRequiredHosts()));
|
||||
AssertEventOccurance("Transit: New -> Started", 1);
|
||||
AssertEventOccurance("Transit: Started -> Finished", 1);
|
||||
|
||||
foreach (var r in repo.Rewards)
|
||||
{
|
||||
|
@ -71,6 +71,12 @@ namespace CodexTests.UtilityTests
|
|||
return $"({rewardId})'{reward.Message}'";
|
||||
}
|
||||
|
||||
private void AssertEventOccurance(string msg, int expectedCount)
|
||||
{
|
||||
Assert.That(receivedEvents.Count(e => e.Contains(msg)), Is.EqualTo(expectedCount),
|
||||
$"Event '{msg}' did not occure correct number of times.");
|
||||
}
|
||||
|
||||
private void OnCommand(string timestamp, GiveRewardsCommand call)
|
||||
{
|
||||
Log($"<API call {timestamp}>");
|
||||
|
|
|
@ -44,7 +44,11 @@ namespace TestNetRewarder
|
|||
|
||||
private float Average(Func<IChainStateRequest, BigInteger> getValue)
|
||||
{
|
||||
return Average(s => Convert.ToInt32(getValue(s)));
|
||||
return Average(s =>
|
||||
{
|
||||
var value = getValue(s);
|
||||
return (int)value;
|
||||
});
|
||||
}
|
||||
|
||||
private float Average(Func<IChainStateRequest, int> getValue)
|
||||
|
|
Loading…
Reference in New Issue