diff --git a/FrontDesk/src/FrontDesk.Api/Program.cs b/FrontDesk/src/FrontDesk.Api/Program.cs index 94f1088f..8eeb77f3 100644 --- a/FrontDesk/src/FrontDesk.Api/Program.cs +++ b/FrontDesk/src/FrontDesk.Api/Program.cs @@ -1,46 +1,106 @@ -using System; +using System.Linq; +using System.Reflection; +using BlazorShared; +using FastEndpoints; +using FastEndpoints.Swagger; +using FrontDesk.Api; +using FrontDesk.Api.Hubs; +using FrontDesk.Core.Interfaces; +using FrontDesk.Core.ScheduleAggregate; +using FrontDesk.Infrastructure; using FrontDesk.Infrastructure.Data; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.ResponseCompression; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -namespace FrontDesk.Api +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddSignalR(); +builder.Services.AddMemoryCache(); + +builder.Services.AddSingleton(typeof(IApplicationSettings), typeof(OfficeSettings)); + +var baseUrlConfig = new BaseUrlConfiguration(); +builder.Configuration.Bind(BaseUrlConfiguration.CONFIG_NAME, baseUrlConfig); + +builder.Services.AddCors(options => { - public class Program + options.AddPolicy(name: CORS_POLICY, + builder => + { + builder.WithOrigins(baseUrlConfig.WebBase.Replace("host.docker.internal", "localhost").TrimEnd('/')); + builder.SetIsOriginAllowed(origin => true); + //builder.SetIsOriginAllowed(origin => new Uri(origin).Host == "localhost"); + builder.AllowAnyMethod(); + builder.AllowAnyHeader(); + }); +}); + +builder.Services + .AddFastEndpoints() + .SwaggerDocument(options => { - public static async System.Threading.Tasks.Task Main(string[] args) + options.DocumentSettings = s => { - var host = CreateHostBuilder(args) - .Build(); - - using (var scope = host.Services.CreateScope()) - { - var services = scope.ServiceProvider; - var hostEnvironment = services.GetService(); - var loggerFactory = services.GetRequiredService(); - var logger = loggerFactory.CreateLogger(); - logger.LogInformation($"Starting in environment {hostEnvironment.EnvironmentName}"); - try - { - var seedService = services.GetRequiredService(); - //var catalogContext = services.GetRequiredService(); - await seedService.SeedAsync(new OfficeSettings().TestDate); - } - catch (Exception ex) - { - logger.LogError(ex, "An error occurred seeding the DB."); - } - } - - host.Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } + s.Title = "My API V1"; + }; + }); + +var assemblies = new Assembly[] +{ + typeof(Program).Assembly, + typeof(AppDbContext).Assembly, + typeof(Appointment).Assembly +}; +builder.Services.AddMediatR(config => config.RegisterServicesFromAssemblies(assemblies)); + +builder.Services.AddResponseCompression(opts => +{ + opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( + new[] { "application/octet-stream" }); +}); + +builder.Services.AddAutoMapper(typeof(Program).Assembly); + +builder.Services.AddMessaging(builder.Configuration); + +// use real database +// Requires LocalDB which can be installed with SQL Server Express 2016 +// https://www.microsoft.com/en-us/download/details.aspx?id=54284 +builder.Services.AddDbContext(c => + c.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); + +bool isDevelopment = builder.Environment.IsDevelopment(); +builder.Services.AddInfrastructureDependencies(isDevelopment); + +var app = builder.Build(); + +await app.SeedDatabaseAsync(); + +app.UseResponseCompression(); + +if (app.Environment.IsDevelopment()) +{ + app.UseDeveloperExceptionPage(); +} + +// if enabled configure docker with +// https://docs.microsoft.com/en-us/aspnet/core/security/docker-compose-https?view=aspnetcore-5.0 +//app.UseHttpsRedirection(); + +app.UseRouting(); +app.UseCors(CORS_POLICY); + +app.UseFastEndpoints().UseSwaggerGen(); +app.MapHub("/schedulehub"); + +app.Run(); + +public partial class Program +{ + public const string CORS_POLICY = "CorsPolicy"; } diff --git a/FrontDesk/src/FrontDesk.Api/Properties/launchSettings.json b/FrontDesk/src/FrontDesk.Api/Properties/launchSettings.json index effbc15a..e932445d 100644 --- a/FrontDesk/src/FrontDesk.Api/Properties/launchSettings.json +++ b/FrontDesk/src/FrontDesk.Api/Properties/launchSettings.json @@ -8,6 +8,7 @@ "commandName": "Project", "dotnetRunMessages": "true", "launchBrowser": true, + "launchUrl": "/swagger", "applicationUrl": "https://localhost:5251;http://localhost:5250", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/FrontDesk/src/FrontDesk.Api/ServiceCollectionExtensions.cs b/FrontDesk/src/FrontDesk.Api/ServiceCollectionExtensions.cs new file mode 100644 index 00000000..aa852f09 --- /dev/null +++ b/FrontDesk/src/FrontDesk.Api/ServiceCollectionExtensions.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using FrontDesk.Core.Interfaces; +using FrontDesk.Infrastructure.Messaging; +using MassTransit; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace FrontDesk.Api +{ + public static class ServiceCollectionExtensions + { + public static void AddMessaging(this IServiceCollection services, ConfigurationManager configuration) + { + var messagingConfig = configuration.GetSection("RabbitMq"); + services.Configure(messagingConfig); + services.AddScoped(); + + services.AddMassTransit(x => + { + var rabbitMqConfiguration = messagingConfig.Get(); + x.SetKebabCaseEndpointNameFormatter(); + + x.AddConsumers(Assembly.GetExecutingAssembly()); + + x.UsingRabbitMq((context, cfg) => + { + var port = (ushort)rabbitMqConfiguration.Port; + cfg.Host(rabbitMqConfiguration.Hostname, port, rabbitMqConfiguration.VirtualHost, h => + { + h.Username(rabbitMqConfiguration.UserName); + h.Password(rabbitMqConfiguration.Password); + }); + + cfg.ConfigureEndpoints(context); + }); + }); + } + } +} diff --git a/FrontDesk/src/FrontDesk.Api/Startup.cs b/FrontDesk/src/FrontDesk.Api/Startup.cs deleted file mode 100644 index 2a20f18a..00000000 --- a/FrontDesk/src/FrontDesk.Api/Startup.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System.Linq; -using System.Reflection; -using BlazorShared; -using FastEndpoints; -using FastEndpoints.Swagger; -using FrontDesk.Api.Hubs; -using FrontDesk.Core.Interfaces; -using FrontDesk.Core.ScheduleAggregate; -using FrontDesk.Infrastructure; -using FrontDesk.Infrastructure.Data; -using FrontDesk.Infrastructure.Messaging; -using MassTransit; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.ResponseCompression; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace FrontDesk.Api -{ - public class Startup - { - public const string CORS_POLICY = "CorsPolicy"; - private readonly IWebHostEnvironment _env; - - public Startup(IConfiguration configuration, IWebHostEnvironment env) - { - Configuration = configuration; - _env = env; - } - - public IConfiguration Configuration { get; } - - public void ConfigureDevelopmentServices(IServiceCollection services) - { - // use in-memory database - //ConfigureInMemoryDatabases(services); - - // use real database - ConfigureProductionServices(services); - } - - public void ConfigureDockerServices(IServiceCollection services) - { - ConfigureDevelopmentServices(services); - } - - private void ConfigureInMemoryDatabases(IServiceCollection services) - { - services.AddDbContext(c => - c.UseInMemoryDatabase("AppDb")); - - ConfigureServices(services); - } - - public void ConfigureProductionServices(IServiceCollection services) - { - // use real database - // Requires LocalDB which can be installed with SQL Server Express 2016 - // https://www.microsoft.com/en-us/download/details.aspx?id=54284 - services.AddDbContext(c => - c.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); - - ConfigureServices(services); - } - - public void ConfigureTestingServices(IServiceCollection services) - { - ConfigureInMemoryDatabases(services); - } - - public void ConfigureServices(IServiceCollection services) - { - services.AddSignalR(); - services.AddMemoryCache(); - - services.AddSingleton(typeof(IApplicationSettings), typeof(OfficeSettings)); - - var baseUrlConfig = new BaseUrlConfiguration(); - Configuration.Bind(BaseUrlConfiguration.CONFIG_NAME, baseUrlConfig); - - services.AddCors(options => - { - options.AddPolicy(name: CORS_POLICY, - builder => - { - builder.WithOrigins(baseUrlConfig.WebBase.Replace("host.docker.internal", "localhost").TrimEnd('/')); - builder.SetIsOriginAllowed(origin => true); - //builder.SetIsOriginAllowed(origin => new Uri(origin).Host == "localhost"); - builder.AllowAnyMethod(); - builder.AllowAnyHeader(); - }); - }); - - services.AddFastEndpoints().SwaggerDocument(); - services.AddControllers(); - - var assemblies = new Assembly[] - { - typeof(Startup).Assembly, - typeof(AppDbContext).Assembly, - typeof(Appointment).Assembly - }; - services.AddMediatR(config => config.RegisterServicesFromAssemblies(assemblies)); - - services.AddResponseCompression(opts => - { - opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( - new[] { "application/octet-stream" }); - }); - - services.AddAutoMapper(typeof(Startup).Assembly); - services.AddSwaggerGenCustom(); - - // configure messaging - var messagingConfig = Configuration.GetSection("RabbitMq"); - services.Configure(messagingConfig); - services.AddScoped(); - - services.AddMassTransit(x => - { - var rabbitMqConfiguration = messagingConfig.Get(); - x.SetKebabCaseEndpointNameFormatter(); - - x.AddConsumers(Assembly.GetExecutingAssembly()); - - x.UsingRabbitMq((context, cfg) => - { - var port = (ushort)rabbitMqConfiguration.Port; - cfg.Host(rabbitMqConfiguration.Hostname, port, rabbitMqConfiguration.VirtualHost, h => - { - h.Username(rabbitMqConfiguration.UserName); - h.Password(rabbitMqConfiguration.Password); - }); - - cfg.ConfigureEndpoints(context); - }); - }); - - bool isDevelopment = _env.IsDevelopment(); - services.AddInfrastructureDependencies(isDevelopment); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - app.UseResponseCompression(); - - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - // if enabled configure docker with - // https://docs.microsoft.com/en-us/aspnet/core/security/docker-compose-https?view=aspnetcore-5.0 - //app.UseHttpsRedirection(); - - app.UseRouting(); - - app.UseCors(CORS_POLICY); - - // Enable middleware to serve generated Swagger as a JSON endpoint. - app.UseSwagger(); - - // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), - // specifying the Swagger JSON endpoint. - app.UseSwaggerUI(c => - { - c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); - c.RoutePrefix = string.Empty; // Set Swagger UI to app root - }); - - app.UseEndpoints(endpoints => - { - endpoints.MapFastEndpoints(); - endpoints.MapControllers(); - endpoints.MapHub("/schedulehub"); - }); - } - } -} diff --git a/FrontDesk/src/FrontDesk.Api/WebApplicationExtensions.cs b/FrontDesk/src/FrontDesk.Api/WebApplicationExtensions.cs new file mode 100644 index 00000000..d7edc6c8 --- /dev/null +++ b/FrontDesk/src/FrontDesk.Api/WebApplicationExtensions.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading.Tasks; +using FrontDesk.Infrastructure.Data; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace FrontDesk.Api +{ + public static class WebApplicationExtensions + { + public static async Task SeedDatabaseAsync(this WebApplication app) + { + using (var scope = app.Services.CreateScope()) + { + var services = scope.ServiceProvider; + var hostEnvironment = services.GetService(); + var loggerFactory = services.GetRequiredService(); + var logger = loggerFactory.CreateLogger(); + logger.LogInformation($"Starting in environment {hostEnvironment.EnvironmentName}"); + try + { + var seedService = services.GetRequiredService(); + //var catalogContext = services.GetRequiredService(); + await seedService.SeedAsync(new OfficeSettings().TestDate); + } + catch (Exception ex) + { + logger.LogError(ex, "An error occurred seeding the DB."); + } + } + } + } +} diff --git a/FrontDesk/src/FrontDesk.Blazor.Host/Program.cs b/FrontDesk/src/FrontDesk.Blazor.Host/Program.cs index 83238e1f..fa62897c 100644 --- a/FrontDesk/src/FrontDesk.Blazor.Host/Program.cs +++ b/FrontDesk/src/FrontDesk.Blazor.Host/Program.cs @@ -1,20 +1,38 @@ -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -namespace FrontDesk.Blazor.Host +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddServerSideBlazor(); +builder.Services.AddControllersWithViews(); +builder.Services.AddRazorPages(); + +var app = builder.Build(); + +app.UsePathBase("/"); + +if (app.Environment.IsDevelopment()) { - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } + app.UseDeveloperExceptionPage(); + app.UseWebAssemblyDebugging(); } +else +{ + app.UseExceptionHandler("/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + //app.UseHsts(); +} + +//app.UseHttpsRedirection(); +app.UseBlazorFrameworkFiles(); +app.UseStaticFiles(); + +app.UseRouting(); +app.MapRazorPages(); +app.MapControllers(); +app.MapBlazorHub(); +app.MapFallbackToFile("index.html"); + +app.Run(); diff --git a/FrontDesk/src/FrontDesk.Blazor.Host/Startup.cs b/FrontDesk/src/FrontDesk.Blazor.Host/Startup.cs deleted file mode 100644 index b163553e..00000000 --- a/FrontDesk/src/FrontDesk.Blazor.Host/Startup.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Configuration; - -namespace FrontDesk.Blazor.Host -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 - public void ConfigureServices(IServiceCollection services) - { - services.AddServerSideBlazor(); - services.AddControllersWithViews(); - services.AddRazorPages(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - app.UsePathBase("/"); - - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - app.UseWebAssemblyDebugging(); - } - else - { - app.UseExceptionHandler("/Error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - //app.UseHsts(); - } - - //app.UseHttpsRedirection(); - app.UseBlazorFrameworkFiles(); - app.UseStaticFiles(); - - app.UseRouting(); - app.UseEndpoints(endpoints => - { - endpoints.MapRazorPages(); - endpoints.MapControllers(); - endpoints.MapBlazorHub(); - endpoints.MapFallbackToFile("index.html"); - }); - } - } -} diff --git a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Create.cs b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Create.cs index fc087439..19186fd5 100644 --- a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Create.cs +++ b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Create.cs @@ -14,7 +14,7 @@ namespace FunctionalTests.AppointmentEndpoints { [Collection("Sequential")] - public class Create : IClassFixture> + public class Create : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; @@ -24,7 +24,7 @@ public class Create : IClassFixture> private int _testRoomId = 1; private int _testDoctorId = 1; - public Create(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public Create(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Delete.cs b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Delete.cs index 83a16020..a25f89bb 100644 --- a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Delete.cs +++ b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Delete.cs @@ -4,19 +4,18 @@ using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Appointment; using BlazorShared.Models.Schedule; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.AppointmentEndpoints { [Collection("Sequential")] - public class Delete : IClassFixture> + public class Delete : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public Delete(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public Delete(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/GetById.cs b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/GetById.cs index 1ec41718..16c7997d 100644 --- a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/GetById.cs +++ b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/GetById.cs @@ -4,19 +4,18 @@ using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Appointment; using BlazorShared.Models.Schedule; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.AppointmentEndpoints { [Collection("Sequential")] - public class GetById : IClassFixture> + public class GetById : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public GetById(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public GetById(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/List.cs b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/List.cs index 2c92bae6..710e3a75 100644 --- a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/List.cs +++ b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/List.cs @@ -4,19 +4,18 @@ using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Appointment; using BlazorShared.Models.Schedule; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.AppointmentEndpoints { [Collection("Sequential")] - public class List : IClassFixture> + public class List : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Update.cs b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Update.cs index f4e205c5..91e4674c 100644 --- a/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Update.cs +++ b/FrontDesk/tests/FunctionalTests/AppointmentEndpoints/Update.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System.Linq; using System.Net.Http; using System.Text; using System.Text.Json; @@ -7,14 +6,13 @@ using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Appointment; using BlazorShared.Models.Schedule; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.AppointmentEndpoints { [Collection("Sequential")] - public class Update : IClassFixture> + public class Update : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; @@ -23,7 +21,7 @@ public class Update : IClassFixture> private int _testDoctorId = 3; private string _testTitle = "updated title"; - public Update(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public Update(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/AppointmentTypeEndpoints/List.cs b/FrontDesk/tests/FunctionalTests/AppointmentTypeEndpoints/List.cs index 95ff4e16..49dd3f23 100644 --- a/FrontDesk/tests/FunctionalTests/AppointmentTypeEndpoints/List.cs +++ b/FrontDesk/tests/FunctionalTests/AppointmentTypeEndpoints/List.cs @@ -1,21 +1,19 @@ -using System.Linq; -using System.Net.Http; +using System.Net.Http; using System.Threading.Tasks; using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.AppointmentType; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.AppointmentTypeEndpoints { [Collection("Sequential")] - public class List : IClassFixture> + public class List : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/ClientEndpoints/GetById.cs b/FrontDesk/tests/FunctionalTests/ClientEndpoints/GetById.cs index 31baaf37..b4b71216 100644 --- a/FrontDesk/tests/FunctionalTests/ClientEndpoints/GetById.cs +++ b/FrontDesk/tests/FunctionalTests/ClientEndpoints/GetById.cs @@ -1,21 +1,19 @@ -using System.Linq; -using System.Net.Http; +using System.Net.Http; using System.Threading.Tasks; using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Client; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.ClientEndpoints { [Collection("Sequential")] - public class GetById : IClassFixture> + public class GetById : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public GetById(CustomWebApplicationFactory factory, + public GetById(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); diff --git a/FrontDesk/tests/FunctionalTests/ClientEndpoints/List.cs b/FrontDesk/tests/FunctionalTests/ClientEndpoints/List.cs index c679672f..33ddb564 100644 --- a/FrontDesk/tests/FunctionalTests/ClientEndpoints/List.cs +++ b/FrontDesk/tests/FunctionalTests/ClientEndpoints/List.cs @@ -3,19 +3,18 @@ using System.Threading.Tasks; using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Client; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.ClientEndpoints { [Collection("Sequential")] - public class List : IClassFixture> + public class List : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public List(CustomWebApplicationFactory factory, + public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); diff --git a/FrontDesk/tests/FunctionalTests/ConfigurationEndpoints/Read.cs b/FrontDesk/tests/FunctionalTests/ConfigurationEndpoints/Read.cs index 5c38cd1f..3877fcc4 100644 --- a/FrontDesk/tests/FunctionalTests/ConfigurationEndpoints/Read.cs +++ b/FrontDesk/tests/FunctionalTests/ConfigurationEndpoints/Read.cs @@ -4,19 +4,18 @@ using System.Threading.Tasks; using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Configuration; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.ConfigurationEndpoints { [Collection("Sequential")] - public class Read : IClassFixture> + public class Read : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public Read(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public Read(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/CustomWebApplicationFactory.cs b/FrontDesk/tests/FunctionalTests/CustomWebApplicationFactory.cs index d2c60940..a1d0b19e 100644 --- a/FrontDesk/tests/FunctionalTests/CustomWebApplicationFactory.cs +++ b/FrontDesk/tests/FunctionalTests/CustomWebApplicationFactory.cs @@ -15,7 +15,7 @@ namespace FunctionalTests { - public class CustomWebApplicationFactory : WebApplicationFactory + public class CustomWebApplicationFactory : WebApplicationFactory { private readonly string _connectionString = "Data Source=functionaltests.db"; private readonly SqliteConnection _connection; diff --git a/FrontDesk/tests/FunctionalTests/DoctorEndpoints/List.cs b/FrontDesk/tests/FunctionalTests/DoctorEndpoints/List.cs index f573f019..9d233e78 100644 --- a/FrontDesk/tests/FunctionalTests/DoctorEndpoints/List.cs +++ b/FrontDesk/tests/FunctionalTests/DoctorEndpoints/List.cs @@ -2,19 +2,18 @@ using System.Threading.Tasks; using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Doctor; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.DoctorEndpoints { [Collection("Sequential")] - public class List : IClassFixture> + public class List : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper; diff --git a/FrontDesk/tests/FunctionalTests/RoomEndpoints/List.cs b/FrontDesk/tests/FunctionalTests/RoomEndpoints/List.cs index f7b189dc..01a0b325 100644 --- a/FrontDesk/tests/FunctionalTests/RoomEndpoints/List.cs +++ b/FrontDesk/tests/FunctionalTests/RoomEndpoints/List.cs @@ -2,19 +2,18 @@ using System.Threading.Tasks; using Ardalis.HttpClientTestExtensions; using BlazorShared.Models.Room; -using FrontDesk.Api; using Xunit; using Xunit.Abstractions; namespace FunctionalTests.RoomEndpoints { [Collection("Sequential")] - public class List : IClassFixture> + public class List : IClassFixture> { private readonly HttpClient _client; private readonly ITestOutputHelper _outputHelper; - public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) + public List(CustomWebApplicationFactory factory, ITestOutputHelper outputHelper) { _client = factory.CreateClient(); _outputHelper = outputHelper;