public void CountPriceShouldReturnCorrectPrice() { // Arrange var channel = _channels.First(); // Act var result = _messageRouter.CountPrice(channel.FirstNodeId, channel.SecondNodeId); // Assert Assert.That(Math.Abs(result - 1.0), Is.LessThanOrEqualTo(AllConstants.Eps)); }
public void CountPriceShouldReturnCorrectPriceForGroundChannel() { // Arrange var channel = _channels.First(); var firstNode = _nodes.First(n => n.Id == channel.FirstNodeId); var messageQueue = firstNode.MessageQueueHandlers .First(m => m.ChannelId == channel.Id); var realPrice = channel.Price * (channel.ErrorChance + 0.1) * (messageQueue.Messages.Length + 1.0); // Act var result = _messageRouter.CountPrice(channel.FirstNodeId, channel.SecondNodeId); // Assert Assert.That(Math.Abs(result - realPrice), Is.LessThanOrEqualTo(AllConstants.Eps)); }