Correct tests

This commit is contained in:
JustArchi
2020-02-01 22:45:44 +01:00
parent 4e06b86dd3
commit 0823784917

View File

@@ -55,8 +55,8 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void MultiGameMultiTypeBadReject() { public void MultiGameMultiTypeBadReject() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 9), CreateItem(1, amount: 9),
CreateItem(3, 9, realAppID: 730, type: Steam.Asset.EType.Emoticon), CreateItem(3, amount: 9, realAppID: 730, type: Steam.Asset.EType.Emoticon),
CreateItem(4, realAppID: 730, type: Steam.Asset.EType.Emoticon) CreateItem(4, realAppID: 730, type: Steam.Asset.EType.Emoticon)
}; };
@@ -77,7 +77,7 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void MultiGameMultiTypeNeutralAccept() { public void MultiGameMultiTypeNeutralAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 9), CreateItem(1, amount: 9),
CreateItem(3, realAppID: 730, type: Steam.Asset.EType.Emoticon) CreateItem(3, realAppID: 730, type: Steam.Asset.EType.Emoticon)
}; };
@@ -98,7 +98,7 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void MultiGameSingleTypeBadReject() { public void MultiGameSingleTypeBadReject() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 9), CreateItem(1, amount: 9),
CreateItem(3, realAppID: 730), CreateItem(3, realAppID: 730),
CreateItem(4, realAppID: 730) CreateItem(4, realAppID: 730)
}; };
@@ -120,7 +120,7 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void MultiGameSingleTypeNeutralAccept() { public void MultiGameSingleTypeNeutralAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 2), CreateItem(1, amount: 2),
CreateItem(3, realAppID: 730) CreateItem(3, realAppID: 730)
}; };
@@ -160,8 +160,8 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void SingleGameMultiTypeBadReject() { public void SingleGameMultiTypeBadReject() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 9), CreateItem(1, amount: 9),
CreateItem(3, 9, type: Steam.Asset.EType.Emoticon), CreateItem(3, amount: 9, type: Steam.Asset.EType.Emoticon),
CreateItem(4, type: Steam.Asset.EType.Emoticon) CreateItem(4, type: Steam.Asset.EType.Emoticon)
}; };
@@ -182,7 +182,7 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void SingleGameMultiTypeNeutralAccept() { public void SingleGameMultiTypeNeutralAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 9), CreateItem(1, amount: 9),
CreateItem(3, type: Steam.Asset.EType.Emoticon) CreateItem(3, type: Steam.Asset.EType.Emoticon)
}; };
@@ -214,7 +214,7 @@ namespace ArchiSteamFarm.Tests {
CreateItem(3) CreateItem(3)
}; };
HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(4, 3) }; HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(4, amount: 3) };
Assert.IsTrue(IsFairExchange(itemsToGive, itemsToReceive)); Assert.IsTrue(IsFairExchange(itemsToGive, itemsToReceive));
Assert.IsFalse(IsTradeNeutralOrBetter(inventory, itemsToGive, itemsToReceive)); Assert.IsFalse(IsTradeNeutralOrBetter(inventory, itemsToGive, itemsToReceive));
@@ -224,15 +224,15 @@ namespace ArchiSteamFarm.Tests {
public void SingleGameQuantityBadReject2() { public void SingleGameQuantityBadReject2() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1), CreateItem(1),
CreateItem(2, 2) CreateItem(2, amount: 2)
}; };
HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> {
CreateItem(1), CreateItem(1),
CreateItem(2, 2) CreateItem(2, amount: 2)
}; };
HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(3, 3) }; HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(3, amount: 3) };
Assert.IsTrue(IsFairExchange(itemsToGive, itemsToReceive)); Assert.IsTrue(IsFairExchange(itemsToGive, itemsToReceive));
Assert.IsFalse(IsTradeNeutralOrBetter(inventory, itemsToGive, itemsToReceive)); Assert.IsFalse(IsTradeNeutralOrBetter(inventory, itemsToGive, itemsToReceive));
@@ -241,7 +241,7 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void SingleGameQuantityNeutralAccept() { public void SingleGameQuantityNeutralAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 2), CreateItem(1, amount: 2),
CreateItem(2) CreateItem(2)
}; };
@@ -250,7 +250,7 @@ namespace ArchiSteamFarm.Tests {
CreateItem(2) CreateItem(2)
}; };
HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(3, 2) }; HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(3, amount: 2) };
Assert.IsTrue(IsFairExchange(itemsToGive, itemsToReceive)); Assert.IsTrue(IsFairExchange(itemsToGive, itemsToReceive));
Assert.IsTrue(IsTradeNeutralOrBetter(inventory, itemsToGive, itemsToReceive)); Assert.IsTrue(IsTradeNeutralOrBetter(inventory, itemsToGive, itemsToReceive));
@@ -273,9 +273,9 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void SingleGameSingleTypeBadWithOverpayingReject() { public void SingleGameSingleTypeBadWithOverpayingReject() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 2), CreateItem(1, amount: 2),
CreateItem(2, 2), CreateItem(2, amount: 2),
CreateItem(3, 2) CreateItem(3, amount: 2)
}; };
HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { CreateItem(2) }; HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { CreateItem(2) };
@@ -293,7 +293,7 @@ namespace ArchiSteamFarm.Tests {
public void SingleGameSingleTypeBigDifferenceAccept() { public void SingleGameSingleTypeBigDifferenceAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1), CreateItem(1),
CreateItem(2, 5), CreateItem(2, amount: 5),
CreateItem(3) CreateItem(3)
}; };
@@ -308,10 +308,10 @@ namespace ArchiSteamFarm.Tests {
public void SingleGameSingleTypeBigDifferenceReject() { public void SingleGameSingleTypeBigDifferenceReject() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1), CreateItem(1),
CreateItem(2, 2), CreateItem(2, amount: 2),
CreateItem(3, 2), CreateItem(3, amount: 2),
CreateItem(4, 3), CreateItem(4, amount: 3),
CreateItem(5, 10) CreateItem(5, amount: 10)
}; };
HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> {
@@ -330,7 +330,7 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void SingleGameSingleTypeGoodAccept() { public void SingleGameSingleTypeGoodAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { CreateItem(1, 2) }; HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { CreateItem(1, amount: 2) };
HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { CreateItem(1) }; HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { CreateItem(1) };
HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(2) }; HashSet<Steam.Asset> itemsToReceive = new HashSet<Steam.Asset> { CreateItem(2) };
@@ -351,8 +351,8 @@ namespace ArchiSteamFarm.Tests {
[TestMethod] [TestMethod]
public void SingleGameSingleTypeNeutralWithOverpayingAccept() { public void SingleGameSingleTypeNeutralWithOverpayingAccept() {
HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> { HashSet<Steam.Asset> inventory = new HashSet<Steam.Asset> {
CreateItem(1, 2), CreateItem(1, amount: 2),
CreateItem(2, 2) CreateItem(2, amount: 2)
}; };
HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { CreateItem(2) }; HashSet<Steam.Asset> itemsToGive = new HashSet<Steam.Asset> { CreateItem(2) };
@@ -367,6 +367,6 @@ namespace ArchiSteamFarm.Tests {
} }
[NotNull] [NotNull]
private static Steam.Asset CreateItem(ulong classID, uint amount = 1, bool marketable = true, uint realAppID = Steam.Asset.SteamAppID, Steam.Asset.EType type = Steam.Asset.EType.TradingCard, Steam.Asset.ERarity rarity = Steam.Asset.ERarity.Common) => new Steam.Asset(Steam.Asset.SteamAppID, Steam.Asset.SteamCommunityContextID, classID, amount, marketable, realAppID, type, rarity); private static Steam.Asset CreateItem(ulong classID, ulong instanceID = 0, uint amount = 1, bool marketable = true, uint realAppID = Steam.Asset.SteamAppID, Steam.Asset.EType type = Steam.Asset.EType.TradingCard, Steam.Asset.ERarity rarity = Steam.Asset.ERarity.Common) => new Steam.Asset(Steam.Asset.SteamAppID, Steam.Asset.SteamCommunityContextID, classID, instanceID, amount, marketable, realAppID, type, rarity);
} }
} }