Ejemplo n.º 1
0
        public void Create_With_Custom_TypeInspector()
        {
            // arrange
            var options     = new SchemaOptions();
            var inspector   = new DefaultTypeInspector();
            var conventions = new Dictionary <Type, IConvention>();
            var services    = new DictionaryServiceProvider(
                typeof(ITypeInspector),
                inspector);

            // act
            DescriptorContext context =
                DescriptorContext.Create(options, services, conventions);

            // assert
            Assert.Equal(inspector, context.Inspector);
            Assert.NotNull(context.Naming);
            Assert.Equal(options, context.Options);
        }
Ejemplo n.º 2
0
        public void Create_With_Custom_NamingConventions_AsIConvention()
        {
            // arrange
            var options     = new SchemaOptions();
            var naming      = new DefaultNamingConventions();
            var conventions = new Dictionary <Type, IConvention>();

            conventions.Add(typeof(INamingConventions), naming);
            var services = new DictionaryServiceProvider();

            // act
            DescriptorContext context =
                DescriptorContext.Create(options, services, conventions);

            // assert
            Assert.Equal(naming, context.Naming);
            Assert.NotNull(context.Inspector);
            Assert.Equal(options, context.Options);
        }
        public void Create_With_Custom_NamingConventions_AsIConvention()
        {
            // arrange
            var options     = new SchemaOptions();
            var naming      = new DefaultNamingConventions();
            var conventions = new Dictionary <(Type, string), CreateConvention>
            {
                { (typeof(INamingConventions), null), s => naming }
            };

            // act
            var context = DescriptorContext.Create(
                options, new EmptyServiceProvider(), conventions, new Dictionary <string, object>(),
                new SchemaBuilder.LazySchema());

            // assert
            Assert.Equal(naming, context.Naming);
            Assert.NotNull(context.TypeInspector);
            Assert.Equal(options, context.Options);
        }
        public void Create_With_Custom_TypeInspector()
        {
            // arrange
            var options     = new SchemaOptions();
            var inspector   = new DefaultTypeInspector();
            var conventions = new Dictionary <(Type, string), CreateConvention>();
            var services    = new DictionaryServiceProvider(
                typeof(ITypeInspector),
                inspector);

            // act
            var context = DescriptorContext.Create(
                options, services, conventions, new Dictionary <string, object>(),
                new SchemaBuilder.LazySchema());

            // assert
            Assert.Equal(inspector, context.TypeInspector);
            Assert.NotNull(context.Naming);
            Assert.Equal(options, context.Options);
        }