CurrencyBllDtoFactoryTests.cs
826 bytes
| 1 | using App.BLL.Mappers; |
|---|---|
| 2 | using App.Domain; |
| 3 | using Base.Domain; |
| 4 | using FluentAssertions; |
| 5 | |
| 6 | namespace App.Tests.Mappers; |
| 7 | |
| 8 | public class CurrencyBllDtoFactoryTests |
| 9 | { |
| 10 | [Fact] |
| 11 | public void Create_PreservesLangStrTranslations() |
| 12 | { |
| 13 | // Currency.Name is a LangStr (i18n in DB) — mapper must keep all translations |
| 14 | var name = new LangStr(); |
| 15 | name["en"] = "Euro"; |
| 16 | name["et"] = "Euro"; |
| 17 | |
| 18 | var entity = new Currency |
| 19 | { |
| 20 | Id = Guid.NewGuid(), |
| 21 | Code = "EUR", |
| 22 | Name = name, |
| 23 | Symbol = "€" |
| 24 | }; |
| 25 | |
| 26 | var dto = CurrencyBllDtoFactory.Create(entity); |
| 27 | |
| 28 | dto.Code.Should().Be("EUR"); |
| 29 | dto.Symbol.Should().Be("€"); |
| 30 | dto.Name.Translate("en").Should().Be("Euro"); |
| 31 | dto.Name.Translate("et").Should().Be("Euro"); |
| 32 | } |
| 33 | } |
| 34 | |