public void GetFunctionForInvalidFunctionTest() { var functionRepository = FunctionRepository.Create(); var function = functionRepository.GetFunction("NOTAFUNCTION"); Assert.IsNull(function); }
public void GetFunctionTest() { var functionRepository = FunctionRepository.Create(); var function = functionRepository.GetFunction("ABS"); Assert.IsNotNull(function); Assert.IsTrue(function is Abs); }
public void GetFunctionWithXlfnPrefix() { var functionRepository = FunctionRepository.Create(); var function = functionRepository.GetFunction("_xlfn.IF"); Assert.IsNotNull(function); Assert.IsTrue(function is If); }
public void CreateHandlesErrorFunctionCompiler() { var functionRepository = FunctionRepository.Create(); var functionCompilerFactory = new FunctionCompilerFactory(functionRepository, _context); var function = new IsError(); var functionCompiler = functionCompilerFactory.Create(function); Assert.IsInstanceOfType(functionCompiler, typeof(ErrorHandlingFunctionCompiler)); }
public void CreateHandlesLookupFunctionCompiler() { var functionRepository = FunctionRepository.Create(); var functionCompilerFactory = new FunctionCompilerFactory(functionRepository, _context); var function = new Column(); var functionCompiler = functionCompilerFactory.Create(function); Assert.IsInstanceOfType(functionCompiler, typeof(LookupFunctionCompiler)); }
public void CreateHandlesSpecialIfNaCompiler() { var functionRepository = FunctionRepository.Create(); var functionCompilerFactory = new FunctionCompilerFactory(functionRepository, _context); var function = new IfNa(); var functionCompiler = functionCompilerFactory.Create(function); Assert.IsInstanceOfType(functionCompiler, typeof(IfNaFunctionCompiler)); }
public void CreateHandlesStandardFunctionCompiler() { var functionRepository = FunctionRepository.Create(); var functionCompilerFactory = new FunctionCompilerFactory(functionRepository, _context); var function = new Sum(); var functionCompiler = functionCompilerFactory.Create(function); Assert.IsInstanceOfType(functionCompiler, typeof(DefaultCompiler)); }
public void CreateHandlesCustomFunctionCompiler() { var functionRepository = FunctionRepository.Create(); functionRepository.LoadModule(new TestFunctionModule(_context)); var functionCompilerFactory = new FunctionCompilerFactory(functionRepository, _context); var function = new MyFunction(); var functionCompiler = functionCompilerFactory.Create(function); Assert.IsInstanceOfType(functionCompiler, typeof(MyFunctionCompiler)); }
public void LoadModulePopulatesFunctionsAndCustomCompilers() { var functionRepository = FunctionRepository.Create(); Assert.IsFalse(functionRepository.IsFunctionName(MyFunction.Name)); Assert.IsFalse(functionRepository.CustomCompilers.ContainsKey(typeof(MyFunction))); functionRepository.LoadModule(new TestFunctionModule()); Assert.IsTrue(functionRepository.IsFunctionName(MyFunction.Name)); Assert.IsTrue(functionRepository.CustomCompilers.ContainsKey(typeof(MyFunction))); // Make sure reloading the module overwrites previous functions and compilers functionRepository.LoadModule(new TestFunctionModule()); }
private ParsingConfiguration() { FunctionRepository = FunctionRepository.Create(); }