From 4be9b9df9a450ef3ac6ac9b4caa7659123182695 Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 21 Jun 2024 10:19:09 +0200 Subject: [PATCH] Finished! --- Tests/CodexTests/UtilityTests/DiscordBotTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Tests/CodexTests/UtilityTests/DiscordBotTests.cs b/Tests/CodexTests/UtilityTests/DiscordBotTests.cs index bcaacbe..c6b6b41 100644 --- a/Tests/CodexTests/UtilityTests/DiscordBotTests.cs +++ b/Tests/CodexTests/UtilityTests/DiscordBotTests.cs @@ -55,6 +55,8 @@ namespace CodexTests.UtilityTests AssertEventOccurance("Transit: New -> Started", 1); AssertEventOccurance("Transit: Started -> Finished", 1); + AssertMarketAverage(); + foreach (var r in repo.Rewards) { var seen = rewardsSeen.Any(s => r.RoleId == s); @@ -77,6 +79,20 @@ namespace CodexTests.UtilityTests $"Event '{msg}' did not occure correct number of times."); } + private void AssertMarketAverage() + { + Assert.That(receivedAverages.Count, Is.EqualTo(1)); + var a = receivedAverages.Single(); + + Assert.That(a.NumberOfFinished, Is.EqualTo(1)); + Assert.That(a.TimeRangeSeconds, Is.EqualTo(5760)); + Assert.That(a.Price, Is.EqualTo(2.0f).Within(0.1f)); + Assert.That(a.Size, Is.EqualTo(GetMinFileSize().SizeInBytes).Within(1.0f)); + Assert.That(a.Duration, Is.EqualTo(GetMinRequiredRequestDuration().TotalSeconds).Within(1.0f)); + Assert.That(a.Collateral, Is.EqualTo(10.0f).Within(0.1f)); + Assert.That(a.ProofProbability, Is.EqualTo(5.0f).Within(0.1f)); + } + private void OnCommand(string timestamp, GiveRewardsCommand call) { Log($"");