Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
323fe96
fix: remove mandatory secrets validation from PR workflow
Nov 27, 2025
c0d798e
docs: update roadmap and create Sprint 2 detailed tasks
Nov 27, 2025
e021447
feat: create Bruno API collections for Documents and SearchProviders …
Nov 27, 2025
abf366f
feat: complete Bruno API collections for ServiceCatalogs and Location…
Nov 27, 2025
fb2e63d
chore: update MigrationTool to use Central Package Management
Nov 27, 2025
683dcc0
feat: add all module DbContexts to MigrationTool
Nov 27, 2025
5ea45f0
docs: organize Sprint 1 documentation and update API collections README
Nov 27, 2025
9f55b63
fix: resolve ServiceCatalogs integration test failures (duplicate key…
Nov 27, 2025
5aea927
fix: enable PostGIS support in test containers
Nov 27, 2025
2ad85e9
chore: standardize PostgreSQL image to postgis/postgis:16-3.4 across …
Nov 27, 2025
e49a682
feat: add Azurite TestContainer for Documents E2E tests
Nov 27, 2025
2f7310e
fix(tests): resolve authentication race condition by clearing context…
Nov 27, 2025
7c81915
fix(tests): resolve IBGE geographic restriction test by fixing Allowe…
Nov 27, 2025
bd368b3
docs: archive skipped tests documentation and create resolution summary
Nov 27, 2025
a19ae06
fix: address code review feedback across multiple components
Nov 27, 2025
0cdd6b5
docs: apply code review feedback for documentation quality
Nov 27, 2025
225cb43
refactor(tests): improve ServiceCatalogs test data generation with sh…
Nov 27, 2025
ff9bce9
fix(ci): resolve workflow and formatting issues
Nov 27, 2025
332f3f4
docs: update README.md and configure test coverage
Nov 27, 2025
8b1186e
fix: code review corrections
Nov 27, 2025
32de9a5
test(providers): add unit tests for command handlers
Nov 27, 2025
3a0bab3
test(providers): add comprehensive validator tests - increase coverag…
Nov 27, 2025
45c5608
chore: remove duplicate migrations
Nov 27, 2025
5928a0e
test(providers): add handler tests for CompleteBasicInfo and SetPrima…
Nov 28, 2025
17d8164
fix: resolve CI/CD validation and test issues
Nov 28, 2025
144f145
refactor: apply code review suggestions
Nov 28, 2025
7cc9eb6
refactor: improve code quality and test coverage
Nov 28, 2025
a203d35
test: add comprehensive GetProviderByDocumentQueryHandler tests
Nov 28, 2025
1d4b1c2
test: add query handler tests for GetProvidersByCity, GetProvidersByS…
Nov 28, 2025
c52073c
fix: correct migration file encoding for dotnet format compliance
Nov 28, 2025
fc964b9
test: add [Trait("Category", "Unit")] to all Domain tests and create …
Nov 28, 2025
25d799a
fix: correct OccurredAt property name in Document events tests
Nov 28, 2025
3b7d549
fix: corrige mocks ProviderId e assertions DocumentNumber
Nov 28, 2025
5f83493
refactor: aplica melhorias sugeridas nos testes
Nov 28, 2025
b91729c
fix: corrige configuração GeographicRestriction para formato correto
Nov 28, 2025
493e244
fix: corrige workflow shell script e documenta\u00e7\u00e3o de testes
Nov 28, 2025
2aa55c5
refactor: aplica melhorias da code review
Nov 28, 2025
2bf6eae
fix: corrige erros críticos de CI/CD
Nov 28, 2025
79b1b66
refactor: aplica recomenda\u00e7\u00f5es de code review
Nov 28, 2025
79d8d5e
feat: adiciona testes Domain para Locations IBGE models
Nov 28, 2025
9040e8d
feat: adiciona 11 testes Provider Domain Events restantes
Nov 28, 2025
867c4dc
fix: adiciona delays para eventual consistency em testes E2E + testes…
Nov 28, 2025
c069f06
fix: corrige testes unitários Providers
Nov 28, 2025
a8d8642
refactor: apply code review improvements
Nov 28, 2025
789afd3
fix: improve error handling and fix PostgreSQL integration tests
Nov 28, 2025
5570398
fix: resolve DocumentsVerificationE2ETests failures
Nov 28, 2025
1e03e05
fix: update unit tests to match improved error handling
Nov 28, 2025
fba3cb0
style: fix code formatting issues
Nov 28, 2025
fe94b28
fix: address code review feedback on error handling
Nov 28, 2025
e98fab5
refactor: implement code review improvements
Nov 28, 2025
f4e5f56
feat(tests): Implement E2E TestContainerFixture and improve CI/CD cov…
Nov 28, 2025
1ef5322
docs: Consolidate testing documentation and remove duplicates
Nov 28, 2025
7862c5c
fix: Address code review feedback
Nov 28, 2025
26b11e7
fix: Address CI/CD issues from code review
Nov 28, 2025
e68f1be
fix: Sanitize connection strings and fix FluentAssertions usage
Nov 28, 2025
9b0656c
fix: Suppress PendingModelChangesWarning in E2E tests
Nov 28, 2025
480cbf2
test: Add GetProvidersQueryHandler and GetUsersByIdsQueryHandler tests
Nov 28, 2025
d6e8794
fix: Address code review feedback
Nov 28, 2025
3b0e247
fix: Correct PagedResult parameter order in GetProvidersQueryHandler
Nov 28, 2025
a202d49
test: Add AddressTests for Providers module
Nov 28, 2025
53d7a29
test: Add 3 unit repository tests (68 tests total)
Nov 28, 2025
e7cc56f
fix: address code review feedback
Nov 28, 2025
9c189ec
refactor(tests): apply code review improvements
Nov 28, 2025
799160f
refactor(tests): apply code review improvements - polling strategy
Nov 28, 2025
3825ca1
fix(tests): resolve compilation error and remove magic number
Nov 28, 2025
b36dabf
refactor(tests): use enum directly and improve assertions
Nov 28, 2025
b074635
refactor(tests): apply final code review improvements
Nov 28, 2025
7e5c0f2
fix(coverage): add filters to exclude generated code (OpenApi, RegexG…
Nov 29, 2025
9521a5a
feat(tests): add SearchProviders API integration tests (10 tests)
Nov 29, 2025
d293a5d
feat(tests): add 5 Documents API integration tests
Nov 29, 2025
e81eb97
feat(tests): add 10 API integration tests for Providers and ServiceCa…
Nov 29, 2025
d6bcb5e
feat(tests): add 22 repository unit tests for Providers and Documents
Nov 29, 2025
e02bb4d
feat(tests): add 28 Shared component unit tests
Nov 29, 2025
6bd6912
feat(tests): add 46 extension method unit tests
Nov 29, 2025
65e50dd
feat(tests): add 13 Shared exception unit tests
Nov 29, 2025
83d5bce
feat(tests): add 33 Shared infrastructure unit tests
Nov 29, 2025
87bd27c
feat(tests): add 18 SearchProviders domain unit tests
Nov 29, 2025
4e6485a
feat(tests): add 44 Shared Contracts unit tests
Nov 29, 2025
ad0de2e
refactor(tests): fix API inconsistencies and improve test quality
Nov 29, 2025
861d448
fix(formatting): resolve pipeline formatting errors and add XML docs
Nov 30, 2025
ef4c933
refactor(tests): implement code review improvements
Nov 30, 2025
0f15b5d
feat(tests): add repository integration tests with real database
Nov 30, 2025
8cebc98
refactor(tests): apply code review improvements
Nov 30, 2025
75131e9
feat(tests): add repository integration tests for Users and ServiceCa…
Nov 30, 2025
6dcb391
docs(tests): add XML documentation to GetByProviderIdAsync test
Nov 30, 2025
57273ee
refactor(tests): improve integration test robustness and documentation
Nov 30, 2025
2e3ac98
docs: fix broken markdown links and standardize kebab-case naming
Nov 30, 2025
d5fa00f
docs: clean up redundant and obsolete documentation
Nov 30, 2025
b56f39a
fix(tests): add retry logic for PostgreSQL startup timing issue
Nov 30, 2025
34a4643
test: add 44 comprehensive edge case tests for Provider Entity
Nov 30, 2025
5c72cb3
test: add comprehensive tests for SecurityExtensions (0% → 95%+ cover…
Nov 30, 2025
c858856
test: add comprehensive tests for PermissionMetricsService (0% → 95%+…
Nov 30, 2025
6c0d6ae
test: add comprehensive tests for ProviderConfiguration (0% → 95%+ co…
Nov 30, 2025
40881fc
test: add comprehensive tests for KeycloakExtensions (0% → 95%+ cover…
Nov 30, 2025
ea6d12f
test: add comprehensive tests for DocumentationExtensions (0% → 95%+ …
Nov 30, 2025
d049a15
test: add comprehensive tests for ServiceDefaults Extensions (0% → ~7…
Nov 30, 2025
65189d3
fix: code review corrections - formatting, links, and documentation
Nov 30, 2025
d1127e5
test: add comprehensive PerformanceExtensions tests (64 tests, ~95% c…
Nov 30, 2025
f041264
test: add comprehensive PerformanceExtensions tests (64 tests, ~95% c…
Nov 30, 2025
ce09759
test: add comprehensive ModuleTagsDocumentFilter tests (35 tests, ~95…
Nov 30, 2025
12f6762
refactor: code review fixes - improve test quality and documentation
Nov 30, 2025
5242b2d
fix: add missing ILogger registration in PermissionMetricsServiceTests
Nov 30, 2025
5d2b8db
test: add MessagingExtensions tests (Options classes)
Nov 30, 2025
5ca791c
test: add comprehensive tests for PermissionOptimizationMiddleware (4…
Nov 30, 2025
06be765
test: add comprehensive SearchableProvider entity tests (51 tests)
Nov 30, 2025
238893b
test: add RateLimitingMiddleware tests (26 tests, 13 passing) - WIP
Nov 30, 2025
85b12e7
style: fix code formatting (whitespace)
Nov 30, 2025
316a557
chore: remove RateLimitingMiddlewareTests (cache isolation issues)
Nov 30, 2025
1708094
refactor(tests): apply code review fixes
Nov 30, 2025
89faa54
ci(coverage): include Shared and ApiService tests in coverage collection
Nov 30, 2025
dfaa3fd
fix(tests): resolve ApiService.Tests failures (IWebHostEnvironment, v…
Nov 30, 2025
c73d186
refactor(tests): apply code review feedback
Nov 30, 2025
302ee90
test(shared): add 15 tests for ModuleApiRegistry and PerformanceHealt…
Dec 1, 2025
6a9ce4b
chore: implement code review feedback
Dec 1, 2025
cdecc23
test(shared): add 11 tests for PermissionSystemHealthCheck
Dec 1, 2025
ee0ace9
fix(workflow): correct XPlat Code Coverage filter syntax and update T…
Dec 1, 2025
4ec68a2
test: add comprehensive AuthorizationExtensions unit tests (22 tests)
Dec 1, 2025
73f4391
test: add PermissionClaimsTransformation and PermissionRequirementHan…
Dec 1, 2025
51757ea
style: fix code formatting (imports ordering and whitespace)
Dec 1, 2025
4949a6a
test: unskip ClockSkew test, add Keycloak null guard tests, fix workf…
Dec 1, 2025
df04368
refactor: remove permanently skipped CORS test and update STRICT_COVE…
Dec 1, 2025
4ecba35
refactor: simplify tests by removing duplicate ServiceProvider builds
Dec 1, 2025
91b327f
fix: correct find syntax for recursive coverage file search
Dec 1, 2025
60dc95c
fix: register IConfiguration in simplified tests
Dec 1, 2025
6483a8f
fix: correct find syntax for recursive coverage file search
Dec 1, 2025
bd4dda2
fix(ci): add retry logic and fallback for OSV-Scanner installation
Dec 1, 2025
06d281f
docs: link STRICT_COVERAGE TODO to tracking issue #33
Dec 1, 2025
66890e5
Merge branch 'improve-tests-coverage' of https://github.com/frigini/M…
Dec 1, 2025
3422224
style(ci): remove trailing whitespace from OSV-Scanner installation b…
Dec 1, 2025
ec078f7
test: add 24 comprehensive GlobalExceptionHandler tests (+8-10% cover…
Dec 1, 2025
33ee244
test: add 13 comprehensive CommandDispatcher tests (+4-5% coverage)
Dec 1, 2025
0c24736
test: add 11 comprehensive DomainEventProcessor tests (+3-4% coverage)
Dec 1, 2025
4530a99
test: add 9 comprehensive QueryDispatcher tests (+3% coverage)
Dec 1, 2025
422cdb5
test: add 14 comprehensive ServiceBusMessageBus tests (+4-5% coverage)
Dec 1, 2025
b14fc50
test: add 8 comprehensive EventTypeRegistry tests (+2-3% coverage)
Dec 1, 2025
ba440d1
test: add 11 comprehensive TopicStrategySelector tests (+3% coverage)
Dec 1, 2025
febe334
test: add 9 comprehensive ValidationBehavior tests (+2-3% coverage)
Dec 1, 2025
9789a32
ci: enable all domain module tests in coverage pipeline
Dec 1, 2025
4e66bcd
docs(api): add comprehensive XML documentation to QueryDispatcher
Dec 1, 2025
0ef104e
fix(ci): correct coverage Include/Exclude filters to use wildcard syntax
Dec 1, 2025
c86ff44
docs(api): add singleton lifetime recommendation to QueryDispatcher
Dec 1, 2025
2fe4895
fix(ci): remove --no-build from module tests and add coverage debug l…
Dec 1, 2025
7d73642
refactor(ci): extract coverage validation to reusable action
Dec 1, 2025
1319fff
fix(ci): handle edge case for coverage decimal values without leading…
Dec 1, 2025
c116e4b
refactor(ci): apply code review improvements to coverage validation
Dec 1, 2025
bb9f162
chore: merge master to get workflow updates for coverage collection
Dec 1, 2025
3945b4f
test: add 30 unit tests for Shared coverage gaps
Dec 1, 2025
726318f
revert: remove incompilable test files
Dec 1, 2025
6de4fc8
chore: trigger pipeline with updated workflow
Dec 1, 2025
6e3705d
test: add 39 unit tests for Shared core classes
Dec 1, 2025
5acb4d8
fix: resolve ValidationException namespace ambiguity
Dec 1, 2025
b0d6849
style: fix code formatting issues
Dec 2, 2025
e66152a
docs: add comprehensive code coverage roadmap and analysis
Dec 2, 2025
dcf08f7
docs: fix corrupted text and reorganize coverage projections
Dec 2, 2025
342067e
docs: fix formatting inconsistencies and add Phase 5 roadmap
Dec 2, 2025
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
Prev Previous commit
Next Next commit
feat(tests): add 46 extension method unit tests
EnumExtensionsTests (24 tests):
- ToEnum with valid/invalid values
- ToEnum with case sensitivity
- ToEnumOrDefault behavior
- IsValidEnum validation
- GetValidValues and descriptions

DocumentExtensionsTests (22 tests):
- CPF validation (valid/invalid formats)
- CNPJ validation (valid/invalid formats)
- CPF/CNPJ generation
- Special character handling
- Repeated digits detection

All tests passing - increases Shared Extensions coverage
  • Loading branch information
Filipe Frigini committed Nov 29, 2025
commit 6bd69128b7d665f1cf3bb85bb5b883974ce800f4
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
using FluentAssertions;
using MeAjudaAi.Shared.Extensions;

namespace MeAjudaAi.Shared.Tests.Unit.Extensions;

public class DocumentExtensionsTests
{
[Theory]
[InlineData("111.444.777-35")] // Valid CPF with formatting
[InlineData("11144477735")] // Valid CPF without formatting
[InlineData("529.982.247-25")] // Another valid CPF
public void IsValidCpf_WithValidCpf_ShouldReturnTrue(string cpf)
{
// Act
var result = cpf.IsValidCpf();

// Assert
result.Should().BeTrue();
}

[Theory]
[InlineData("000.000.000-00")] // All zeros
[InlineData("111.111.111-11")] // All same digits
[InlineData("123.456.789-00")] // Invalid check digits
[InlineData("12345678900")] // Invalid length digits
[InlineData("123")] // Too short
[InlineData("")] // Empty
[InlineData(null)] // Null
[InlineData(" ")] // Whitespace
[InlineData("abc.def.ghi-jk")] // Non-numeric
public void IsValidCpf_WithInvalidCpf_ShouldReturnFalse(string cpf)
{
// Act
var result = cpf.IsValidCpf();

// Assert
result.Should().BeFalse();
}

[Theory]
[InlineData("11.222.333/0001-81")] // Valid CNPJ with formatting
[InlineData("11222333000181")] // Valid CNPJ without formatting
[InlineData("34.028.316/0001-03")] // Another valid CNPJ
public void IsValidCnpj_WithValidCnpj_ShouldReturnTrue(string cnpj)
{
// Act
var result = cnpj.IsValidCnpj();

// Assert
result.Should().BeTrue();
}

[Theory]
[InlineData("00.000.000/0000-00")] // All zeros
[InlineData("11.111.111/1111-11")] // All same digits
[InlineData("12.345.678/0001-00")] // Invalid check digits
[InlineData("123456780001")] // Invalid length
[InlineData("123")] // Too short
[InlineData("")] // Empty
[InlineData(null)] // Null
[InlineData(" ")] // Whitespace
[InlineData("ab.cde.fgh/ijkl-mn")] // Non-numeric
public void IsValidCnpj_WithInvalidCnpj_ShouldReturnFalse(string cnpj)
{
// Act
var result = cnpj.IsValidCnpj();

// Assert
result.Should().BeFalse();
}

[Fact]
public void GenerateValidCpf_ShouldReturnValidCpf()
{
// Act
var cpf = DocumentExtensions.GenerateValidCpf();

// Assert
cpf.Should().NotBeNullOrEmpty();
cpf.Length.Should().Be(11);
cpf.IsValidCpf().Should().BeTrue();
}

[Fact]
public void GenerateValidCnpj_ShouldReturnValidCnpj()
{
// Act
var cnpj = DocumentExtensions.GenerateValidCnpj();

// Assert
cnpj.Should().NotBeNullOrEmpty();
cnpj.Length.Should().Be(14);
cnpj.IsValidCnpj().Should().BeTrue();
}

[Fact]
public void GenerateValidCpf_ShouldReturnDifferentValues()
{
// Act
var cpf1 = DocumentExtensions.GenerateValidCpf();
var cpf2 = DocumentExtensions.GenerateValidCpf();

// Assert
cpf1.Should().NotBe(cpf2);
}

[Fact]
public void GenerateValidCnpj_ShouldReturnDifferentValues()
{
// Act
var cnpj1 = DocumentExtensions.GenerateValidCnpj();
var cnpj2 = DocumentExtensions.GenerateValidCnpj();

// Assert
cnpj1.Should().NotBe(cnpj2);
}

[Fact]
public void IsValidCpf_WithFormatting_ShouldIgnoreSpecialCharacters()
{
// Arrange
var cpfWithDots = "111.444.777-35";
var cpfWithoutDots = "11144477735";

// Act & Assert
cpfWithDots.IsValidCpf().Should().Be(cpfWithoutDots.IsValidCpf());
}

[Fact]
public void IsValidCnpj_WithFormatting_ShouldIgnoreSpecialCharacters()
{
// Arrange
var cnpjWithDots = "11.222.333/0001-81";
var cnpjWithoutDots = "11222333000181";

// Act & Assert
cnpjWithDots.IsValidCnpj().Should().Be(cnpjWithoutDots.IsValidCnpj());
}

[Theory]
[InlineData("222.222.222-22")]
[InlineData("333.333.333-33")]
[InlineData("444.444.444-44")]
public void IsValidCpf_WithRepeatedDigits_ShouldReturnFalse(string cpf)
{
// Act
var result = cpf.IsValidCpf();

// Assert
result.Should().BeFalse();
}

[Theory]
[InlineData("22.222.222/2222-22")]
[InlineData("33.333.333/3333-33")]
[InlineData("44.444.444/4444-44")]
public void IsValidCnpj_WithRepeatedDigits_ShouldReturnFalse(string cnpj)
{
// Act
var result = cnpj.IsValidCnpj();

// Assert
result.Should().BeFalse();
}
}
Loading