@@ -9,12 +9,18 @@ class SentryCoreDataTrackerTests: XCTestCase {
99 func getSut( ) -> SentryCoreDataTracker {
1010 return SentryCoreDataTracker ( )
1111 }
12-
12+
1313 func testEntity( ) -> TestEntity {
1414 let entityDescription = NSEntityDescription ( )
1515 entityDescription. name = " TestEntity "
1616 return TestEntity ( entity: entityDescription, insertInto: context)
1717 }
18+
19+ func secondTestEntity( ) -> SecondTestEntity {
20+ let entityDescription = NSEntityDescription ( )
21+ entityDescription. name = " SecondTestEntity "
22+ return SecondTestEntity ( entity: entityDescription, insertInto: context)
23+ }
1824 }
1925
2026 private var fixture : Fixture !
@@ -72,68 +78,68 @@ class SentryCoreDataTrackerTests: XCTestCase {
7278 }
7379
7480 func test_Save_1Insert_1Entity( ) {
75- fixture. context. inserted = [ TestEntity ( ) ]
81+ fixture. context. inserted = [ fixture . testEntity ( ) ]
7682 assertSave ( " INSERTED 1 'TestEntity' " )
7783 }
7884
7985 func test_Save_2Insert_1Entity( ) {
80- fixture. context. inserted = [ TestEntity ( ) , TestEntity ( ) ]
86+ fixture. context. inserted = [ fixture . testEntity ( ) , fixture . testEntity ( ) ]
8187 assertSave ( " INSERTED 2 'TestEntity' " )
8288 }
8389
8490 func test_Save_2Insert_2Entity( ) {
85- fixture. context. inserted = [ TestEntity ( ) , SecondTestEntity ( ) ]
91+ fixture. context. inserted = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
8692 assertSave ( " INSERTED 2 items " )
8793 }
8894
8995 func test_Save_1Update_1Entity( ) {
90- fixture. context. updated = [ TestEntity ( ) ]
96+ fixture. context. updated = [ fixture . testEntity ( ) ]
9197 assertSave ( " UPDATED 1 'TestEntity' " )
9298 }
9399
94100 func test_Save_2Update_1Entity( ) {
95- fixture. context. updated = [ TestEntity ( ) , TestEntity ( ) ]
101+ fixture. context. updated = [ fixture . testEntity ( ) , fixture . testEntity ( ) ]
96102 assertSave ( " UPDATED 2 'TestEntity' " )
97103 }
98104
99105 func test_Save_2Update_2Entity( ) {
100- fixture. context. updated = [ TestEntity ( ) , SecondTestEntity ( ) ]
106+ fixture. context. updated = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
101107 assertSave ( " UPDATED 2 items " )
102108 }
103109
104110 func test_Save_1Delete_1Entity( ) {
105- fixture. context. deleted = [ TestEntity ( ) ]
111+ fixture. context. deleted = [ fixture . testEntity ( ) ]
106112 assertSave ( " DELETED 1 'TestEntity' " )
107113 }
108114
109115 func test_Save_2Delete_1Entity( ) {
110- fixture. context. deleted = [ TestEntity ( ) , TestEntity ( ) ]
116+ fixture. context. deleted = [ fixture . testEntity ( ) , fixture . testEntity ( ) ]
111117 assertSave ( " DELETED 2 'TestEntity' " )
112118 }
113119
114120 func test_Save_2Delete_2Entity( ) {
115- fixture. context. deleted = [ TestEntity ( ) , SecondTestEntity ( ) ]
121+ fixture. context. deleted = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
116122 assertSave ( " DELETED 2 items " )
117123 }
118124
119125 func test_Save_Insert_Update_Delete_1Entity( ) {
120- fixture. context. inserted = [ TestEntity ( ) ]
121- fixture. context. updated = [ TestEntity ( ) ]
122- fixture. context. deleted = [ TestEntity ( ) ]
126+ fixture. context. inserted = [ fixture . testEntity ( ) ]
127+ fixture. context. updated = [ fixture . testEntity ( ) ]
128+ fixture. context. deleted = [ fixture . testEntity ( ) ]
123129 assertSave ( " INSERTED 1 'TestEntity', UPDATED 1 'TestEntity', DELETED 1 'TestEntity' " )
124130 }
125131
126132 func test_Save_Insert_Update_Delete_2Entity( ) {
127- fixture. context. inserted = [ TestEntity ( ) , SecondTestEntity ( ) ]
128- fixture. context. updated = [ TestEntity ( ) , SecondTestEntity ( ) ]
129- fixture. context. deleted = [ TestEntity ( ) , SecondTestEntity ( ) ]
133+ fixture. context. inserted = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
134+ fixture. context. updated = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
135+ fixture. context. deleted = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
130136 assertSave ( " INSERTED 2 items, UPDATED 2 items, DELETED 2 items " )
131137 }
132138
133139 func test_Operation_InData( ) {
134- fixture. context. inserted = [ TestEntity ( ) , TestEntity ( ) , SecondTestEntity ( ) ]
135- fixture. context. updated = [ TestEntity ( ) , SecondTestEntity ( ) , SecondTestEntity ( ) ]
136- fixture. context. deleted = [ TestEntity ( ) , TestEntity ( ) , SecondTestEntity ( ) , SecondTestEntity ( ) , SecondTestEntity ( ) ]
140+ fixture. context. inserted = [ fixture . testEntity ( ) , fixture . testEntity ( ) , fixture . secondTestEntity ( ) ]
141+ fixture. context. updated = [ fixture . testEntity ( ) , fixture . secondTestEntity ( ) , fixture . secondTestEntity ( ) ]
142+ fixture. context. deleted = [ fixture . testEntity ( ) , fixture . testEntity ( ) , fixture . secondTestEntity ( ) , fixture . secondTestEntity ( ) , fixture . secondTestEntity ( ) ]
137143
138144 let sut = fixture. getSut ( )
139145
0 commit comments