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
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
build-and-test:
runs-on: ubuntu-latest

env:
# Program.cs throws without a connection string. EF tools build the host
# to read the model; this value is never used to connect.
ConnectionStrings__Default: "Host=localhost;Database=ci;Username=ci;Password=ci"

steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -22,8 +27,23 @@ jobs:
- name: Restore
run: dotnet restore

- name: Check formatting
run: dotnet format --verify-no-changes --no-restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
run: dotnet test --no-build --configuration Release --verbosity normal

- name: Install EF Core tools
run: dotnet tool install --global dotnet-ef

- name: Check migrations are up to date
run: >
dotnet ef migrations has-pending-model-changes
--project src/Modules/Identity/Infrastructure
--startup-project src/Host
--context IdentityDbContext
--configuration Release
--no-build
3 changes: 1 addition & 2 deletions src/Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@
app.UseHttpsRedirection();


app.Run();

app.Run();
2 changes: 1 addition & 1 deletion src/Modules/Identity/Api/AssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Api;
/// <summary>Marker used by architecture tests to locate this assembly.</summary>
public static class AssemblyReference
{
}
}
2 changes: 1 addition & 1 deletion src/Modules/Identity/Application/AssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Application;
/// <summary>Marker used by architecture tests to locate this assembly.</summary>
public static class AssemblyReference
{
}
}
2 changes: 1 addition & 1 deletion src/Modules/Identity/Contracts/AssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Contracts;
/// <summary>Marker used by architecture tests to locate this assembly.</summary>
public static class AssemblyReference
{
}
}
2 changes: 1 addition & 1 deletion src/Modules/Identity/Domain/AssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Domain;
/// <summary>Marker used by architecture tests to locate this assembly.</summary>
public static class AssemblyReference
{
}
}
2 changes: 1 addition & 1 deletion src/Modules/Identity/Infrastructure/AssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Infrastructure;
/// <summary>Marker used by architecture tests to locate this assembly.</summary>
public static class AssemblyReference
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Basira.Modules.Identity.Infrastructure.Persistence.Configurations;

internal sealed class OrganizationConfiguration : IEntityTypeConfiguration<Organization>
{
public void Configure(EntityTypeBuilder<Organization> builder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public void Configure(EntityTypeBuilder<User> builder)
.HasForeignKey(u => u.OrganizationId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(u => u.Email).IsUnique();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;

using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable
Expand Down Expand Up @@ -74,4 +75,4 @@ protected override void Down(MigrationBuilder migrationBuilder)
schema: "identity");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ protected override void Down(MigrationBuilder migrationBuilder)
unique: true);
}
}
}
}
2 changes: 2 additions & 0 deletions tests/Architecture.Tests/IdentityModuleTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Reflection;

using NetArchTest.Rules;

using Xunit;

namespace Basira.Architecture.Tests;
Expand Down
4 changes: 2 additions & 2 deletions tests/Identity.UnitTests/OrganizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void Rename_with_valid_name_trims_and_updates_name()
org.Rename(" Acme2 ");

Assert.Equal("Acme2", org.Name);

}
[Theory]
[InlineData("")]
Expand All @@ -60,7 +60,7 @@ public void Rename_with_too_long_name_throws()
var org = Organization.Create(" Acme ", Now);

var name = new string('a', Organization.NameMaxLength + 1);

Assert.Throws<DomainException>(() => org.Rename(name));
}

Expand Down