diff --git a/backend/.idea/.idea.bragapi/.idea/.name b/backend/.idea/.idea.bragapi/.idea/.name
deleted file mode 100644
index ce42c9d..0000000
--- a/backend/.idea/.idea.bragapi/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-bragapi
\ No newline at end of file
diff --git a/backend/.idea/.idea.bragapi/.idea/encodings.xml b/backend/.idea/.idea.bragapi/.idea/encodings.xml
deleted file mode 100644
index df87cf9..0000000
--- a/backend/.idea/.idea.bragapi/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/backend/.idea/.idea.bragapi/.idea/indexLayout.xml b/backend/.idea/.idea.bragapi/.idea/indexLayout.xml
deleted file mode 100644
index 0fec2ac..0000000
--- a/backend/.idea/.idea.bragapi/.idea/indexLayout.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- ../../bragalund_blog
-
-
-
-
-
\ No newline at end of file
diff --git a/backend/.idea/.idea.bragapi/.idea/projectSettingsUpdater.xml b/backend/.idea/.idea.bragapi/.idea/projectSettingsUpdater.xml
deleted file mode 100644
index 4bb9f4d..0000000
--- a/backend/.idea/.idea.bragapi/.idea/projectSettingsUpdater.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/backend/bragapi-tests/Controllers/SwaggerTests.cs b/backend/bragapi-tests/Controllers/SwaggerTests.cs
new file mode 100644
index 0000000..8624759
--- /dev/null
+++ b/backend/bragapi-tests/Controllers/SwaggerTests.cs
@@ -0,0 +1,34 @@
+using System.Net;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Testing;
+using Microsoft.Extensions.Hosting;
+using Microsoft.VisualStudio.TestPlatform.TestHost;
+using Xunit;
+
+namespace bragapi_tests.Controllers
+{
+ public class SwaggerTests
+ {
+ [Fact]
+ public async Task GetSwaggerUI_Returns_OK()
+ {
+ await using var application = new BragaApiApplication();
+
+ var client = application.CreateClient();
+ var response = await client.GetAsync("/swagger/index.html");
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ }
+
+ class BragaApiApplication : WebApplicationFactory
+ {
+ protected override IHost CreateHost(IHostBuilder builder)
+ {
+ // Add mock/test services to the builder here
+ builder.ConfigureServices(services => { });
+
+ return base.CreateHost(builder);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/backend/bragapi-tests/Controllers/WeatherForecastControllerTests.cs b/backend/bragapi-tests/Controllers/WeatherForecastControllerTests.cs
new file mode 100644
index 0000000..2de20ba
--- /dev/null
+++ b/backend/bragapi-tests/Controllers/WeatherForecastControllerTests.cs
@@ -0,0 +1,35 @@
+using System.Net;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Testing;
+using Microsoft.Extensions.Hosting;
+using Microsoft.VisualStudio.TestPlatform.TestHost;
+using Xunit;
+
+namespace bragapi_tests.Controllers
+{
+ public class WeatherForecastControllerTests
+ {
+
+ [Fact]
+ public async Task GetWeatherForecast_WhenRequested_ShouldReturnArray()
+ {
+ await using var application = new BragaApiApplication();
+
+ var client = application.CreateClient();
+ var response = await client.GetAsync("/WeatherForecast");
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ }
+ class BragaApiApplication : WebApplicationFactory
+ {
+ protected override IHost CreateHost(IHostBuilder builder)
+ {
+ // Add mock/test services to the builder here
+ builder.ConfigureServices(services => { });
+
+ return base.CreateHost(builder);
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/backend/bragapi-tests/UnitTest1.cs b/backend/bragapi-tests/UnitTest1.cs
index 10af7f1..37dba73 100644
--- a/backend/bragapi-tests/UnitTest1.cs
+++ b/backend/bragapi-tests/UnitTest1.cs
@@ -1,12 +1,14 @@
using Xunit;
-namespace bragapi_tests;
-
-public class UnitTest1
+namespace bragapi_tests
{
- [Fact]
- public void Test1()
+
+ public class UnitTest1
{
+ [Fact]
+ public void Test1()
+ {
+ }
}
}
\ No newline at end of file
diff --git a/backend/bragapi-tests/bragapi-tests.csproj b/backend/bragapi-tests/bragapi-tests.csproj
index 19ddc41..f4ee89e 100644
--- a/backend/bragapi-tests/bragapi-tests.csproj
+++ b/backend/bragapi-tests/bragapi-tests.csproj
@@ -9,6 +9,7 @@
+
@@ -21,4 +22,9 @@
+
+
+
+
+
diff --git a/backend/bragapi/Controllers/WeatherForecastController.cs b/backend/bragapi/Controllers/WeatherForecastController.cs
index f17dfd2..0122541 100644
--- a/backend/bragapi/Controllers/WeatherForecastController.cs
+++ b/backend/bragapi/Controllers/WeatherForecastController.cs
@@ -1,32 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
-namespace bragapi.Controllers;
-
-[ApiController]
-[Route("[controller]")]
-public class WeatherForecastController : ControllerBase
+namespace bragapi.Controllers
{
- private static readonly string[] Summaries = new[]
+ [ApiController]
+ [Route("[controller]")]
+ public class WeatherForecastController : ControllerBase
{
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
+ private static readonly string[] Summaries =
+ {
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
- private readonly ILogger _logger;
+ private readonly ILogger _logger;
- public WeatherForecastController(ILogger logger)
- {
- _logger = logger;
- }
+ public WeatherForecastController(ILogger logger)
+ {
+ _logger = logger;
+ }
- [HttpGet(Name = "GetWeatherForecast")]
- public IEnumerable Get()
- {
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ [HttpGet(Name = "GetWeatherForecast")]
+ public IEnumerable Get()
{
- Date = DateTime.Now.AddDays(index),
- TemperatureC = Random.Shared.Next(-20, 55),
- Summary = Summaries[Random.Shared.Next(Summaries.Length)]
- })
- .ToArray();
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateTime.Now.AddDays(index),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
}
-}
+}
\ No newline at end of file
diff --git a/backend/bragapi/Program.cs b/backend/bragapi/Program.cs
index 15eacee..6f0b85f 100644
--- a/backend/bragapi/Program.cs
+++ b/backend/bragapi/Program.cs
@@ -1,3 +1,7 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -22,4 +26,4 @@
app.MapControllers();
-app.Run();
+app.Run();
\ No newline at end of file
diff --git a/backend/bragapi/WeatherForecast.cs b/backend/bragapi/WeatherForecast.cs
index fbef74f..0f6cdeb 100644
--- a/backend/bragapi/WeatherForecast.cs
+++ b/backend/bragapi/WeatherForecast.cs
@@ -1,12 +1,16 @@
-namespace bragapi;
+using System;
-public class WeatherForecast
+namespace bragapi
{
- public DateTime Date { get; set; }
- public int TemperatureC { get; set; }
+ public class WeatherForecast
+ {
+ public DateTime Date { get; set; }
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+ public int TemperatureC { get; set; }
- public string? Summary { get; set; }
-}
+ public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+
+ public string? Summary { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/backend/bragapi/bragapi.csproj b/backend/bragapi/bragapi.csproj
index 4289e82..05df6a3 100644
--- a/backend/bragapi/bragapi.csproj
+++ b/backend/bragapi/bragapi.csproj
@@ -1,13 +1,17 @@
-
- net6.0
- enable
- enable
-
-
-
-
-
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+