public void Compute_ShouldReturnBidsUpdate_WhenBidSeen()
        {
            // Arrange
            var complier = new PercentThresholdCondition(_serviceProvider.Object);

            // Total AcceptedSpeed = 45, 10% = 4.5, order by price - ID 22, 19, 18. 4,5 power from top is id 19.
            // price threahold above is 10. Orders with price > 10 and matching conditions are id 22, 19
            // accepted speed limit 1 - only 19
            var orders = GetPercentThresholdAttackMetConditionBids();

            var config = new ApiConfiguration()
            {
                LimitSpeed               = 10,
                MinimalAcceptedSpeed     = 1,
                AcceptedPercentThreshold = 0.10 // 10%
            };

            // Act
            var data  = complier.Compute(orders, config, new List <PoolHashrate>());
            var data1 = complier.Compute(orders, config, new List <PoolHashrate>());

            // Assert
            Assert.AreEqual(1, data.Count());
            Assert.AreEqual(1, data1.Count());
            Assert.AreEqual("19", data1.First().BidEntry.NiceHashId);
            Assert.IsTrue(data1.First().Message.Contains("Progress"));
        }
        public void Compute_ShouldReturnEmptyList_WhenNothingMeetsCondition(int id)
        {
            // Arrange
            var complier = new PercentThresholdCondition(_serviceProvider.Object);
            var config   = new ApiConfiguration()
            {
                LimitSpeed = 10
            };

            // Act
            var data = complier.Compute(GetSignBidSet(id), config, new List <PoolHashrate>());

            // Assert
            Assert.IsFalse(data.Any());
        }
        public void Compute_ShouldReturnBids_WhenMetCondition()
        {
            // Arrange
            var complier = new PercentThresholdCondition(_serviceProvider.Object);

            // Total AcceptedSpeed = 45, 10% = 4.5, order by price - ID 22, 19, 18. 4,5 power from top is id 19.
            // price threahold above is 10. Orders with price > 10 and matching conditions are id 22, 19
            var orders = GetPercentThresholdAttackMetConditionBids();

            var config = new ApiConfiguration()
            {
                LimitSpeed               = 10,
                MinimalAcceptedSpeed     = 0,
                AcceptedPercentThreshold = 0.10 // 10%
            };

            // Act
            var data = complier.Compute(orders, config, new List <PoolHashrate>()).OrderBy(o => o.BidEntry.NiceHashId).ToList();

            // Asserts
            Assert.AreEqual(2, data.Count());
            Assert.IsNotEmpty("19", data[0].BidEntry.NiceHashId);
            Assert.IsNotEmpty("22", data[1].BidEntry.NiceHashId);
        }