Skip to content

Commit d069659

Browse files
authored
Merge pull request #1 from isaacOjeda/codex/detectar-y-corregir-error-en-código
Fix domain event timestamp and test data
2 parents c275840 + 59558c5 commit d069659

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Application/Domain/DomainEvent.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ protected DomainEvent()
1313
{
1414
DateOccurred = DateTimeOffset.UtcNow;
1515
}
16+
1617
public bool IsPublished { get; set; }
17-
public DateTimeOffset DateOccurred { get; protected set; } = DateTime.UtcNow;
18+
19+
// Using DateTimeOffset to ensure timezone information is preserved
20+
public DateTimeOffset DateOccurred { get; protected set; } = DateTimeOffset.UtcNow;
1821
}

tests/Application.Unit.Tests/Features/Products/EventHandlers/PriceChangedEventHandlerTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ public class PriceChangedEventHandlerTests
1313
[Test]
1414
public void PriceChangedEvent_LoggerCalled()
1515
{
16-
// Arrenge
17-
var domainEvent = new ProductUpdatePriceEvent(It.IsAny<Product>());
16+
// Arrange
17+
var product = new Product(0, "Test", "Desc", 10, 1);
18+
var domainEvent = new ProductUpdatePriceEvent(product);
1819
var handler = new PriceChangedEventHandler(Mock.Of<ILogger<PriceChangedEventHandler>>());
1920

2021
// Act

0 commit comments

Comments
 (0)