ExpenseBllDtoFactoryTests.cs
1,179 bytes
| 1 | using App.BLL.Mappers; |
|---|---|
| 2 | using App.Domain; |
| 3 | using FluentAssertions; |
| 4 | |
| 5 | namespace App.Tests.Mappers; |
| 6 | |
| 7 | public class ExpenseBllDtoFactoryTests |
| 8 | { |
| 9 | [Fact] |
| 10 | public void Create_MapsAllScalarFields() |
| 11 | { |
| 12 | var entity = new Expense |
| 13 | { |
| 14 | Id = Guid.NewGuid(), |
| 15 | TripId = Guid.NewGuid(), |
| 16 | PaidByUserId = Guid.NewGuid(), |
| 17 | BudgetCategoryId = Guid.NewGuid(), |
| 18 | CurrencyId = Guid.NewGuid(), |
| 19 | Amount = 99.99m, |
| 20 | Description = "Taxi", |
| 21 | ExpenseDate = new DateTime(2026, 5, 2, 12, 0, 0, DateTimeKind.Utc), |
| 22 | SplitMethod = ESplitMethod.EqualAll |
| 23 | }; |
| 24 | |
| 25 | var dto = ExpenseBllDtoFactory.Create(entity); |
| 26 | |
| 27 | dto.Id.Should().Be(entity.Id); |
| 28 | dto.TripId.Should().Be(entity.TripId); |
| 29 | dto.PaidByUserId.Should().Be(entity.PaidByUserId); |
| 30 | dto.BudgetCategoryId.Should().Be(entity.BudgetCategoryId); |
| 31 | dto.CurrencyId.Should().Be(entity.CurrencyId); |
| 32 | dto.Amount.Should().Be(99.99m); |
| 33 | dto.Description.Should().Be("Taxi"); |
| 34 | dto.ExpenseDate.Should().Be(entity.ExpenseDate); |
| 35 | dto.SplitMethod.Should().Be(ESplitMethod.EqualAll); |
| 36 | } |
| 37 | } |
| 38 | |