Skip to content

Commit

Permalink
Fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayIT committed Aug 1, 2020
1 parent ee66810 commit e5c1c4e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Source/Tests/TexasHoldem.Logic.Tests/AssertExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace TexasHoldem.Logic.Tests
{
using System.Collections.Generic;
using System.Linq;

using Xunit;

public static class CollectionsAssert
{
public static void SameElements<T>(IEnumerable<T> expected, IEnumerable<T> actual)
{
Assert.True(!expected.Except(actual).Any() && expected.Count() == actual.Count());
}
}
}
2 changes: 1 addition & 1 deletion Source/Tests/TexasHoldem.Logic.Tests/Cards/DeckTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void GetNextCardShouldReturnAll52CardsOnce()
cards.Add(deck.GetNextCard());
}

Assert.Equal(Deck.AllCards, cards);
CollectionsAssert.SameElements(Deck.AllCards, cards);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public void GetRankTypeShouldWorkCorrectly(ICollection<Card> playerCards, HandRa
IHandEvaluator handEvaluator = new HandEvaluator();
var bestHand = handEvaluator.GetBestHand(playerCards.Shuffle().ToList());
Assert.Equal(expectedHandRankType, bestHand.RankType);
Assert.Equal(expectedBestHandCards, bestHand.Cards);
CollectionsAssert.SameElements(expectedBestHandCards, bestHand.Cards);
}
}
}

0 comments on commit e5c1c4e

Please sign in to comment.