public void MapFieldToCollectionCorrectlyAndAddItemWhenMemberNotInitialised() { this.AssumeDataRecordsAreInitialised(); this.AssumeMemberInfoIsInitialised("EnumerableField"); this.AssumeColumnNameMappingProfileIsInitialised(); var mapper = new EntityGenericCollectionMemberMapper <Collection <InnerEntity>, InnerEntity>(this.memberInfo, this.itemMappingProfile); mapper.Map(this.entity, this.dataRecord1); mapper.Map(this.entity, this.dataRecord2); this.entity.EnumerableField.Should() .NotBeNullOrEmpty(); this.entity.EnumerableField.Should() .BeAssignableTo <Collection <InnerEntity> >(); this.entity.EnumerableField.Count() .Should() .Be(2); var first = this.entity.EnumerableField.First(); first.Id.Should() .Be(IdColumnValue1); first.TestEntityId.Should() .Be(TestEntityIdValue); first.StringProperty.Should() .Be(StringPropertyValue); first.IntProperty.Should() .Be(IntPropertyValue); var last = this.entity.EnumerableField.Last(); last.Id.Should() .Be(IdColumnValue2); last.TestEntityId.Should() .Be(TestEntityIdValue); last.StringProperty.Should() .Be(StringPropertyValue); last.IntProperty.Should() .Be(IntPropertyValue); }
private void AssumeListMemberMapperIsInitialised() { this.listMapper = new EntityGenericCollectionMemberMapper <List <InnerEntity>, InnerEntity>(this.memberInfo, this.itemMappingProfile); }