Beispiel #1
0
        public void DoesNotVisitElementsOtherThanPropertyAndField(
            IReflectionElement element)
        {
            var sut          = new ValueCollectingVisitor(new object());
            var acceptResult = element.Accept(sut);

            Assert.Equal(sut, acceptResult);
        }
 int IEqualityComparer <IReflectionElement> .GetHashCode(IReflectionElement obj)
 {
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     return(obj
            .Accept(this.visitor)
            .Value
            .Single()
            .GetHashCode());
 }
 private IEnumerable<Assembly> GetReferences(IReflectionElement reflectionElement)
 {
     return reflectionElement.Accept(this.memberReferenceCollector).Value;
 }
        private void EnsureDostNotExposeIndirectReferences(IReflectionElement reflectionElement)
        {
            var reference = this.GetReferences(reflectionElement)
                .FirstOrDefault(r => this.IndirectReferences.Contains(r));

            if (reference == null)
                return;

            var messageFormat = @"The indirect reference should not be exposed through public API.
            Indirect reference: {0}
            API(exposing)     : {1}";

            throw new NotExposedReferenceException(
                string.Format(
                    CultureInfo.CurrentCulture,
                    messageFormat,
                    reference,
                    reflectionElement.Accept(new DisplayNameCollector()).Value.Single()));
        }