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


C# ISpecification类代码示例

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


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

示例1: AutoCompleteFacet

 public AutoCompleteFacet(MethodInfo autoCompleteMethod, int pageSize, int minLength, ISpecification holder)
     : this(holder) {
     method = autoCompleteMethod;
     PageSize = pageSize == 0 ? DefaultPageSize : pageSize;
     MinLength = minLength;
     methodDelegate = DelegateUtils.CreateDelegate(method);
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:AutoCompleteFacet.cs

示例2: AuthorizationHideForSessionFacet

 public AuthorizationHideForSessionFacet(string roles,
                                         string users,
                                         ISpecification holder)
     : base(holder) {
     this.roles = FacetUtils.SplitOnComma(roles);
     this.users = FacetUtils.SplitOnComma(users);
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:AuthorizationHideForSessionFacet.cs

示例3: NamedFacetInferred

 public NamedFacetInferred(string value, ISpecification holder)
     : base(value, holder) {
     ShortName = TypeNameUtils.GetShortName(value);
     CapitalizedName = NameUtils.CapitalizeName(ShortName);
     SimpleName = NameUtils.SimpleName(ShortName);
     NaturalName = NameUtils.NaturalName(ShortName);
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:NamedFacetInferred.cs

示例4: Filter

        public IList<IProduct> Filter(IList<IProduct> productList, ISpecification specification)
        {
            if (productList == null || specification == null)
                return null;

            return productList.Where(product => specification.IsMatched(product)).ToList();
        }
开发者ID:liupanpansmile,项目名称:AgileDevelopmentStudy,代码行数:7,代码来源:IFilter.cs

示例5: 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

示例6: AllMatching

 public IEnumerable<User> AllMatching(ISpecification<User> specification)
 {
     lock (_users)
     {
         return _users.Where(specification.SatisfiedBy());
     }
 }
开发者ID:Bootz,项目名称:VoIP_Project_Archives_Testing,代码行数:7,代码来源:InMemoryUserRepository.cs

示例7: DecorateAllHoldersFacets

 public void DecorateAllHoldersFacets(ISpecification holder) {
     if (facetDecorators.Any()) {
         foreach (Type facetType in holder.FacetTypes) {
             DecorateFacet(facetType, holder);
         }
     }
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例8: 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

示例9: FindNeighbourCells

        /// <summary>
        /// This method will return the list of cells that meet the specification.
        /// <param name="cell"> source cell, whose neighbours need to find </param>
        /// <param name="specification">Actual specification, which need to pass by neighbours.  </param>
        /// <returns>return the cell collection which pass the specification. </returns>
        public ICollection<Cell> FindNeighbourCells(Cell cell, ISpecification<Cell> specification)
        {
            if(cell == null)
                throw new ArgumentNullException("Cell can't be empty");

            List<Cell> cells = new List<Cell>();

            int startRow;
            int startCol;
            int endRow;
            int endCol;

            int colIndex = cell.ColNumber;
            int rowIndex = cell.RowNumber;

            GetValidStartRowAndCol(rowIndex, colIndex, out startRow, out startCol);
            GetValidEndRowAndCol(rowIndex, colIndex, out endRow, out endCol);

            for (int xcoord = startRow; xcoord <= endRow; xcoord++)
            {
                for (int ycoord = startCol; ycoord <= endCol; ycoord++)
                {
                    if (!(xcoord == rowIndex && ycoord == colIndex))
                    {
                        if (specification == null)
                            cells.Add(grid[xcoord, ycoord]);
                        else
                            if (specification.IsSpecificationMeet(grid[xcoord, ycoord]))
                                cells.Add(grid[xcoord, ycoord]);
                    }
                }
            }
            return cells;
        }
开发者ID:vishalsharmaind,项目名称:GameOfL,代码行数:39,代码来源:MatrixNeighbourCellRule.cs

示例10: Setup

 public void Setup()
 {
     spec1 = Substitute.For<ISpecification<string>>();
     spec2 = Substitute.For<ISpecification<string>>();
     spec1.ReasonsForDissatisfaction.Returns(new List<string> { Spec1Dissatisfaction });
     spec2.ReasonsForDissatisfaction.Returns(new List<string> { Spec2Dissatisfaction });
 }
开发者ID:affecto,项目名称:dotnet-Patterns.Specification,代码行数:7,代码来源:OrSpecificationTests.cs

示例11: ProcessArray

        private void ProcessArray(IReflector reflector, Type type, ISpecification holder) {
            FacetUtils.AddFacet(new ArrayFacet(holder));
            FacetUtils.AddFacet(new TypeOfFacetInferredFromArray(holder));

            var elementType = type.GetElementType();
            reflector.LoadSpecification(elementType);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:7,代码来源:CollectionFacetFactory.cs

示例12: Subscribe

 public void Subscribe(
     string subscriptionName,
     ISpecification filter,
     Action<IEnumerable<SubscriptionMessage>> messagesReceived)
 {
     this.InitialiseSubscription(subscriptionName, filter, messagesReceived);
 }
开发者ID:DannyRyman,项目名称:Azure.ServiceBus.Facade,代码行数:7,代码来源:SimpleBatchSubscriber.cs

示例13: Process

        private static void Process(ISpecification holder) {
            var facets = new List<IFacet>();

            var specImmutable = holder as IMemberSpecImmutable;
            if (specImmutable != null) {
                facets.Add(new NamedFacetInferred(specImmutable.Identifier.MemberName, holder));
                facets.Add(new DescribedAsFacetNone(holder));
            }

            if (holder is IAssociationSpecImmutable) {
                facets.Add(new ImmutableFacetNever(holder));
                facets.Add(new PropertyDefaultFacetNone(holder));
                facets.Add(new PropertyValidateFacetNone(holder));
            }

            var immutable = holder as IOneToOneAssociationSpecImmutable;
            if (immutable != null) {
                facets.Add(new MaxLengthFacetZero(holder));
                DefaultTypicalLength(facets, immutable.ReturnSpec, immutable);
                facets.Add(new MultiLineFacetNone(holder));
            }

            if (holder is IActionSpecImmutable) {
                facets.Add(new ExecutedFacetDefault(holder));
                facets.Add(new ActionDefaultsFacetNone(holder));
                facets.Add(new ActionChoicesFacetNone(holder));
                facets.Add(new PageSizeFacetDefault(holder));
            }

            FacetUtils.AddFacets(facets);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:31,代码来源:FallbackFacetFactory.cs

示例14: CreateAndGetSubscriptionInternal

        private SubscriptionClient CreateAndGetSubscriptionInternal(string subscriptionName, ISpecification filterSpecification)
        {
            var filter = new SqlFilter(filterSpecification.Result());
            EnsureSubscriptionNameIsValid(subscriptionName);

            log.Info($"Checking subscription for path {subscriptionName} exists");

            if (!this.namespaceManager.SubscriptionExists(this.topic, subscriptionName))
            {
                log.Info("Creating subscription as it does not currently exist");

                var subscriptionDescription = new SubscriptionDescription(this.topic, subscriptionName)
                {
                    LockDuration = TimeSpan.FromMinutes(5)
                };

                this.namespaceManager.CreateSubscription(subscriptionDescription, filter);

                log.Info("Subscription created");
            }

            log.Info("Creating subscription client");

            var client = SubscriptionClient.CreateFromConnectionString(
                connectionString, this.topic, subscriptionName);

            log.Info("Subscription client created");

            return client;
        }
开发者ID:DannyRyman,项目名称:Azure.ServiceBus.Facade,代码行数:30,代码来源:SubscriptionClientFactory.cs

示例15: IsValid

 public static IInteractionBuffer IsValid(ISpecification specification, IInteractionContext ic, IInteractionBuffer buf) {
     IEnumerable<IValidatingInteractionAdvisor> facets = specification.GetFacets().Where(f => f is IValidatingInteractionAdvisor).Cast<IValidatingInteractionAdvisor>();
     foreach (IValidatingInteractionAdvisor advisor in facets) {
         buf.Append(advisor.Invalidates(ic));
     }
     return buf;
 }
开发者ID:,项目名称:,代码行数:7,代码来源:


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