Refactoring import methods and names

This commit is contained in:
Saul Mora
2012-03-12 17:49:04 +01:00
parent e11f2e67b0
commit e0f2492b61
7 changed files with 73 additions and 67 deletions

View File

@@ -41,19 +41,19 @@
[context MR_save];
}
- (void) testDataImport
- (void) testDataImportUsingListOfPrimaryKeyIDs
{
SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKey *testEntity = [[self testEntityClass] MR_importFromObject:self.testEntityData];
[[NSManagedObjectContext MR_defaultContext] MR_save];
assertThat([SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKey numberOfEntities], is(equalToInteger(2)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(14)));
assertThat(testEntity.mappedEntities, hasCountOf(4));
for (MappedEntity *relatedEntity in testEntity.mappedEntities)
{
assertThat(relatedEntity.sampleAttribute, containsString(@"test attribute"));
}
assertThat([SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKey numberOfEntities], is(equalToInteger(2)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(10)));
}
- (void) testDataUpdateWithLookupInfoInDataSet
@@ -67,6 +67,11 @@
assertThat(testEntity, is(notNilValue()));
assertThat(testEntity.testPrimaryKey, is(equalToInteger(84)));
assertThat(testEntity.mappedEntities, hasCountOf(5));
for (MappedEntity *relatedEntity in testEntity.mappedEntities)
{
assertThat(relatedEntity.sampleAttribute, containsString(@"test attribute"));
}
}
- (void) testDataUpdateWithoutLookupData

View File

@@ -46,7 +46,7 @@
assertThat(testRelatedEntity, is(notNilValue()));
assertThat([testRelatedEntity sampleAttribute], containsString(@"sample json file"));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(1)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(2)));
}
- (void) testUpdateMappedEntity

View File

@@ -45,7 +45,7 @@
assertThat([[testRelationship userInfo] valueForKey:kMagicalRecordImportRelationshipMapKey], is(equalTo(@"someRandomAttributeName")));
assertThat([SingleEntityRelatedToMappedEntityUsingMappedPrimaryKey numberOfEntities], is(equalToInteger(1)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(1)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(2)));
assertThat(testRelatedEntity, is(notNilValue()));
assertThat([testRelatedEntity sampleAttribute], is(containsString(@"sample json file")));
}
@@ -82,7 +82,7 @@
assertThat([[testRelationship userInfo] valueForKey:kMagicalRecordImportRelationshipPrimaryKey], is(equalTo(@"testMappedEntityID")));
assertThat([SingleEntityRelatedToMappedEntityUsingMappedPrimaryKey numberOfEntities], is(equalToInteger(1)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(1)));
assertThat([MappedEntity numberOfEntities], is(equalToInteger(2)));
assertThat([testRelatedEntity testMappedEntityID], is(equalToInteger(42)));
assertThat([testRelatedEntity sampleAttribute], containsString(@"sample json file"));
}