From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Sun, 18 May 2025 04:07:00 +0000 (+0300) Subject: Improve TryAllReactionsTest (#35356) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=5590d73adc483a24a813582feff0c753f8c501a8;p=space-station-14.git Improve TryAllReactionsTest (#35356) * Update TryAllReactionsTest.cs * mix categories * Update TryAllReactionsTest.cs --- diff --git a/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs b/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs index 3664cda922..6d860f0ac3 100644 --- a/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs +++ b/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs @@ -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() + .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)