2018-11-21 13:49:59 +00:00
|
|
|
using System.Collections.Generic;
|
2018-11-26 15:55:10 +00:00
|
|
|
using Upsilon;
|
2018-11-21 13:49:59 +00:00
|
|
|
using Upsilon.Evaluator;
|
|
|
|
using Xunit;
|
|
|
|
|
2018-11-23 13:38:45 +00:00
|
|
|
namespace UpsilonTests.GeneralTests
|
2018-11-21 13:49:59 +00:00
|
|
|
{
|
2018-11-23 11:55:28 +00:00
|
|
|
public class UserDataDictionaryTests : TestClass
|
2018-11-21 13:49:59 +00:00
|
|
|
{
|
|
|
|
[Fact]
|
|
|
|
public void BasicStringKeyed()
|
|
|
|
{
|
|
|
|
var arr = new Dictionary<string, int>
|
|
|
|
{
|
|
|
|
{"test", 100},
|
|
|
|
{"1234", 90},
|
|
|
|
{"here", 1683},
|
|
|
|
};
|
|
|
|
const string input = @"
|
|
|
|
function getValue(arr)
|
|
|
|
return arr[""here""]
|
|
|
|
end
|
|
|
|
";
|
2018-11-26 16:23:56 +00:00
|
|
|
var evaluated = Executor.EvaluateFunction<long>(input, "getValue", new[] {arr}, Options);
|
2018-11-21 13:49:59 +00:00
|
|
|
Assert.Equal(1683, evaluated);
|
|
|
|
}
|
|
|
|
|
2018-11-23 11:55:28 +00:00
|
|
|
public UserDataDictionaryTests(StaticScriptFixture fix) : base(fix)
|
|
|
|
{
|
|
|
|
}
|
2018-11-21 13:49:59 +00:00
|
|
|
}
|
|
|
|
}
|