Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/WarehouseEngine.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/customize-openapi?view=aspnetcore-10.0#use-document-transformers
// Apply it as a requirement for all operations
foreach (var operation in document.Paths.Values.SelectMany(path => path.Operations))

Check warning on line 115 in src/WarehouseEngine.Api/Program.cs

View workflow job for this annotation

GitHub Actions / api-build-test

Possible null reference return.

Check warning on line 115 in src/WarehouseEngine.Api/Program.cs

View workflow job for this annotation

GitHub Actions / api-build-test

Possible null reference return.

Check warning on line 115 in src/WarehouseEngine.Api/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Possible null reference return.

Check warning on line 115 in src/WarehouseEngine.Api/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Possible null reference return.
{
if (operation.Value.Tags is not null && operation.Value.Tags.Any(tag => tag.Name == "Authenticate")) { continue; }

Expand Down Expand Up @@ -149,7 +149,10 @@
app.UseDeveloperExceptionPage();
}

await SeedData(app.Services);
if (env.EnvironmentName != "Integration")
{
await SeedData(app.Services);
}

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment() || app.Environment.EnvironmentName == "Integration")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
using WarehouseEngine.Api.Integration.Tests.Factories;
using WarehouseEngine.Application.Dtos;
using WarehouseEngine.Application.Implementations;
using WarehouseEngine.Domain.Entities;
using WarehouseEngine.Domain.Models.Auth;
using Xunit;

namespace WarehouseEngine.Api.Integration.Tests;

[Collection(nameof(DatabaseCollection))]
public class CustomerEndpointTests
{
private readonly WarehouseEngineFactory _factory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.Configuration;
using WarehouseEngine.Api.Integration.Tests.Factories;
using WarehouseEngine.Domain.Entities;
using WarehouseEngine.Domain.ValueObjects;
using WarehouseEngine.Infrastructure.DataContext;
using Xunit;

namespace WarehouseEngine.Api.Integration.Tests.Factories;

[CollectionDefinition(nameof(DatabaseCollection))]
public sealed class DatabaseCollection : ICollectionFixture<WarehouseEngineFactory>
{
// Per https://xunit.net/docs/shared-context#collection-fixture
[assembly: AssemblyFixture(typeof(WarehouseEngineFactory))]

// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
namespace WarehouseEngine.Api.Integration.Tests.Factories;

public sealed class WarehouseEngineFactory : WebApplicationFactory<Program>, IAsyncLifetime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace WarehouseEngine.Api.Integration.Tests;

[Collection(nameof(DatabaseCollection))]
public class VendorEndpointTests
{
private readonly WarehouseEngineFactory _factory;
Expand Down Expand Up @@ -308,6 +307,6 @@ public async Task OpenApi_V1Json_Success()

// Verify it's valid JSON by deserializing
var openApiDoc = JsonSerializer.Deserialize<JsonElement>(responseContent);
Assert.True(openApiDoc.ValueKind == JsonValueKind.Object);
Assert.Equal(JsonValueKind.Object, openApiDoc.ValueKind);
}
}
Loading