Skip to content

Commit

Permalink
Testing primary constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
LeftTwixWand committed Nov 16, 2023
1 parent 583da28 commit c680db9
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@

namespace Inventory.Persistence.Database.Projections;

public sealed class ActualProductQuantityProjection : IWarehouseAccountant
public sealed class ActualProductQuantityProjection(IReadOnlyCollection<WarehouseEventBase> domainEvents, Snapshot snapshot) : IWarehouseAccountant

Check failure on line 8 in src/Inventory.Persistence/Inventory.Persistence.Database/Projections/ActualProductQuantityProjection.cs

View workflow job for this annotation

GitHub Actions / build

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
{
private readonly IReadOnlyCollection<WarehouseEventBase> _domainEvents;
private int quantity;

public ActualProductQuantityProjection(IReadOnlyCollection<WarehouseEventBase> domainEvents, Snapshot snapshot)
{
_domainEvents = domainEvents;
quantity = snapshot.Quantity;
}
private int quantity = snapshot.Quantity;

public int GetActualProductQuantity()
{
foreach (var domainEvent in _domainEvents)
foreach (var domainEvent in domainEvents)
{
quantity = domainEvent switch
{
Expand Down

0 comments on commit c680db9

Please sign in to comment.