smart way to load entityNames from the model file

This commit is contained in:
John Rommel Estropia
2015-02-22 22:01:23 +09:00
parent f6ced13577
commit 8f77818015
8 changed files with 88 additions and 44 deletions

View File

@@ -43,7 +43,7 @@ class HardcoreDataTests: XCTestCase {
let stack = DataStack()
HardcoreData.defaultStack = stack
XCTAssertEqual(HardcoreData.defaultStack, stack, "HardcoreData.defaultStack == stack")
XCTAssert(HardcoreData.defaultStack === stack, "HardcoreData.defaultStack === stack")
switch stack.addSQLiteStore("Config1Store.sqlite", configuration: "Config1", resetStoreOnMigrationFailure: true){
@@ -99,7 +99,7 @@ class HardcoreDataTests: XCTestCase {
}
let queryExpectation = self.expectationWithDescription("Query creation")
HardcoreData.performTransaction{ (transaction) -> Void in
HardcoreData.performTransaction { (transaction) -> Void in
let obj1 = transaction.fetchOne(TestEntity1)
XCTAssertNotNil(obj1, "obj1 != nil")
@@ -130,6 +130,6 @@ class HardcoreDataTests: XCTestCase {
}
}
self.waitForExpectationsWithTimeout(10, handler: nil)
self.waitForExpectationsWithTimeout(100, handler: nil)
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7517.1" systemVersion="14C109" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
<entity name="TestEntity1" representedClassName="HardcoreDataTests.TestEntity1" syncable="YES">
<entity name="TestEntity1AAA" representedClassName="HardcoreDataTests.TestEntity1" syncable="YES">
<attribute name="testDate" optional="YES" attributeType="Date" syncable="YES"/>
<attribute name="testEntityID" attributeType="Integer 64" syncable="YES"/>
<attribute name="testNumber" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
@@ -13,13 +13,13 @@
<attribute name="testString" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<configuration name="Config1">
<memberEntity name="TestEntity1"/>
<memberEntity name="TestEntity1AAA"/>
</configuration>
<configuration name="Config2">
<memberEntity name="TestEntity2"/>
</configuration>
<elements>
<element name="TestEntity1" positionX="-63" positionY="-18" width="128" height="105"/>
<element name="TestEntity1AAA" positionX="-63" positionY="-18" width="128" height="105"/>
<element name="TestEntity2" positionX="-63" positionY="9" width="128" height="103"/>
</elements>
</model>