public ExamplesOperationFilterTests()
        {
            var options = Options.Create(new MvcJsonOptions());
            var serializerSettingsDuplicator = new SerializerSettingsDuplicator(options);

            var jsonFormatter = new JsonFormatter();

            var serviceProvider = Substitute.For <IServiceProvider>();

            var requestExample  = new RequestExample(jsonFormatter, serializerSettingsDuplicator);
            var responseExample = new ResponseExample(jsonFormatter, serializerSettingsDuplicator);

            sut = new ExamplesOperationFilter(serviceProvider, requestExample, responseExample);
        }
        public ServiceProviderExamplesOperationFilterTests()
        {
            var options = Options.Create(new MvcJsonOptions());
            var serializerSettingsDuplicator = new SerializerSettingsDuplicator(options);

            var jsonFormatter = new JsonFormatter();

            var requestExample  = new RequestExample(jsonFormatter, serializerSettingsDuplicator);
            var responseExample = new ResponseExample(jsonFormatter, serializerSettingsDuplicator);

            serviceProvider = Substitute.For <IServiceProvider>();
            serviceProvider.GetService(typeof(IExamplesProvider <PersonResponse>)).Returns(new PersonResponseAutoExample());

            sut = new ServiceProviderExamplesOperationFilter(serviceProvider, requestExample, responseExample);
        }
Ejemplo n.º 3
0
        public ServiceProviderExamplesOperationFilterWithXmlDataContractTests()
        {
            serviceProvider = Substitute.For <IServiceProvider>();
            serviceProvider.GetService(typeof(IExamplesProvider <PersonResponse>)).Returns(new PersonResponseAutoExample());

            var jsonFormatter = new JsonFormatter();
            var serializerSettingsDuplicator = new SerializerSettingsDuplicator(
                Options.Create(new MvcJsonOptions()),
                Options.Create(new SchemaGeneratorOptions()));

            var mvcOutputFormatter = new MvcOutputFormatter(FormatterOptions.WithXmlDataContractFormatter, new FakeLoggerFactory());

            sut = new ServiceProviderExamplesOperationFilter(
                serviceProvider,
                new RequestExample(jsonFormatter, serializerSettingsDuplicator, mvcOutputFormatter),
                new ResponseExample(jsonFormatter, serializerSettingsDuplicator, mvcOutputFormatter));
        }
        public ServiceProviderExamplesOperationFilterTests()
        {
            var mvcJsonOptions = Options.Create(new MvcJsonOptions());

            schemaGeneratorOptions = new SchemaGeneratorOptions();
            var serializerSettingsDuplicator = new SerializerSettingsDuplicator(mvcJsonOptions, Options.Create(schemaGeneratorOptions));

            var jsonFormatter      = new JsonFormatter();
            var mvcOutputFormatter = new MvcOutputFormatter(FormatterOptions.WithoutFormatters, new FakeLoggerFactory());

            var requestExample  = new RequestExample(jsonFormatter, serializerSettingsDuplicator, mvcOutputFormatter, Options.Create(swaggerOptions));
            var responseExample = new ResponseExample(jsonFormatter, serializerSettingsDuplicator, mvcOutputFormatter);

            serviceProvider = Substitute.For <IServiceProvider>();
            serviceProvider.GetService(typeof(IExamplesProvider <PersonResponse>)).Returns(new PersonResponseAutoExample());

            sut = new ServiceProviderExamplesOperationFilter(serviceProvider, requestExample, responseExample);
        }
        public ExamplesOperationFilterTests()
        {
            var mvcJsonOptions = Options.Create(new MvcJsonOptions());

            schemaGeneratorOptions = new SchemaGeneratorOptions();
            var serializerSettingsDuplicator = new SerializerSettingsDuplicator(mvcJsonOptions, Options.Create(schemaGeneratorOptions));

            var jsonFormatter = new JsonFormatter();

            var serviceProvider = Substitute.For <IServiceProvider>();

            serviceProvider.GetService(typeof(PersonResponseExample)).Returns(new PersonResponseExample());
            serviceProvider.GetService(typeof(PersonRequestExample)).Returns(new PersonRequestExample());
            serviceProvider.GetService(typeof(DictionaryRequestExample)).Returns(new DictionaryRequestExample());

            var requestExample  = new RequestExample(jsonFormatter, serializerSettingsDuplicator);
            var responseExample = new ResponseExample(jsonFormatter, serializerSettingsDuplicator);

            sut = new ExamplesOperationFilter(serviceProvider, requestExample, responseExample);
        }