Exemplo n.º 1
0
        /// <summary>
        /// Names the matching.
        /// </summary>
        /// <param name="predicate">The predicate that need to be satisfied in order for the implementation to be considered.</param>
        /// <remarks>A number of helper class already provide some built-in <paramref name="predicate"/>s such as <see cref="InterfaceTypeName"/></remarks>
        /// <returns>The fluent connector for a proper fluent syntax.</returns>
        public FluentContractFilter NameMatching(Func <string, string, bool> predicate)
        {
            // The Where clause here is not a linq command. it adds a filter in the internal properties of the builder. The execution is not deferred.
            this.builder
            .Where(type => type.GetInterfaces().Any(i => predicate(i.Name, type.Name)));

            Func <Type, Type, bool> predicateInterfaceIsProperlyNamed = (contract, implementation) => predicate(contract.Name, implementation.Name);

            var fluentContractFilter = new FluentContractFilter(this.builder, predicateInterfaceIsProperlyNamed);

            return(fluentContractFilter);
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 public FluentExceptInterfaces(FluentContractFilter fluentContractFilter, params Func <Type, Type, bool>[] predicates)
 {
     this.fluentContractFilter = fluentContractFilter;
     this.filters = new List <Func <Type, Type, bool> >(predicates);
 }