Skip to content

Problem with Generic types #3

@bliet

Description

@bliet

I have a problem to check types that have methods with generic types.
The explementation for the failing type is "Has dependency on: T1&"

How I can allow this dep or ignore it?

Test

PolicyResults results = Policy.Define("Deps", "Desc")
            .For(Types.InAssembly(typeof(KeyValuePairExtensions).Assembly))
            .Add(types => types.That()
                .ResideInNamespace("NetArchExample.Utils")
                .ShouldNot()
                .HaveDependencyOtherThan("NetArchExample.Utils", "System"))
            .Evaluate();

        foreach (var result in results.Results)
        {
            Assert.IsTrue(result.IsSuccessful);
        }

Code

namespace NetArchExample.Utils
{
    using System.Collections.Generic;

    /// <summary>
    /// Class KeyValuePairExtensions.
    /// </summary>
    public static class KeyValuePairExtensions
    {
        /// <summary>
        /// Deconstruct a key value pair.
        /// </summary>
        /// <param name="tuple">The tuple.</param>
        /// <param name="key">The deconstructed key.</param>
        /// <param name="value">The deconstructed value.</param>
        /// <typeparam name="T1">The type of the key.</typeparam>
        /// <typeparam name="T2">The type of the value.</typeparam>
        public static void Deconstruct<T1, T2>(this KeyValuePair<T1, T2> tuple, out T1 key, out T2 value)
        {
            key = tuple.Key;
            value = tuple.Value;
        }
    }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions