Esempio n. 1
0
 public InformacoesProjetoTest()
 {
     AdapterDtoDomain.MapperRegister();
     _msgs = new Mensagens();
     _informacoesProjetoServico    = new InformacoesProjetoServico(_informacoesProjeto, _msgs);
     _informacoesProjetoController = new InformacoesProjetoController(_informacoesProjetoServico, _msgs);
 }
Esempio n. 2
0
 public CalculoTest()
 {
     AdapterDtoDomain.MapperRegister();
     _msgs              = new Mensagens();
     _calculoServico    = new CalculoServico(_msgs);
     _calculoController = new CalculoController(_calculoServico, _msgs);
 }
Esempio n. 3
0
 public LiveWeatherTest()
 {
     AdapterDtoDomain.MapperRegister();
     _msgs = new Messages();
     _liveWeatherService = new LiveWeatherService(_projectConfiguration, _msgs);
     _calculoController  = new LiveWeatherController(_liveWeatherService, _msgs);
 }
Esempio n. 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped <ITaxaJurosServico, TaxaJurosServico>();
            services.AddScoped <IMensagens, Mensagens>();
            services.AddMvcCore().AddJsonFormatters().AddApiExplorer();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1",
                             new Info
                {
                    Title       = "APITaxaJuros",
                    Version     = "v1",
                    Description = "API para retorno da taxa de juros."
                });

                string caminhoAplicacao =
                    PlatformServices.Default.Application.ApplicationBasePath;
                string nomeAplicacao =
                    PlatformServices.Default.Application.ApplicationName;
                string caminhoXmlDoc =
                    Path.Combine(caminhoAplicacao, $"{nomeAplicacao}.xml");

                c.IncludeXmlComments(caminhoXmlDoc);
            });

            // Configura��o do CORS
            services.AddCors(o => o.AddPolicy("CorsConfig", builder =>
            {
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            AdapterDtoDomain.MapperRegister();
        }
Esempio n. 5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.BuildServiceProvider();
            var informacoesProjeto = new InformacoesProjeto();

            new ConfigureFromConfigurationOptions <InformacoesProjeto>(Configuration.GetSection("InformacoesProjeto")).Configure(informacoesProjeto);

            services.AddSingleton(informacoesProjeto);
            services.AddScoped <ICalculoServico, CalculoServico>();
            services.AddScoped <IInformacoesProjetoServico, InformacoesProjetoServico>();
            services.AddScoped <IMensagens, Mensagens>();
            services.AddMvcCore().AddJsonFormatters().AddApiExplorer();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1",
                             new Info
                {
                    Title       = "APICalculaJuros",
                    Version     = "v1",
                    Description = "API para calculo de juros."
                });

                string caminhoAplicacao =
                    PlatformServices.Default.Application.ApplicationBasePath;
                string nomeAplicacao =
                    PlatformServices.Default.Application.ApplicationName;
                string caminhoXmlDoc =
                    Path.Combine(caminhoAplicacao, $"{nomeAplicacao}.xml");

                c.IncludeXmlComments(caminhoXmlDoc);
            });

            // Configura��o do CORS
            services.AddCors(o => o.AddPolicy("CorsConfig", builder =>
            {
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            AdapterDtoDomain.MapperRegister();
        }
Esempio n. 6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.BuildServiceProvider();
            var projectConfiguration = new ProjectConfiguration();

            new ConfigureFromConfigurationOptions <ProjectConfiguration>(Configuration.GetSection("ProjectConfiguration")).Configure(projectConfiguration);

            services.AddSingleton(projectConfiguration);
            services.AddScoped <ILiveWeatherService, LiveWeatherService>();
            services.AddScoped <IMessages, Messages>();
            services.AddMvcCore().AddJsonFormatters().AddApiExplorer();
            services.AddSwaggerGen(c =>
            {
                c.OperationFilter <SetBodyParameters>();
                c.SwaggerDoc("v1",
                             new Info
                {
                    Title       = "LiveWeatherApi",
                    Version     = "v1",
                    Description = "Live weather forecast."
                });

                string caminhoAplicacao =
                    PlatformServices.Default.Application.ApplicationBasePath;
                string nomeAplicacao =
                    PlatformServices.Default.Application.ApplicationName;
                string caminhoXmlDoc =
                    Path.Combine(caminhoAplicacao, $"{nomeAplicacao}.xml");

                c.IncludeXmlComments(caminhoXmlDoc);
            });

            // Configura��o do CORS
            services.AddCors(o => o.AddPolicy("CorsConfig", builder =>
            {
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            AdapterDtoDomain.MapperRegister();
        }
Esempio n. 7
0
 public TaxaTest()
 {
     AdapterDtoDomain.MapperRegister();
     _taxaController = new TaxaController(new TaxaJurosServico(), new Mensagens());
 }