Example #1
0
        private static void CheckVersion(Object[] attributes)
        {
            ApplicationVersion currentVersion = GetCurrentVersion();

            if (attributes.Length <= 0 || attributes.Contains(new Version(currentVersion)))
            {
                TestVersion = currentVersion;
            }
            else
            {
                Assert.Inconclusive("This test is not designed to be executed in the application version '" + currentVersion.ToString());
            }
        }
Example #2
0
        private static void CheckEnvironment(Object[] attributes)
        {
            TestEnvironment = GetCurrentEnvironment();

            if (attributes.Length > 0 && !attributes.Contains(new ExecutionEnvironment(TestEnvironment)))
            {
                Assert.Inconclusive("This test is not designed to be executed in the '" + TestEnvironment.ToString() + "' environment.");
            }
        }
Example #3
0
        private Lambda CompileExpression(Object[] values, string expressionTemplate, bool convertBack = false, List<Type> targetTypes = null)
        {
            try
            {
                Lambda res = null;

                var needCompile = false;
                // we can't determine value type if value is null
                // so, binding Path = (a == null) ? "a" : "b" is permitted
                if (convertBack)
                    needCompile = true;
                else
                    if (values.Contains(DependencyProperty.UnsetValue))
                    {
                        Trace.WriteLine("Binding error: one of source fields is Unset, return null");
                    }
                    else
                    {
                        needCompile = true;
                    }

                if (needCompile)
                {
                    var argumentsTypes = convertBack ? targetTypes : sourceValuesTypes.Select(t => t ?? typeof(Object)).ToList();
                    res = CompileExpression(argumentsTypes, expressionTemplate);
                }

                return res;
            }
            catch (Exception e)
            {
                Trace.WriteLine("Binding error: calc converter can't convert expression" + expressionTemplate + ": " + e.Message);
                return null;
            }
        }