public async Task InformacoesProjeto_Get_ReturnsOkResponse() { var settings = new InformacoesProjeto() { UrlProjeto = "https://github.com/", UrlIframeProjeto = "//cdn.iframe.ly" }; IOptions <InformacoesProjeto> appSettingsOptions = Options.Create(settings); var response = await _testProvider.Client.GetAsync("/InformacoesProjeto/ObterInformacoesProjeto"); response.EnsureSuccessStatusCode(); response.StatusCode.Should().Be(HttpStatusCode.OK); _testProvider.Dispose(); }
// 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(); }
public InformacoesProjetoServico(InformacoesProjeto informacoesProjeto, IMensagens msgs) { _msgs = msgs; _informacoesProjeto = informacoesProjeto; }