diff --git a/ArchiSteamFarm.Tests/Trading.cs b/ArchiSteamFarm.Tests/Trading.cs index 12f09ca98..c415e1d21 100644 --- a/ArchiSteamFarm.Tests/Trading.cs +++ b/ArchiSteamFarm.Tests/Trading.cs @@ -33,17 +33,17 @@ namespace ArchiSteamFarm.Tests { HashSet inventory = new HashSet { CreateItem(1, 9), CreateItem(3, 9, 730, Steam.Asset.EType.Emoticon), - CreateItem(4, 1, 730, Steam.Asset.EType.Emoticon) + CreateItem(4, realAppID: 730, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(4, 1, 730, Steam.Asset.EType.Emoticon) + CreateItem(1), + CreateItem(4, realAppID: 730, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToReceive = new HashSet { - CreateItem(2, 1), - CreateItem(3, 1, 730, Steam.Asset.EType.Emoticon) + CreateItem(2), + CreateItem(3, realAppID: 730, type: Steam.Asset.EType.Emoticon) }; Assert.IsFalse(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -53,17 +53,17 @@ namespace ArchiSteamFarm.Tests { public void MultiGameMultiTypeNeutralAccept() { HashSet inventory = new HashSet { CreateItem(1, 9), - CreateItem(3, 1, 730, Steam.Asset.EType.Emoticon) + CreateItem(3, realAppID: 730, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(3, 1, 730, Steam.Asset.EType.Emoticon) + CreateItem(1), + CreateItem(3, realAppID: 730, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToReceive = new HashSet { - CreateItem(2, 1), - CreateItem(4, 1, 730, Steam.Asset.EType.Emoticon) + CreateItem(2), + CreateItem(4, realAppID: 730, type: Steam.Asset.EType.Emoticon) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -73,18 +73,18 @@ namespace ArchiSteamFarm.Tests { public void MultiGameSingleTypeBadReject() { HashSet inventory = new HashSet { CreateItem(1, 9), - CreateItem(3, 1, 730), - CreateItem(4, 1, 730) + CreateItem(3, realAppID: 730), + CreateItem(4, realAppID: 730) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(3, 1, 730) + CreateItem(1), + CreateItem(3, realAppID: 730) }; HashSet itemsToReceive = new HashSet { - CreateItem(2, 1), - CreateItem(4, 1, 730) + CreateItem(2), + CreateItem(4, realAppID: 730) }; Assert.IsFalse(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -94,17 +94,17 @@ namespace ArchiSteamFarm.Tests { public void MultiGameSingleTypeNeutralAccept() { HashSet inventory = new HashSet { CreateItem(1, 2), - CreateItem(3, 1, 730) + CreateItem(3, realAppID: 730) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(3, 1, 730) + CreateItem(1), + CreateItem(3, realAppID: 730) }; HashSet itemsToReceive = new HashSet { - CreateItem(2, 1), - CreateItem(4, 1, 730) + CreateItem(2), + CreateItem(4, realAppID: 730) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -115,17 +115,17 @@ namespace ArchiSteamFarm.Tests { HashSet inventory = new HashSet { CreateItem(1, 9), CreateItem(3, 9, type: Steam.Asset.EType.Emoticon), - CreateItem(4, 1, type: Steam.Asset.EType.Emoticon) + CreateItem(4, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(4, 1, type: Steam.Asset.EType.Emoticon) + CreateItem(1), + CreateItem(4, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToReceive = new HashSet { - CreateItem(2, 1), - CreateItem(3, 1, type: Steam.Asset.EType.Emoticon) + CreateItem(2), + CreateItem(3, type: Steam.Asset.EType.Emoticon) }; Assert.IsFalse(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -135,17 +135,17 @@ namespace ArchiSteamFarm.Tests { public void SingleGameMultiTypeNeutralAccept() { HashSet inventory = new HashSet { CreateItem(1, 9), - CreateItem(3, 1, type: Steam.Asset.EType.Emoticon) + CreateItem(3, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(3, 1, type: Steam.Asset.EType.Emoticon) + CreateItem(1), + CreateItem(3, type: Steam.Asset.EType.Emoticon) }; HashSet itemsToReceive = new HashSet { - CreateItem(2, 1), - CreateItem(4, 1, type: Steam.Asset.EType.Emoticon) + CreateItem(2), + CreateItem(4, type: Steam.Asset.EType.Emoticon) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -154,15 +154,15 @@ namespace ArchiSteamFarm.Tests { [TestMethod] public void SingleGameQuantityBadReject() { HashSet inventory = new HashSet { - CreateItem(1, 1), - CreateItem(2, 1), - CreateItem(3, 1) + CreateItem(1), + CreateItem(2), + CreateItem(3) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(2, 1), - CreateItem(3, 1) + CreateItem(1), + CreateItem(2), + CreateItem(3) }; HashSet itemsToReceive = new HashSet { CreateItem(4, 3) }; @@ -173,12 +173,12 @@ namespace ArchiSteamFarm.Tests { [TestMethod] public void SingleGameQuantityBadReject2() { HashSet inventory = new HashSet { - CreateItem(1, 1), + CreateItem(1), CreateItem(2, 2) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), + CreateItem(1), CreateItem(2, 2) }; @@ -191,12 +191,12 @@ namespace ArchiSteamFarm.Tests { public void SingleGameQuantityNeutralAccept() { HashSet inventory = new HashSet { CreateItem(1, 2), - CreateItem(2, 1) + CreateItem(2) }; HashSet itemsToGive = new HashSet { - CreateItem(1, 1), - CreateItem(2, 1) + CreateItem(1), + CreateItem(2) }; HashSet itemsToReceive = new HashSet { CreateItem(3, 2) }; @@ -207,12 +207,12 @@ namespace ArchiSteamFarm.Tests { [TestMethod] public void SingleGameSingleTypeBadReject() { HashSet inventory = new HashSet { - CreateItem(1, 1), - CreateItem(2, 1) + CreateItem(1), + CreateItem(2) }; - HashSet itemsToGive = new HashSet { CreateItem(1, 1) }; - HashSet itemsToReceive = new HashSet { CreateItem(2, 1) }; + HashSet itemsToGive = new HashSet { CreateItem(1) }; + HashSet itemsToReceive = new HashSet { CreateItem(2) }; Assert.IsFalse(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); } @@ -225,11 +225,11 @@ namespace ArchiSteamFarm.Tests { CreateItem(3, 2) }; - HashSet itemsToGive = new HashSet { CreateItem(2, 1) }; + HashSet itemsToGive = new HashSet { CreateItem(2) }; HashSet itemsToReceive = new HashSet { - CreateItem(1, 1), - CreateItem(3, 1) + CreateItem(1), + CreateItem(3) }; Assert.IsFalse(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -238,13 +238,13 @@ namespace ArchiSteamFarm.Tests { [TestMethod] public void SingleGameSingleTypeBigDifferenceAccept() { HashSet inventory = new HashSet { - CreateItem(1, 1), + CreateItem(1), CreateItem(2, 5), - CreateItem(3, 1) + CreateItem(3) }; - HashSet itemsToGive = new HashSet { CreateItem(2, 1) }; - HashSet itemsToReceive = new HashSet { CreateItem(3, 1) }; + HashSet itemsToGive = new HashSet { CreateItem(2) }; + HashSet itemsToReceive = new HashSet { CreateItem(3) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); } @@ -252,17 +252,17 @@ namespace ArchiSteamFarm.Tests { [TestMethod] public void SingleGameSingleTypeGoodAccept() { HashSet inventory = new HashSet { CreateItem(1, 2) }; - HashSet itemsToGive = new HashSet { CreateItem(1, 1) }; - HashSet itemsToReceive = new HashSet { CreateItem(2, 1) }; + HashSet itemsToGive = new HashSet { CreateItem(1) }; + HashSet itemsToReceive = new HashSet { CreateItem(2) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); } [TestMethod] public void SingleGameSingleTypeNeutralAccept() { - HashSet inventory = new HashSet { CreateItem(1, 1) }; - HashSet itemsToGive = new HashSet { CreateItem(1, 1) }; - HashSet itemsToReceive = new HashSet { CreateItem(2, 1) }; + HashSet inventory = new HashSet { CreateItem(1) }; + HashSet itemsToGive = new HashSet { CreateItem(1) }; + HashSet itemsToReceive = new HashSet { CreateItem(2) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); } @@ -274,11 +274,11 @@ namespace ArchiSteamFarm.Tests { CreateItem(2, 2) }; - HashSet itemsToGive = new HashSet { CreateItem(2, 1) }; + HashSet itemsToGive = new HashSet { CreateItem(2) }; HashSet itemsToReceive = new HashSet { - CreateItem(1, 1), - CreateItem(3, 1) + CreateItem(1), + CreateItem(3) }; Assert.IsTrue(AcceptsTrade(inventory, itemsToGive, itemsToReceive)); @@ -295,6 +295,6 @@ namespace ArchiSteamFarm.Tests { return (bool) method.Invoke(null, new object[] { inventory, itemsToGive, itemsToReceive }); } - private static Steam.Asset CreateItem(ulong classID, uint amount, uint realAppID = Steam.Asset.SteamAppID, Steam.Asset.EType type = Steam.Asset.EType.TradingCard) => new Steam.Asset(Steam.Asset.SteamAppID, Steam.Asset.SteamCommunityContextID, classID, amount, realAppID, type); + private static Steam.Asset CreateItem(ulong classID, uint amount = 1, uint realAppID = Steam.Asset.SteamAppID, Steam.Asset.EType type = Steam.Asset.EType.TradingCard) => new Steam.Asset(Steam.Asset.SteamAppID, Steam.Asset.SteamCommunityContextID, classID, amount, realAppID, type); } }