public ConventionBasedCodingStyle()
        {
            types = new List <IType>();

            MaxFetchDepth = new SingleConfiguration <ConventionBasedCodingStyle, int>(this, nameof(MaxFetchDepth), true);

            Type            = new ConventionBasedConfiguration <ConventionBasedCodingStyle, object, IType>(this, nameof(Type));
            TypeIsValue     = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, bool>(this, nameof(TypeIsValue));
            TypeIsView      = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, bool>(this, nameof(TypeIsView));
            IdExtractor     = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, IIdExtractor>(this, nameof(IdExtractor));
            ValueExtractor  = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, IValueExtractor>(this, nameof(ValueExtractor));
            Locator         = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, ILocator>(this, nameof(Locator));
            Converters      = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IType, IConverter>(this, nameof(Converters));
            StaticInstances = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IType, object>(this, nameof(StaticInstances));
            Initializers    = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IType, IConstructor>(this, nameof(Initializers));
            Datas           = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IType, IProperty>(this, nameof(Datas));
            Operations      = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IType, IMethod>(this, nameof(Operations));

            DataFetchedEagerly = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IProperty, bool>(this, nameof(DataFetchedEagerly));

            ParameterIsOptional   = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IParameter, bool>(this, nameof(ParameterIsOptional));
            ParameterDefaultValue = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IParameter, object>(this, nameof(ParameterDefaultValue));

            Module        = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, string>(this, nameof(Module), true);
            TypeName      = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IType, string>(this, nameof(TypeName), true);
            DataName      = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IProperty, string>(this, nameof(DataName), true);
            OperationName = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IMethod, string>(this, nameof(OperationName), true);
            ParameterName = new ConventionBasedConfiguration <ConventionBasedCodingStyle, IParameter, string>(this, nameof(ParameterName), true);

            TypeMarks        = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IType, string>(this, nameof(TypeMarks));
            InitializerMarks = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IConstructor, string>(this, nameof(InitializerMarks));
            DataMarks        = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IProperty, string>(this, nameof(DataMarks));
            OperationMarks   = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IMethod, string>(this, nameof(OperationMarks));
            ParameterMarks   = new ConventionBasedListConfiguration <ConventionBasedCodingStyle, IParameter, string>(this, nameof(ParameterMarks));
        }
Exemple #2
0
        public override void SetUp()
        {
            base.SetUp();

            layeredMock      = new Mock <ILayered>();
            otherLayeredMock = new Mock <ILayered>();

            testing            = new ConventionBasedListConfiguration <ILayered, IType, string>(layeredMock.Object, "test");
            testingOther       = new ConventionBasedListConfiguration <ILayered, IType, string>(layeredMock.Object, "test other");
            testingOtherConfig = new ConventionBasedListConfiguration <ILayered, IType, string>(otherLayeredMock.Object, "test other config");

            layeredMock.Setup(o => o.CurrentLayer).Returns(Layer.LeastSpecific);
            otherLayeredMock.Setup(o => o.CurrentLayer).Returns(Layer.LeastSpecific);
        }
Exemple #3
0
        public void When_set__convention_result_is_cached_for_a_given_input()
        {
            testing = new ConventionBasedListConfiguration <ILayered, IType, string>(layeredMock.Object, "test", true);

            var conventionMock = new Mock <IConvention <IType, List <string> > >();

            conventionMock.Setup(o => o.AppliesTo(It.IsAny <IType>())).Returns(true);
            conventionMock.Setup(o => o.Apply(It.IsAny <IType>())).Returns((IType s) => new List <string> {
                s.FullName
            });

            testing.Add(conventionMock.Object);

            testing.Get(type.of <string>());
            testing.Get(type.of <string>());
            testing.Get(type.of <int>());

            conventionMock.Verify(o => o.AppliesTo(type.of <string>()), Times.Once);
            conventionMock.Verify(o => o.Apply(type.of <string>()), Times.Once);
            conventionMock.Verify(o => o.AppliesTo(type.of <int>()), Times.Once);
            conventionMock.Verify(o => o.Apply(type.of <int>()), Times.Once);
        }
 internal ConventionBasedInterceptionConfiguration()
 {
     Interceptors        = new ConventionBasedListConfiguration <ConventionBasedInterceptionConfiguration, InterceptionTarget, IInterceptor <InterceptionContext> >(this, nameof(Interceptors));
     ServiceInterceptors = new ConventionBasedListConfiguration <ConventionBasedInterceptionConfiguration, OperationWithObjectModel, IInterceptor <ServiceInterceptionContext> >(this, nameof(ServiceInterceptors));
 }
 public static TConfiguration Add <TConfiguration, TFrom, TItem>(
     this ConventionBasedListConfiguration <TConfiguration, TFrom, TItem> source,
     Func <ConventionBuilder <TFrom, List <TItem> >, IConvention <TFrom, List <TItem> > > conventionDelegate
     ) where TConfiguration : ILayered =>
 source.Add(conventionDelegate(BuildRoutine.Convention <TFrom, List <TItem> >()));