/
krasninja
/
querycat
Обзор
Документация
Войти
/
krasninja
/
querycat
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/QueryCat.IntegrationTests/Execution/ExecutionThreadTests.cs
58 строк
1 KB
Ivan Kozhin
Move JSON functions into Addon project
27 янв 2024, 11:40
27 янв 2024, 11:40
3bf527f
Код
Авторство
О чём код?
using Xunit; using QueryCat.Backend.Core.Types; using QueryCat.Backend.Execution; using QueryCat.Backend.Addons.Formatters; using QueryCat.Tests.QueryRunner; namespace QueryCat.IntegrationTests.Execution; /// <summary> /// Tests for <see cref="ExecutionThread" />. /// </summary> public class ExecutionThreadTests { private readonly ExecutionThread _testThread; public ExecutionThreadTests() { _testThread = TestThread.CreateBootstrapper() .WithRegistrations(AdditionalRegistration.Register) .Create(); } [Fact] public void Run_WithParameters_ShouldProcess() { // Arrange. _testThread.TopScope.Variables["param1"] = new(11); var @params = new Dictionary<string, VariantValue> { ["param2"] = new(24), ["param3"] = new(42), }; // Act. var result = _testThread.Run("param1 + param2 + param3;", @params); // Assert. Assert.Equal(77, result.AsInteger); Assert.False(_testThread.TopScope.Variables.ContainsKey("param2")); } [Fact] public void Run_WithParameterNestedScope_TopScopeShouldOverride() { // Arrange. _testThread.TopScope.Variables["param1"] = new(2023); var @params = new Dictionary<string, VariantValue> { ["param1"] = new(2024), }; // Act. var result = _testThread.Run("param1;", @params); // Assert. Assert.Equal(2024, result.AsInteger); } }