当前位置: 首页>>代码示例>>C#>>正文


C# ISpecification.IsSatisfiedBy方法代码示例

本文整理汇总了C#中ISpecification.IsSatisfiedBy方法的典型用法代码示例。如果您正苦于以下问题:C# ISpecification.IsSatisfiedBy方法的具体用法?C# ISpecification.IsSatisfiedBy怎么用?C# ISpecification.IsSatisfiedBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISpecification的用法示例。


在下文中一共展示了ISpecification.IsSatisfiedBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateResponseForSingleFileByCriteria

        /// <summary>
        /// Create a response for single file by criteria.
        /// </summary>
        /// <param name="file">
        /// The file.
        /// </param>
        /// <param name="criteria">
        /// The criteria.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        protected internal virtual object CreateResponseForSingleFileByCriteria(object file, ISpecification<File> criteria)
        {
            long count = this.Repository.Count(criteria.IsSatisfiedBy());
            this.InsertRangeInResponse(count);
            if (count == 0)
            {
                return this.FileNotFound(file);
            }

            return count > 1 ? this.TooManyFiles(file) : this.Repository.GetSingle(criteria.IsSatisfiedBy());
        }
开发者ID:AbrahamAlcaina,项目名称:ECM,代码行数:23,代码来源:FileServiceBase.cs

示例2: FindNeighbours

        /// <summary>
        /// Finds the number of neighbours of a given cell that meet the passed in specification.
        /// </summary>
        /// <param name="cell">Cell whose neighbours have to be found.</param>
        /// <param name="specification">The specification that should be met by the neighbouring cells.</param>
        /// <returns>Returns the collection of cells that meet the passed in specification.</returns>
        public ICollection<Cell> FindNeighbours(Cell cell, ISpecification<Cell> specification)
        {
            List<Cell> cells = new List<Cell>();
            if (cell == null)
            {
                throw new ArgumentNullException(paramName:"Cell");
            }

            int column = cell.ColumnNumber;
            int row = cell.RowNumber;
            int startrow;
            int startcol;
            int endcol;
            int endrow;
            GetValidStartRowAndColumn(row, column, out startrow, out startcol);
            GetValidEndRowAndColumn(row, column, out endrow, out endcol);

            for (int xcoord = startrow; xcoord <= endrow; xcoord++)
            {
                for (int ycoord = startcol; ycoord <= endcol; ycoord++)
                {
                    if (!(xcoord == row && ycoord == column))
                    {
                        if (specification == null)
                            cells.Add(grid[xcoord, ycoord]);
                        else
                            if(specification.IsSatisfiedBy(grid[xcoord, ycoord]))
                                cells.Add(grid[xcoord, ycoord]);
                    }
                }
            }
            return cells;
        }
开发者ID:narunaram,项目名称:GameOfLife,代码行数:39,代码来源:BasicTwoDimensionalNeighbourCellRule.cs

示例3: IsSatisfiedByFalse

 /// <summary>
 /// 
 /// </summary>
 /// <param name="specification"></param>
 /// <param name="item"></param>
 /// <param name="reason"></param>
 public static void IsSatisfiedByFalse(ISpecification<string> specification, string item, string reason)
 {
     Assert.IsNotNull(specification);
     Assert.IsFalse(specification.IsSatisfiedBy(item));
     Assert.AreEqual(specification.ReasonsForDissatisfaction.Count(), 1);
     Assert.AreEqual(specification.ReasonsForDissatisfaction.Single(), reason);
 }
开发者ID:marfman,项目名称:y-tunnus,代码行数:13,代码来源:BusinessIdentifierSpecificationAssert.cs

示例4: By

 public IEnumerable<Product> By(IList<Product> products, ISpecification specification)
 {
     foreach (var product in products)
     {
         if (specification.IsSatisfiedBy(product))
             yield return product;
     }
 }
开发者ID:mumer92,项目名称:Design-Patterns,代码行数:8,代码来源:ProductFilter.cs

示例5: Satisfies

        public static bool Satisfies(this IDomainObject domainObject, ISpecification specification)
        {
            if (specification == null) throw new ArgumentNullException("specification");

            return specification.IsSatisfiedBy(domainObject);
        }
开发者ID:Kostassoid,项目名称:Taijutsu,代码行数:6,代码来源:DomainObjectEx.cs

示例6: GetBySpecification

 public virtual IEnumerable<Person> GetBySpecification(ISpecification<Person> specification)
 {
     return Persons.Where(x => specification.IsSatisfiedBy(x));
 }
开发者ID:gergelykoncz,项目名称:Patterns.Specification,代码行数:4,代码来源:PersonRepository.cs

示例7: CreateResponseForFilesByCriteria

 /// <summary>
 /// The create response for files by criteria.
 /// </summary>
 /// <param name="file">
 /// The file.
 /// </param>
 /// <param name="criteria">
 /// The criteria.
 /// </param>
 /// <returns>
 /// The <see cref="object"/>.
 /// </returns>
 protected virtual object CreateResponseForFilesByCriteria(object file, ISpecification<File> criteria)
 {
     long count = this.Repository.Count(criteria.IsSatisfiedBy());
     this.InsertRangeInResponse(count);
     return count == 0 ? this.FileNotFound(file) : this.Repository.Where(criteria.IsSatisfiedBy());
 }
开发者ID:AbrahamAlcaina,项目名称:ECM,代码行数:18,代码来源:FileServiceBase.cs


注:本文中的ISpecification.IsSatisfiedBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。