• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISpecification类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ISpecification类属于命名空间,在下文中一共展示了ISpecification类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:


示例16: IsUsable

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


示例17: Process

        private void Process(IReflector reflector, MethodInfo member, ISpecification holder) {
            var allParams = member.GetParameters();
            var paramsWithAttribute = allParams.Where(p => p.GetCustomAttribute<ContributedActionAttribute>() != null).ToArray();
            if (!paramsWithAttribute.Any()) return; //Nothing to do
            var facet = new ContributedActionFacet(holder);
            foreach (ParameterInfo p in paramsWithAttribute) {
                var attribute = p.GetCustomAttribute<ContributedActionAttribute>();
                var type = reflector.LoadSpecification<IObjectSpecImmutable>(p.ParameterType);
                if (type != null) {
                    if (type.IsParseable) {
                        Log.WarnFormat("ContributedAction attribute added to a value parameter type: {0}", member.Name);
                    }
                    else if (type.IsCollection) {
                        var parent = reflector.LoadSpecification(member.DeclaringType);

                        if (parent is IObjectSpecBuilder) {
                            AddLocalCollectionContributedAction(reflector,  p, facet);
                        }
                        else {
                            AddCollectionContributedAction(reflector, member, type, p, facet, attribute);
                        }
                    }
                    else {
                        facet.AddObjectContributee(type, attribute.SubMenu, attribute.Id);
                    }
                }
            }
            FacetUtils.AddFacet(facet);
        }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:29,代码来源:ContributedActionAnnotationFacetFactory.cs


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


示例19: CreateSpecificationTitle

 private string CreateSpecificationTitle(ISpecification specification)
 {
     string suffix = "Specification";
     string title = specification.Story.Name;
     if (title.EndsWith(suffix))
         title = title.Remove(title.Length - suffix.Length, suffix.Length);
     return title;
 }
开发者ID:kingctan,项目名称:TestStack.Seleno,代码行数:8,代码来源:SpecStoryMetaDataScanner.cs


示例20: RegExFacet

 public RegExFacet(string validation, string format, bool caseSensitive, string message, ISpecification holder)
     : base(typeof (IRegExFacet), holder) {
     validationPattern = validation;
     Pattern = new Regex(validation, PatternFlags);
     formatPattern = format;
     isCaseSensitive = caseSensitive;
     failureMessage = message;
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:RegExFacet.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISpecificationAttributeService类代码示例发布时间:2022-05-24
下一篇:
C# ISpeciesCohorts类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap