/// <summary> /// Maps the domain entity to the event store entity. /// </summary> /// <remarks> /// This method should map the entity keys only. The events are handled automatically. /// </remarks> /// <param name="domainEntity"> /// The domain entity to be mapped. /// </param> /// <param name="eventStoreEntity"> /// The event store entity to be initialized after the domain entity. /// </param> protected virtual void MapEventStoreEntity(TDomainEntity domainEntity, TEventStoreEntity eventStoreEntity) { Check.NotNull(domainEntity, nameof(domainEntity)); Check.NotNull(eventStoreEntity, nameof(eventStoreEntity)); PropertiesMapper.Map(domainEntity, eventStoreEntity); }
public void Map_NonMatchingNames_PropertiesValuesNotCopied() { var source = new { Key = 123, Price = 13.5 }; var dest = new Book(); Action act = () => PropertiesMapper.Map(source, dest); act.Should().NotThrow(); }
public void Map_PrefixedNames_PropertiesValuesCopied() { var source = new { EntityId = 123, BookTitle = "Silverback for Dummies" }; var dest = new Book(); PropertiesMapper.Map(source, dest); dest.Id.Should().Be(123); dest.Title.Should().Be("Silverback for Dummies"); }
public void Map_MatchingNames_PropertiesValuesCopied() { var source = new { Id = 123, Title = "Silverback for Dummies", Published = DateTime.Today, Pages = 13 }; var dest = new Book(); PropertiesMapper.Map(source, dest); dest.Id.Should().Be(123); dest.Title.Should().Be("Silverback for Dummies"); dest.Published.Should().Be(DateTime.Today); dest.Pages.Should().Be(13); }