コード例 #1
0
ファイル: VersionMonitor.cs プロジェクト: teknologika/stax
        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());
            }
        }
コード例 #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.");
            }
        }
コード例 #3
0
ファイル: CalcConverter.cs プロジェクト: WELL-E/CalcBinding
        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;
            }
        }