Example #1
0
 /// <summary>
 /// Initializes a new instance of the EnumerableProxy class.
 /// </summary>
 /// <param name="wrapperScope">The wrapper scope.</param>
 /// <param name="underlyingImplementation">The underlying implementation of the proxy.</param>
 public EnumerableProxy(IWrapperScope wrapperScope, System.Collections.IEnumerable underlyingImplementation)
 {
     ExceptionUtilities.CheckArgumentNotNull(wrapperScope, "wrapperScope");
     ExceptionUtilities.CheckArgumentNotNull(underlyingImplementation, "underlyingImplementation");
     
     this.Scope = wrapperScope;
     this.underlyingImplementation = underlyingImplementation;
 }
Example #2
0
 /// <summary>
 /// Create a graph on the server of a data series
 /// </summary>
 /// <param name="dataSetX">IEnumerable horizontal series</param>
 /// <param name="dataSetY">IEnumberable vertical series</param>
 public Grapher(System.Collections.IEnumerable dataSetX, System.Collections.IEnumerable dataSetY)
 {
     this.dataSetX = dataSetX;
     this.dataSetY = dataSetY;
     if (!File.Exists(System.Web.Hosting.HostingEnvironment.MapPath(filePath)))
     {
         //TODO log any exceptions
         chart = new Chart(width: 600, height: 600);
         chart.AddSeries(chartType: "Line",
                 xValue: dataSetX,
                 yValues: dataSetY);
         chart.Save(filePathName, "png");
         //TODO solve file cleanup problem
     }
 }
 /// <summary>
 /// Assert that an array, list or other collection is ordered
 /// </summary>
 /// <param name="collection">An array, list or other collection implementing System.Collections.IEnumerable</param>
 /// <param name="comparer">A custom comparer to perform the comparisons</param>
 public static void IsOrdered(System.Collections.IEnumerable collection, System.Collections.IComparer comparer)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.IsOrdered(collection, comparer));
 }
 /// <summary>
 /// Assert that an array,list or other collection is empty
 /// </summary>
 /// <param name="collection">An array, list or other collection implementing System.Collections.IEnumerable</param>
 public static void IsNotEmpty(System.Collections.IEnumerable collection)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.IsNotEmpty(collection));
 }
 /// <summary>
 /// Asserts that all items contained in collection are not equal to null.
 /// </summary>
 /// <param name="collection">System.Collections.IEnumerable containing objects to be considered</param>
 public static void AllItemsAreNotNull(System.Collections.IEnumerable collection)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AllItemsAreNotNull(collection));
 }
 /// <summary>
 /// Asserts that the subset contains the superset.
 /// </summary>
 /// <param name="superset">The System.Collections.IEnumerable superset to be considered</param>
 /// <param name="subset">The System.Collections.IEnumerable subset to be considered</param>
 public static void IsSupersetOf(System.Collections.IEnumerable superset, System.Collections.IEnumerable subset)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.IsSupersetOf(superset, subset));
 }
		/// <summary>
		///     Enumerator constructor
		/// </summary>
		public AffixEntryEnumerator(AffixEntryCollection mappings) 
		{
			this.Local = ((System.Collections.IEnumerable)(mappings));
			this.Base = Local.GetEnumerator();
		}
 /// <summary>
 ///     Enumerator constructor
 /// </summary>
 public RecentFileEnumerator(RecentFileCollection recMappings)
 {
     this.iEnLocal = ((System.Collections.IEnumerable)(recMappings));
     this.iEnBase = iEnLocal.GetEnumerator();
 }
Example #9
0
 public void Dispose()
 {
     _enumerable = null;
     _hasNext = false;
     _iterator = null;
 }
 public void Single(System.Collections.IEnumerable collection, object expected)
 {
     Assert.Single(collection, expected);
 }
 public void Single(System.Collections.IEnumerable collection)
 {
     Assert.Single(collection);
 }
 public void NotEmpty(System.Collections.IEnumerable collection)
 {
     Assert.NotEmpty(collection);
 }
 /// <summary>
 /// Indica se a sequência é não nula e possui itens.
 /// </summary>
 /// <param name="instance"></param>
 /// <returns></returns>
 public static bool HasItems(this System.Collections.IEnumerable instance)
 {
     return((instance != null) && instance.GetEnumerator().MoveNext());
 }
 /// <summary>
 /// Verifica se a sequência é nula ou está vazia.
 /// </summary>
 /// <param name="instance"></param>
 /// <returns></returns>
 public static bool IsNullOrEmpty(this System.Collections.IEnumerable instance)
 {
     return((instance == null) || (!instance.GetEnumerator().MoveNext()));
 }
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="enumerable"></param>
 public Enumerable(System.Collections.IEnumerable enumerable)
 {
     _enumerable = enumerable;
 }
		/// <summary>
		///     Enumerator constructor
		/// </summary>
		public PhoneticRuleEnumerator(PhoneticRuleCollection mappings) 
		{
			this.Local = ((System.Collections.IEnumerable)(mappings));
			this.Base = Local.GetEnumerator();
		}
Example #17
0
 public override object CreateOutput(System.Collections.IEnumerable context)
 {
     throw new InvalidOperationException();
 }
 /// <summary>
 ///     Enumerator constructor
 /// </summary>
 public FormSettingsEnumerator(FormSettingsCollection forMappings)
 {
     this.iEnLocal = ((System.Collections.IEnumerable)(forMappings));
     this.iEnBase = iEnLocal.GetEnumerator();
 }
Example #19
0
        protected static string GetComparisonStatement(StandardProviderParameters std, esDynamicQuerySerializable query, List <esComparison> items, string prefix)
        {
            string sql   = String.Empty;
            string comma = String.Empty;
            bool   first = true;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            //=======================================
            // WHERE
            //=======================================
            if (items != null)
            {
                sql += prefix;

                string compareTo = String.Empty;
                foreach (esComparison comparisonItem in items)
                {
                    esComparison.esComparisonData comparisonData = (esComparison.esComparisonData)comparisonItem;
                    esDynamicQuerySerializable    subQuery       = null;

                    bool requiresParam        = true;
                    bool needsStringParameter = false;
                    std.needsStringParameter = false;

                    if (comparisonData.IsParenthesis)
                    {
                        if (comparisonData.Parenthesis == esParenthesis.Open)
                        {
                            sql += "(";
                        }
                        else
                        {
                            sql += ")";
                        }

                        continue;
                    }

                    if (comparisonData.IsConjunction)
                    {
                        switch (comparisonData.Conjunction)
                        {
                        case esConjunction.And: sql += " AND "; break;

                        case esConjunction.Or: sql += " OR "; break;

                        case esConjunction.AndNot: sql += " AND NOT "; break;

                        case esConjunction.OrNot: sql += " OR NOT "; break;
                        }
                        continue;
                    }

                    Dictionary <string, OracleParameter> types = null;
                    if (comparisonData.Column.Query != null)
                    {
                        IDynamicQuerySerializableInternal iLocalQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                        types = Cache.GetParameters(iLocalQuery.DataID, (esProviderSpecificMetadata)iLocalQuery.ProviderMetadata, (esColumnMetadataCollection)iLocalQuery.Columns);
                    }

                    if (comparisonData.IsLiteral)
                    {
                        if (comparisonData.Column.Name[0] == '<')
                        {
                            sql += comparisonData.Column.Name.Substring(1, comparisonData.Column.Name.Length - 2);
                        }
                        else
                        {
                            sql += comparisonData.Column.Name;
                        }
                        continue;
                    }

                    if (comparisonData.ComparisonColumn.Name == null)
                    {
                        subQuery = comparisonData.Value as esDynamicQuerySerializable;

                        if (subQuery == null)
                        {
                            if (comparisonData.Column.Name != null)
                            {
                                IDynamicQuerySerializableInternal iColQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                                esColumnMetadataCollection        columns   = (esColumnMetadataCollection)iColQuery.Columns;
                                compareTo = Delimiters.Param + columns[comparisonData.Column.Name].PropertyName + (++std.pindex).ToString();
                            }
                            else
                            {
                                compareTo = Delimiters.Param + "Expr" + (++std.pindex).ToString();
                            }
                        }
                        else
                        {
                            // It's a sub query
                            compareTo     = GetSubquerySearchCondition(subQuery) + " (" + BuildQuery(std, subQuery) + ") ";
                            requiresParam = false;
                        }
                    }
                    else
                    {
                        compareTo     = GetColumnName(comparisonData.ComparisonColumn);
                        requiresParam = false;
                    }

                    switch (comparisonData.Operand)
                    {
                    case esComparisonOperand.Exists:
                        sql += " EXISTS" + compareTo;
                        break;

                    case esComparisonOperand.NotExists:
                        sql += " NOT EXISTS" + compareTo;
                        break;

                    //-----------------------------------------------------------
                    // Comparison operators, left side vs right side
                    //-----------------------------------------------------------
                    case esComparisonOperand.Equal:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " = " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " = " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case esComparisonOperand.NotEqual:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " <> " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " <> " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case esComparisonOperand.GreaterThan:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " > " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " > " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case esComparisonOperand.LessThan:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " < " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " < " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case esComparisonOperand.LessThanOrEqual:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " <= " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " <= " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case esComparisonOperand.GreaterThanOrEqual:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " >= " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " >= " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case esComparisonOperand.Like:
                        string esc = comparisonData.LikeEscape.ToString();
                        if (String.IsNullOrEmpty(esc) || esc == "\0")
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " LIKE " + compareTo;
                            needsStringParameter = true;
                        }
                        else
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " LIKE " + compareTo;
                            sql += " ESCAPE '" + esc + "'";
                            needsStringParameter = true;
                        }
                        break;

                    case esComparisonOperand.NotLike:
                        esc = comparisonData.LikeEscape.ToString();
                        if (String.IsNullOrEmpty(esc) || esc == "\0")
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " NOT LIKE " + compareTo;
                            needsStringParameter = true;
                        }
                        else
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " NOT LIKE " + compareTo;
                            sql += " ESCAPE '" + esc + "'";
                            needsStringParameter = true;
                        }
                        break;

                    case esComparisonOperand.Contains:
                        sql += " CONTAINS(" + GetColumnName(comparisonData.Column) +
                               ", " + compareTo + ")";
                        needsStringParameter = true;
                        break;

                    case esComparisonOperand.IsNull:
                        sql          += ApplyWhereSubOperations(std, query, comparisonData) + " IS NULL";
                        requiresParam = false;
                        break;

                    case esComparisonOperand.IsNotNull:
                        sql          += ApplyWhereSubOperations(std, query, comparisonData) + " IS NOT NULL";
                        requiresParam = false;
                        break;

                    case esComparisonOperand.In:
                    case esComparisonOperand.NotIn:
                    {
                        if (subQuery != null)
                        {
                            // They used a subquery for In or Not
                            sql += ApplyWhereSubOperations(std, query, comparisonData);
                            sql += (comparisonData.Operand == esComparisonOperand.In) ? " IN" : " NOT IN";
                            sql += compareTo;
                        }
                        else
                        {
                            comma = String.Empty;
                            if (comparisonData.Operand == esComparisonOperand.In)
                            {
                                sql += ApplyWhereSubOperations(std, query, comparisonData) + " IN (";
                            }
                            else
                            {
                                sql += ApplyWhereSubOperations(std, query, comparisonData) + " NOT IN (";
                            }

                            foreach (object oin in comparisonData.Values)
                            {
                                string str = oin as string;
                                if (str != null)
                                {
                                    // STRING
                                    sql  += comma + "'" + str + "'";
                                    comma = ",";
                                }
                                else if (null != oin as System.Collections.IEnumerable)
                                {
                                    // LIST OR COLLECTION OF SOME SORT
                                    System.Collections.IEnumerable enumer = oin as System.Collections.IEnumerable;
                                    if (enumer != null)
                                    {
                                        System.Collections.IEnumerator iter = enumer.GetEnumerator();

                                        while (iter.MoveNext())
                                        {
                                            object o = iter.Current;

                                            string soin = o as string;

                                            if (soin != null)
                                            {
                                                sql += comma + "'" + soin + "'";
                                            }
                                            else
                                            {
                                                sql += comma + Convert.ToString(o);
                                            }

                                            comma = ",";
                                        }
                                    }
                                }
                                else
                                {
                                    // NON STRING OR LIST
                                    sql  += comma + Convert.ToString(oin);
                                    comma = ",";
                                }
                            }
                            sql          += ") ";
                            requiresParam = false;
                        }
                    }
                    break;

                    case esComparisonOperand.Between:

                        OracleCommand sqlCommand = std.cmd as OracleCommand;
                        sqlCommand.BindByName = true;

                        sql += ApplyWhereSubOperations(std, query, comparisonData) + " BETWEEN ";
                        sql += compareTo;
                        if (comparisonData.ComparisonColumn.Name == null)
                        {
                            OracleParameter p = new OracleParameter(compareTo, comparisonData.BetweenBegin);
                            sqlCommand.Parameters.Add(p);
                        }

                        if (comparisonData.ComparisonColumn2.Name == null)
                        {
                            IDynamicQuerySerializableInternal iColQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                            esColumnMetadataCollection        columns   = (esColumnMetadataCollection)iColQuery.Columns;
                            compareTo = Delimiters.Param + columns[comparisonData.Column.Name].PropertyName + (++std.pindex).ToString();

                            sql += " AND " + compareTo;
                            OracleParameter p = new OracleParameter(compareTo, comparisonData.BetweenEnd);
                            sqlCommand.Parameters.Add(p);
                        }
                        else
                        {
                            sql += " AND " + Delimiters.ColumnOpen + comparisonData.ComparisonColumn2 + Delimiters.ColumnClose;
                        }

                        requiresParam = false;
                        break;
                    }

                    if (requiresParam)
                    {
                        OracleParameter p;

                        if (comparisonData.Column.Name != null)
                        {
                            p = types[comparisonData.Column.Name];

                            p = Cache.CloneParameter(p);
                            p.ParameterName = compareTo;
                            p.Value         = comparisonData.Value;
                            if (needsStringParameter)
                            {
                                p.DbType = DbType.String;
                            }
                            else if (std.needsIntegerParameter)
                            {
                                p.DbType = DbType.Int32;
                            }
                        }
                        else
                        {
                            p = new OracleParameter(compareTo, comparisonData.Value);
                        }

                        std.cmd.Parameters.Add(p);
                    }

                    first = false;
                }
            }

            // Kind of a hack here, I should probably pull this out and put it in build query ... and do it only for the WHERE
            if (query.es.Top >= 0 && prefix == " WHERE ")
            {
                if (!first)
                {
                    sql += " AND ";
                }
                else
                {
                    sql += " WHERE ";
                }
                sql += "ROWNUM <= " + query.es.Top.ToString();
            }

            return(sql);
        }
Example #20
0
 internal StringEnumerator(StringCollection mappings)
 {
     _temp = (IEnumerable)(mappings);
     _baseEnumerator = _temp.GetEnumerator();
 }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override int CreateChildControls(System.Collections.IEnumerable dataSource, bool dataBinding)
        {
            int pos = 0;

            if (dataBinding)
            {
                //Instantiate the Header template (if exists)
                if (m_headerTemplate != null)
                {
                    Control headerItem = new Control();
                    m_headerTemplate.InstantiateIn(headerItem);
                    Controls.Add(headerItem);
                }
                if (dataSource != null)
                {
                    foreach (object o in dataSource)
                    {
                        EmployeeDB.BLL.EmployeeSkills entity    = o as EmployeeDB.BLL.EmployeeSkills;
                        EmployeeSkillsItem            container = new EmployeeSkillsItem(entity);

                        if (m_itemTemplate != null && (pos % 2) == 0)
                        {
                            m_itemTemplate.InstantiateIn(container);

                            if (m_seperatorTemplate != null)
                            {
                                m_seperatorTemplate.InstantiateIn(container);
                            }
                        }
                        else
                        {
                            if (m_altenateItemTemplate != null)
                            {
                                m_altenateItemTemplate.InstantiateIn(container);

                                if (m_seperatorTemplate != null)
                                {
                                    m_seperatorTemplate.InstantiateIn(container);
                                }
                            }
                            else if (m_itemTemplate != null)
                            {
                                m_itemTemplate.InstantiateIn(container);

                                if (m_seperatorTemplate != null)
                                {
                                    m_seperatorTemplate.InstantiateIn(container);
                                }
                            }
                            else
                            {
                                // no template !!!
                            }
                        }
                        Controls.Add(container);

                        container.DataBind();

                        pos++;
                    }
                }
                //Instantiate the Footer template (if exists)
                if (m_footerTemplate != null)
                {
                    Control footerItem = new Control();
                    m_footerTemplate.InstantiateIn(footerItem);
                    Controls.Add(footerItem);
                }
            }

            return(pos);
        }
Example #22
0
 public static void SetItems(this ItemsControl itemsControl, System.Collections.IEnumerable enumerable) =>
 itemsControl.Items = enumerable;
Example #23
0
 public static string ToStringList(System.Collections.IEnumerable names)
 {
     return(Builtins.join(names.Cast <object>().Select(o => DisplayStringFor(o)).OrderBy(_ => _), ", "));
 }
 /// <summary>
 /// Asserts that the subset contains the superset.
 /// </summary>
 /// <param name="superset">The System.Collections.IEnumerable superset to be considered</param>
 /// <param name="subset">The System.Collections.IEnumerable subset to be considered</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void IsSupersetOf(System.Collections.IEnumerable superset, System.Collections.IEnumerable subset, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.IsSupersetOf(superset, subset, message, args));
 }
        public System.Collections.ICollection GetHistory(string szFile)
        {
            VersionControlServer sourceControl;

            GetPathAndScope(szFile, out sourceControl);

            // Retrieve and print the label history for the file.
            VersionControlLabel[]  labels = null;
            ChangeSetLabelObject[] ChangesetLabelObjects = new ChangeSetLabelObject[10000];
            Item targetFile = null;

            System.Collections.IEnumerable history = null;
            System.Collections.SortedList  slChangeSetsAndLabels = new System.Collections.SortedList();
            System.Collections.SortedList  slChangeSets          = new System.Collections.SortedList();

            try
            {
                targetFile = sourceControl.GetItem(szFile);

                //Query labels seems to return labels that correspond to the file and nothing filtered related the version spec
                //So we need to query everything and then filter ourselves.
                //Hint: The there is a TimeSpan here because doing that is slow.
                DateTime dtStart = DateTime.Now;
                labels = sourceControl.QueryLabels(null, szFile, null, true, szFile, VersionSpec.Latest);
                TimeSpan tsQueryLabels = DateTime.Now - dtStart;

                history = sourceControl.QueryHistory(szFile,
                                                     VersionSpec.Latest,
                                                     0,
                                                     RecursionType.Full,
                                                     null,
                                                     null,
                                                     null,
                                                     10000,
                                                     true,
                                                     false);
                TimeSpan tsAnotherTimeSpan = DateTime.Now - dtStart;
            }
            catch (TeamFoundationServerException e)
            {
                // We couldn't contact the server, the item wasn't found,
                // or there was some other problem reported by the server,
                // so we stop here.
                System.Windows.Forms.MessageBox.Show(e.Message);
                return(slChangeSets.Values);
            }

            if (labels.Length == 0)
            {
                Console.WriteLine("There are no labels for " + szFile);
                return(slChangeSets.Values);
            }
            else
            {
                //first, sort all the changesets into a list
                foreach (Changeset c in history)
                {
                    ChangeSetLabels csl = new ChangeSetLabels();
                    csl.m_csChangeset                     = c;
                    slChangeSets[c.ChangesetId]           = csl;
                    slChangeSetsAndLabels[c.CreationDate] = c;
                }

                foreach (VersionControlLabel l in labels)
                {
                    slChangeSetsAndLabels[l.LastModifiedDate] = l;
                }
            }
            return(slChangeSetsAndLabels.Values);
        }
 /// <summary>
 /// Assert that an array, list or other collection is empty
 /// </summary>
 /// <param name="collection">An array, list or other collection implementing System.Collections.IEnumerable</param>
 /// <param name="message">The message to be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void IsNotEmpty(System.Collections.IEnumerable collection, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.IsNotEmpty(collection, message, args));
 }
 public override System.Web.Caching.CacheDependency GetCacheDependency(string virtualPath, System.Collections.IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     return(base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart));
 }
 /// <summary>
 /// Assert that an array, list or other collection is ordered
 /// </summary>
 /// <param name="collection">An array, list or other collection implementing System.Collections.IEnumerable</param>
 /// <param name="comparer">A custom comparer to perform the comparisons</param>
 /// <param name="message">The message to be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void IsOrdered(System.Collections.IEnumerable collection, System.Collections.IComparer comparer, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.IsOrdered(collection, comparer, message, args));
 }
 public override string GetFileHash(string virtualPath, System.Collections.IEnumerable virtualPathDependencies)
 {
     return(base.GetFileHash(virtualPath, virtualPathDependencies));
 }
 /// <summary>
 /// Asserts that expected and actual are exactly equal.  The collections must have the same count,
 /// and contain the exact same objects in the same order.
 /// If comparer is not null then it will be used to compare the objects.
 /// </summary>
 /// <param name="expected">The first System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="actual">The second System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="comparer">The System.Collections.IComparer to use in comparing objects from each System.Collections.IEnumerable</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void AreEqual(System.Collections.IEnumerable expected, System.Collections.IEnumerable actual, System.Collections.IComparer comparer, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AreEqual(expected, actual, comparer, message, args));
 }
 /// <summary>
 /// Asserts that all items contained in collection are of the type specified by expectedType.
 /// </summary>
 /// <param name="collection">System.Collections.IEnumerable containing objects to be considered</param>
 /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>
 public static void AllItemsAreInstancesOfType(System.Collections.IEnumerable collection, System.Type expectedType)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(collection, expectedType));
 }
Example #32
0
 /// <summary>
 /// Disposes the wrapped instance if it implements IDisposable.
 /// </summary>
 /// <param name="disposing">Whether or not to dispose managed resources</param>
 protected virtual void Dispose(bool disposing)
 {
     CallOrderUtilities.TryWrapArbitraryMethodCall(
         () => this.Dispose(),
         () =>
             {
                 var d = this.underlyingImplementation as IDisposable;
                 if (d != null)
                 {
                     d.Dispose();
                     this.underlyingImplementation = null;
                 }
             });
 }
 /// <summary>
 /// Asserts that expected and actual are not exactly equal.
 /// If comparer is not null then it will be used to compare the objects.
 /// </summary>
 /// <param name="expected">The first System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="actual">The second System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="comparer">The System.Collections.IComparer to use in comparing objects from each System.Collections.IEnumerable</param>
 public static void AreNotEqual(System.Collections.IEnumerable expected, System.Collections.IEnumerable actual, System.Collections.IComparer comparer)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AreNotEqual(expected, actual, comparer));
 }
Example #34
0
 public Iterator( IEnumerable enumerable )
 {
     _enumerable = enumerable;
     _iterator = enumerable.GetEnumerator();
     _hasNext = _iterator.MoveNext();
 }
 /// <summary>
 /// Asserts that expected and actual are not equivalent.
 /// </summary>
 /// <param name="expected">The first System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="actual">The second System.Collections.IEnumerable of objects to be considered</param>
 public static void AreNotEquivalent(System.Collections.IEnumerable expected, System.Collections.IEnumerable actual)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AreNotEquivalent(expected, actual));
 }
Example #36
0
		private void graphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args)
		{
			mouseIsOver = true;
			Graphic graphic = args.Graphic;
			if (currentFeature != graphic) //Mouse entered a new feature
			{
				this.expanded = false;
				currentFeature = graphic;
				Point p = args.GetPosition(Parent as UIElement);
				SetValue(Canvas.LeftProperty, p.X + HorizontalOffset);
				SetValue(Canvas.TopProperty, p.Y + VerticalOffset);
				this.DataContext = this.ItemsSource = graphic.Attributes;
				if (!string.IsNullOrEmpty(TitleMember))
				{
					object title = null;
					if (graphic.Attributes.ContainsKey(TitleMember))
						title = string.Format("{0}", graphic.Attributes[TitleMember]);
					else
					{
						string firstKey = null;
						foreach (string key in graphic.Attributes.Keys)
						{
							if (firstKey == null) firstKey = key;
							if (graphic.Attributes[key].GetType() == typeof(string))
							{
								title = graphic.Attributes[key] as string;
								break;
							}
						}
						if (title == null && !string.IsNullOrEmpty(firstKey))
							title = string.Format("{0}", graphic.Attributes[firstKey]);
					}
					this.Title = title;
				}
				ChangeVisualState(false);
				Visibility = Visibility.Collapsed;
			}
			if (Visibility == Visibility.Collapsed)
			{
				timer.Start(); //Delay showing maptip 
			}
		}
 /// <summary>
 /// Asserts that expected and actual are not equivalent.
 /// </summary>
 /// <param name="expected">The first System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="actual">The second System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void AreNotEquivalent(System.Collections.IEnumerable expected, System.Collections.IEnumerable actual, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AreNotEquivalent(expected, actual, message, args));
 }
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlSchemaCompletionDataEnumerator'/>.
 /// </summary>
 public XmlSchemaCompletionDataEnumerator(XmlSchemaCompletionDataCollection mappings)
 {
     this.temp = ((System.Collections.IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }
 /// <summary>
 /// Asserts that collection does not contain actual as an item.
 /// </summary>
 /// <param name="collection">System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="actual">Object that cannot exist within collection</param>
 public static void DoesNotContain(System.Collections.IEnumerable collection, object actual)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.DoesNotContain(collection, actual));
 }
        protected override void RenderEnumerable(StringBuilder builder, VariableReference variable, IEnumerable variableValue, bool first)
        {
            bool firstElement = true;
            foreach (object value in variableValue)
            {
                if (value == null)
                    continue;

                RenderElement(builder, variable, value, first, firstElement);
                firstElement = false;
            }
        }
 /// <summary>
 /// Asserts that collection does not contain actual as an item.
 /// </summary>
 /// <param name="collection">System.Collections.IEnumerable of objects to be considered</param>
 /// <param name="actual">Object that cannot exist within collection</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void DoesNotContain(System.Collections.IEnumerable collection, object actual, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.DoesNotContain(collection, actual, message, args));
 }
Example #42
0
        private void CreatePermutaionList(string[] pStratvarList)
        {
            int i = 0;
            Frequency.SelectClauses = new List<string>();

            if (pStratvarList != null)
            {
                List<DataRow> Rows = this.Context.GetDataRows(null);

                foreach (string StratVar in pStratvarList)
                {
                    Frequency.PermutationList.Add(StratVar, new List<object>());
                }

                foreach (DataRow R in Rows)
                {
                    foreach (string StratVar in pStratvarList)
                    {
                        bool isFound = false;
                        for (i = 0; i < Frequency.PermutationList[StratVar].Count; i++)
                        {
                            if (CompareEqual(Frequency.PermutationList[StratVar][i], R[StratVar]))
                            {
                                isFound = true;
                                break;
                            }
                        }

                        if (!isFound)
                        {
                            Frequency.PermutationList[StratVar].Add(R[StratVar]);
                        }
                    }
                }

                EnumerablePermuter_Freq EP = new EnumerablePermuter_Freq(this.Context.Columns, EnumerablePermuter_Freq.RunModeEnum.SelectClauses, ref this.StratvarList, ref Frequency.SelectClauses);

                System.Collections.IEnumerable[] PL = new System.Collections.IEnumerable[Frequency.PermutationList.Count];
                i = 0;
                foreach (KeyValuePair<string, List<object>> Key in Frequency.PermutationList)
                {
                    PL[i++] = Key.Value;
                }

                EP.VisitAll(PL);
            }

            if (Frequency.SelectClauses.Count == 0)
            {
                Frequency.SelectClauses.Add("");
            }
        }
 /// <summary>
 /// Asserts that all items contained in collection are of the type specified by expectedType.
 /// </summary>
 /// <param name="collection">System.Collections.IEnumerable containing objects to be considered</param>
 /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void AllItemsAreInstancesOfType(System.Collections.IEnumerable collection, System.Type expectedType, string message, params object[] args)
 {
     Assert.Multiple(() => NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(collection, expectedType, message, args));
 }
Example #44
0
 public TreeListAdapter(System.Collections.IEnumerable list)
 {
     _list = list;
 }
Example #45
0
        /// <summary>
        /// 转换表达式
        /// </summary>
        /// <param name="expression">表达式</param>
        /// <param name="isIn"></param>
        private void convertCall(MethodCallExpression expression, bool isIn)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <Expression> arguments = expression.Arguments;
            System.Collections.IEnumerable values = (System.Collections.IEnumerable)arguments[1].GetConstant();
            if (values != null)
            {
                LeftArray <object> array = new LeftArray <object>();
                foreach (object value in values)
                {
                    array.Add(value);
                }
                switch (array.Length)
                {
                case 0: break;

                case 1:
                    Expression leftExpression = arguments[0];
                    if (array[0] == null)
                    {
                        convertIsSimple(leftExpression);
                        SqlStream.SimpleWriteNotNull(isIn ? " is null" : " is not null");
                    }
                    else
                    {
                        convertIsSimple(leftExpression);
                        if (isIn)
                        {
                            SqlStream.Write('=');
                        }
                        else
                        {
                            SqlStream.Write('<');
                            SqlStream.Write('>');
                        }
                        convertConstant(array[0]);
                    }
                    return;

                default:
                    Convert(arguments[0]);
                    SqlStream.SimpleWriteNotNull(isIn ? " In(" : " Not In(");
                    Action <CharStream, object> toString = ConstantConverter[array[0].GetType()];
                    int index = 0;
                    if (toString == null)
                    {
                        foreach (object value in array)
                        {
                            if (index == 0)
                            {
                                index = 1;
                            }
                            else
                            {
                                SqlStream.Write(',');
                            }
                            ConstantConverter.Convert(SqlStream, value.ToString());
                        }
                    }
                    else
                    {
                        foreach (object value in array)
                        {
                            if (index == 0)
                            {
                                index = 1;
                            }
                            else
                            {
                                SqlStream.Write(',');
                            }
                            toString(SqlStream, value);
                        }
                    }
                    SqlStream.Write(')');
                    return;
                }
            }
            SqlStream.SimpleWriteNotNull(isIn ? "(1=0)" : "(1=1)");
        }