]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Improve TryAllReactionsTest (#35356)
authorEd <96445749+TheShuEd@users.noreply.github.com>
Sun, 18 May 2025 04:07:00 +0000 (07:07 +0300)
committerGitHub <noreply@github.com>
Sun, 18 May 2025 04:07:00 +0000 (14:07 +1000)
* Update TryAllReactionsTest.cs

* mix categories

* Update TryAllReactionsTest.cs

Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs

index 3664cda922a5278d02fe2267b1c137bfcd26aa71..6d860f0ac38aa6a533554936337b46c25b616222 100644 (file)
@@ -59,6 +59,30 @@ namespace Content.IntegrationTests.Tests.Chemistry
 #pragma warning restore NUnit2045
                     }
 
+                    //Get all possible reactions with the current reagents
+                    var possibleReactions = prototypeManager.EnumeratePrototypes<ReactionPrototype>()
+                        .Where(x => x.Reactants.All(id => solution.Contents.Any(s => s.Reagent.Prototype == id.Key)))
+                        .ToList();
+
+                    //Check if the reaction is the first to occur when heated
+                    foreach (var possibleReaction in possibleReactions.OrderBy(r => r.MinimumTemperature))
+                    {
+                        if (possibleReaction.MinimumTemperature < reactionPrototype.MinimumTemperature && possibleReaction.MixingCategories == reactionPrototype.MixingCategories)
+                        {
+                            Assert.Fail($"The {possibleReaction.ID} reaction may occur before {reactionPrototype.ID} when heated.");
+                        }
+                    }
+
+                    //Check if the reaction is the first to occur when freezing
+                    foreach (var possibleReaction in possibleReactions.OrderBy(r => r.MaximumTemperature))
+                    {
+                        if (possibleReaction.MaximumTemperature > reactionPrototype.MaximumTemperature && possibleReaction.MixingCategories == reactionPrototype.MixingCategories)
+                        {
+                            Assert.Fail($"The {possibleReaction.ID} reaction may occur before {reactionPrototype.ID} when freezing.");
+                        }
+                    }
+
+                    //Now safe set the temperature and mix the reagents
                     solutionContainerSystem.SetTemperature(solutionEnt.Value, reactionPrototype.MinimumTemperature);
 
                     if (reactionPrototype.MixingCategories != null)