Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:myellow/Less-2-Do

  • Loading branch information...
commit 679159750ca4116b313a6378c68fbc2b84d442d0 2 parents 827c336 + d52a283
@myell0w authored
View
5 Classes/BaseManagedObject.m
@@ -28,6 +28,11 @@ + (BaseManagedObject *)objectOfType:(NSString *)type
+ (BOOL)deleteObject:(BaseManagedObject *)theObject error:(NSError **)error
{
+ /* show if parameter is set */
+ if(theObject == nil) {
+ *error = [NSError errorWithDomain:DAOErrorDomain code:DAOMissingParametersError userInfo:nil];
+ return NO;
+ }
theObject.deleted = [NSNumber numberWithInteger:1];
ALog(@"deleted the object: %d", [theObject.deleted integerValue]);
return YES;
View
15 Classes/Entities/Task.m
@@ -307,7 +307,20 @@ + (NSArray *)getAllTasksInStore:(NSError **)error
+ (NSArray *) getAllTasks:(NSError **)error {
NSArray* objects = [Task getTasksWithFilterPredicate:[NSPredicate predicateWithFormat:@"isCompleted == NO and deleted == NO"] error:error];
- return objects;
+ NSMutableArray *notDeleted = [NSMutableArray array];
+
+ for(Task *t in objects)
+ {
+ if([t.deleted boolValue] == NO)
+ {
+ [notDeleted addObject:t];
+ }
+ }
+
+ return [NSArray arrayWithArray:notDeleted];
+
+ //return objects;
+
}
+ (NSArray *) getStarredTasks:(NSError **)error {
View
142 ContextTest.m
@@ -49,12 +49,15 @@ - (void)testAllContextsEmpty {
}
/* adds 3 contexts - count must be 3 */
-- (void)testAddContextWithName {
+- (void)testAddContext {
NSError *error = nil;
Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.name = @"c1";
+ newContext2.name = @"c2";
+ newContext3.name = @"c3";
NSArray *contexts = [Context getAllContexts:&error];
GHAssertEquals([contexts count], (NSUInteger)3, @"Add context not successful");
@@ -83,40 +86,135 @@ - (void)testDeleteContext {
GHAssertEquals([contexts count], (NSUInteger)0, @"Delete context not successful");
}
-/* first adds a context and then updates it */
-- (void)testUpdateContext {
- Context *newContext = (Context*)[Context objectOfType:@"Context"];
+- (void)testAllContextsOrdered {
+ NSError *error = nil;
- newContext.name = @"UPDATE";
+ Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.name = @"C";
+ newContext2.name = @"A";
+ newContext3.name = @"B";
+
+ NSArray *contexts = [Context getAllContexts:&error];
+ GHAssertEquals([contexts count], (NSUInteger)3, @"Add contextnot successful");
+ NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [contexts objectAtIndex:0], [contexts objectAtIndex:1], [contexts objectAtIndex:2]];
+ GHAssertEqualStrings(output, @"0: A, 1: B, 2: C", @"Ordered Contexts not successful");
+}
+
+-(void) testGetRemoteStoredContexts
+{
+ NSError *error = nil;
- GHAssertTrue([newContext isUpdated], @"Update context not successful");
+ Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.remoteId = [NSNumber numberWithInt:-1];
+ newContext2.remoteId = [NSNumber numberWithInt:20000];
+ newContext3.remoteId = [NSNumber numberWithInt:23000];
- /*//[NSThread sleepForTimeInterval:2];
+ NSArray *contexts = [Context getRemoteStoredContexts:&error];
+ GHAssertEquals([contexts count], (NSUInteger)2, @"");
+}
+
+-(void) testGetRemoteStoredContextsLocallyDeleted
+{
+ NSError *error = nil;
- NSArray *contexts = [ContextDAO allContexts:&error];
- GHAssertEquals([contexts count], (NSUInteger)1, @"Add context not successful");
- Context *context = [contexts objectAtIndex:0];
- GHAssertEqualStrings([context name], [newContext name], @"Update context not successful"); */
+ Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.remoteId = [NSNumber numberWithInt:-1];
+ newContext2.remoteId = [NSNumber numberWithInt:20000];
+ newContext3.remoteId = [NSNumber numberWithInt:23000];
+ [Context deleteObject:newContext3 error:&error];
+
+ NSArray *contexts = [Context getRemoteStoredContextsLocallyDeleted:&error];
+ GHAssertEquals([contexts count], (NSUInteger)1, @"");
}
-- (void)testAllContextsOrdered {
+-(void) testGetLocalStoredContextsLocallyDeleted
+{
NSError *error = nil;
Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
- newContext1.name = @"Eontext";
- newContext2.name = @"Dontext";
- newContext3.name = @"Context";
-
- NSArray *contexts = [Context getAllContexts:&error];
- GHAssertEquals([contexts count], (NSUInteger)3, @"Add contextnot successful");
- NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [contexts objectAtIndex:0], [contexts objectAtIndex:1], [contexts objectAtIndex:2]];
- GHAssertEqualStrings(output, @"0: Context, 1: Dontext, 2: Eontext", @"Ordered Contexts not successful");
+ newContext1.remoteId = [NSNumber numberWithInt:-1];
+ newContext2.remoteId = [NSNumber numberWithInt:-1];
+ newContext3.remoteId = [NSNumber numberWithInt:23000];
+ [Context deleteObject:newContext2 error:&error];
+ [Context commit];
+
+ NSArray *contexts = [Context getLocalStoredContextsLocallyDeleted:&error];
+ GHAssertEquals([contexts count], (NSUInteger)1, @"");
}
+-(void) testGetAllContextsLocallyDeleted
+{
+ NSError *error = nil;
+
+ Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.remoteId = [NSNumber numberWithInt:-1];
+ newContext2.remoteId = [NSNumber numberWithInt:20000];
+ newContext3.remoteId = [NSNumber numberWithInt:23000];
+ [Context deleteObject:newContext2 error:&error];
+ [Context deleteObject:newContext1 error:&error];
+
+ NSArray *contexts = [Context getAllContextsLocallyDeleted:&error];
+ GHAssertEquals([contexts count], (NSUInteger)2, @"");
+}
+
+-(void) testGetUnsyncedContexts
+{
+ NSError *error = nil;
+
+ Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.remoteId = [NSNumber numberWithInt:-1];
+ newContext2.remoteId = [NSNumber numberWithInt:20000];
+ newContext3.remoteId = [NSNumber numberWithInt:23000];
+
+ NSArray *contexts = [Context getUnsyncedContexts:&error];
+ GHAssertEquals([contexts count], (NSUInteger)1, @"");
+}
+
+-(void) testGetModifiedContexts
+{
+ NSError *error = nil;
+
+ Context *newContext1 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext2 = (Context*)[Context objectOfType:@"Context"];
+ Context *newContext3 = (Context*)[Context objectOfType:@"Context"];
+ newContext1.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:0];
+ newContext1.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+ newContext2.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:15];
+ newContext2.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+ newContext3.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:20];
+ newContext3.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+
+
+ NSArray *contexts = [Context getModifiedContexts:&error];
+ GHAssertEquals([contexts count], (NSUInteger)2, @"");
+}
+
+-(void) testGetContextWithRemoteId
+{
+ NSError *error = nil;
+
+ Context *newContext = (Context*)[Context objectOfType:@"Context"];
+ newContext.remoteId = [NSNumber numberWithInt:20000];
+
+ Context *theResult = [Context getContextWithRemoteId:[NSNumber numberWithInt:20000] error:&error];
+ GHAssertNotNil(theResult, @"");
+}
+
+
/* adds 3 contexts - count must be 3 */
-- (void)testOldestModificationDate {
+/*- (void)testOldestModificationDate {
NSError *error = nil;
NSDateFormatter *format = [[NSDateFormatter alloc] init];
@@ -137,6 +235,6 @@ - (void)testOldestModificationDate {
if (![oldestDate isEqualToDate:newContext1.lastLocalModification]) {
GHFail(@"Oldest Mod Date not successful");
}
-}
+}*/
@end
View
218 FolderTest.m
@@ -1,8 +1,8 @@
//
-// FolderTest.m
+// FolderDAOTest.m
// Less2Do
//
-// Created by Gerhard Schraml on 14.12.09.
+// Created by Gerhard Schraml on 27.11.09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
@@ -41,81 +41,203 @@ - (void)tearDown {
/* do nothing */
}
-/* test ordering of all folders */
-- (void)testAllFoldersOrdered {
+/* Tests receiving all folders without adding folders before */
+- (void)testAllFoldersEmpty {
+ NSError *error = nil;
+ NSArray *folders = [Folder getAllFolders:&error];
+ GHAssertEquals([folders count], (NSUInteger)0, @"Folder count must be 0");
+}
+
+/* adds 3 folders - count must be 3 */
+- (void)testAddFolder {
NSError *error = nil;
- /* case 1: same order, order by name */
Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder1.name = @"Holder";
- newFolder1.order = [NSNumber numberWithInt:1];
Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder2.name = @"Golder";
- newFolder2.order = [NSNumber numberWithInt:1];
Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder3.name = @"Folder";
- newFolder3.order = [NSNumber numberWithInt:1];
- [managedObjectContext save:&error];
+ newFolder1.name = @"c1";
+ newFolder2.name = @"c2";
+ newFolder3.name = @"c3";
+
NSArray *folders = [Folder getAllFolders:&error];
GHAssertEquals([folders count], (NSUInteger)3, @"Add folder not successful");
- NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [folders objectAtIndex:0], [folders objectAtIndex:1], [folders objectAtIndex:2]];
- GHAssertEqualStrings(output, @"0: Folder, 1: Golder, 2: Holder", @"Ordered Folders not successful");
+}
+
+/* Tests deleting a folder with nil as parameter */
+- (void)testDeleteFolderWithNilParameter {
+ NSError *error = nil;
+ BOOL returnValue = [Folder deleteObject:nil error:&error];
+ GHAssertEquals([error code], DAOMissingParametersError, @"Folder must not be deleted without reference");
+ GHAssertFalse(returnValue, @"Return value must be NO.");
+}
+
+/* first adds a folder and then deletes it - count then must be 0 */
+- (void)testDeleteFolder {
+ NSError *error = nil;
+ Folder *newFolder = (Folder*)[Folder objectOfType:@"Folder"];
+
+ NSArray *folders = [Folder getAllFolders:&error];
+ GHAssertEquals([folders count], (NSUInteger)1, @"Add folder not successful");
+
+ BOOL deleteSuccessful = [Folder deleteObject:newFolder error:&error];
+ GHAssertTrue(deleteSuccessful, @"Delete folder not successful");
- /* case 2: reorder, order by order */
- newFolder1.order = [NSNumber numberWithInt:1];
- newFolder2.order = [NSNumber numberWithInt:2];
- newFolder3.order = [NSNumber numberWithInt:3];
- [managedObjectContext save:&error];
folders = [Folder getAllFolders:&error];
- GHAssertEquals([folders count], (NSUInteger)3, @"Add folder not successful");
- output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [folders objectAtIndex:0], [folders objectAtIndex:1], [folders objectAtIndex:2]];
- GHAssertEqualStrings(output, @"0: Holder, 1: Golder, 2: Folder", @"Ordered Folders not successful");
+ GHAssertEquals([folders count], (NSUInteger)0, @"Delete folder not successful");
}
-- (void)testGetRemoteStoredFolders {
+- (void)testAllFoldersOrdered {
NSError *error = nil;
Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder1.name=@"TestFolder1";
- newFolder1.remoteId = [NSNumber numberWithInt:1];
Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder2.name=@"TestFolder2";
- newFolder2.remoteId = [NSNumber numberWithInt:-1];
Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder3.name=@"TestFolder3";
- newFolder3.remoteId = [NSNumber numberWithInt:3];
+ newFolder1.name = @"C";
+ newFolder1.order = [NSNumber numberWithInt:1];
+ newFolder2.name = @"A";
+ newFolder2.order = [NSNumber numberWithInt:3];
+ newFolder3.name = @"B";
+ newFolder3.order = [NSNumber numberWithInt:2];
- [Folder commit];
+ NSArray *folders = [Folder getAllFolders:&error];
+ GHAssertEquals([folders count], (NSUInteger)3, @"Add foldernot successful");
+ NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [[folders objectAtIndex:0] name], [[folders objectAtIndex:1] name], [[folders objectAtIndex:2] name]];
+ GHAssertEqualStrings(output, @"0: C, 1: B, 2: A", @"Ordered Folders not successful");
+}
+
+-(void) testGetRemoteStoredFolders
+{
+ NSError *error = nil;
+
+ Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
+ newFolder1.remoteId = [NSNumber numberWithInt:-1];
+ newFolder2.remoteId = [NSNumber numberWithInt:20000];
+ newFolder3.remoteId = [NSNumber numberWithInt:23000];
- NSArray* folders = [Folder getRemoteStoredFolders:&error];
- GHAssertNil(error, @"Folder produced error: %@", error);
- GHAssertEquals([folders count], (NSUInteger)2, @"Anzahl stimmt nicht");
+ NSArray *folders = [Folder getRemoteStoredFolders:&error];
+ GHAssertEquals([folders count], (NSUInteger)2, @"");
}
--(void)testGetRemoteStoredFoldersLocallyDeleted {
+-(void) testGetRemoteStoredFoldersLocallyDeleted
+{
NSError *error = nil;
Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder1.name=@"TestFolder1";
- newFolder1.remoteId = [NSNumber numberWithInt:1];
Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder2.name=@"TestFolder2";
Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
- newFolder3.name=@"TestFolder3";
- newFolder3.remoteId = [NSNumber numberWithInt:3];
+ newFolder1.remoteId = [NSNumber numberWithInt:-1];
+ newFolder2.remoteId = [NSNumber numberWithInt:20000];
+ newFolder3.remoteId = [NSNumber numberWithInt:23000];
[Folder deleteObject:newFolder3 error:&error];
- [Folder commitWithoutLocalModification];
+ NSArray *folders = [Folder getRemoteStoredFoldersLocallyDeleted:&error];
+ GHAssertEquals([folders count], (NSUInteger)1, @"");
+}
+
+-(void) testGetLocalStoredFoldersLocallyDeleted
+{
+ NSError *error = nil;
+
+ Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
+ newFolder1.remoteId = [NSNumber numberWithInt:-1];
+ newFolder2.remoteId = [NSNumber numberWithInt:-1];
+ newFolder3.remoteId = [NSNumber numberWithInt:23000];
+ [Folder deleteObject:newFolder2 error:&error];
+ [Folder commit];
+
+ NSArray *folders = [Folder getLocalStoredFoldersLocallyDeleted:&error];
+ GHAssertEquals([folders count], (NSUInteger)1, @"");
+}
+
+-(void) testGetAllFoldersLocallyDeleted
+{
+ NSError *error = nil;
+
+ Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
+ newFolder1.remoteId = [NSNumber numberWithInt:-1];
+ newFolder2.remoteId = [NSNumber numberWithInt:20000];
+ newFolder3.remoteId = [NSNumber numberWithInt:23000];
+ [Folder deleteObject:newFolder2 error:&error];
+ [Folder deleteObject:newFolder1 error:&error];
+
+ NSArray *folders = [Folder getAllFoldersLocallyDeleted:&error];
+ GHAssertEquals([folders count], (NSUInteger)2, @"");
+}
+
+-(void) testGetUnsyncedFolders
+{
+ NSError *error = nil;
+
+ Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
+ newFolder1.remoteId = [NSNumber numberWithInt:-1];
+ newFolder2.remoteId = [NSNumber numberWithInt:20000];
+ newFolder3.remoteId = [NSNumber numberWithInt:23000];
+
+ NSArray *folders = [Folder getUnsyncedFolders:&error];
+ GHAssertEquals([folders count], (NSUInteger)1, @"");
+}
+
+-(void) testGetModifiedFolders
+{
+ NSError *error = nil;
+
+ Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
+ newFolder1.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:0];
+ newFolder1.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+ newFolder2.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:15];
+ newFolder2.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+ newFolder3.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:20];
+ newFolder3.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
- NSArray* allFolders = [Folder getAllFolders:&error];
- for(Folder* folder in allFolders)
- {
- ALog(@"Name: %@, deleted: %d", folder.name, [folder.deleted integerValue]);
- }
- NSArray* folders = [Folder getRemoteStoredFoldersLocallyDeleted:&error];
- GHAssertNil(error, @"Folder produced error: %@", error);
- GHAssertEquals([folders count], (NSUInteger)1, @"Anzahl stimmt nicht");
+ NSArray *folders = [Folder getModifiedFolders:&error];
+ GHAssertEquals([folders count], (NSUInteger)2, @"");
}
+-(void) testGetFolderWithRemoteId
+{
+ NSError *error = nil;
+
+ Folder *newFolder = (Folder*)[Folder objectOfType:@"Folder"];
+ newFolder.remoteId = [NSNumber numberWithInt:20000];
+
+ Folder *theResult = [Folder getFolderWithRemoteId:[NSNumber numberWithInt:20000] error:&error];
+ GHAssertNotNil(theResult, @"");
+}
+
+
+/* adds 3 folders - count must be 3 */
+/*- (void)testOldestModificationDate {
+ NSError *error = nil;
+
+ NSDateFormatter *format = [[NSDateFormatter alloc] init];
+ [format setDateFormat:@"yyyy:mm:dd hh:mm "];
+
+ Folder *newFolder1 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder2 = (Folder*)[Folder objectOfType:@"Folder"];
+ Folder *newFolder3 = (Folder*)[Folder objectOfType:@"Folder"];
+
+ newFolder1.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:2];
+ newFolder2.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:3];
+ newFolder3.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:4];
+ ALog(@"date1: %@", newFolder1.lastLocalModification);
+
+ [BaseRemoteObject commit];
+
+ NSDate *oldestDate = [Folder oldestModificationDateOfType:@"Folder" error:&error];
+ if (![oldestDate isEqualToDate:newFolder1.lastLocalModification]) {
+ GHFail(@"Oldest Mod Date not successful");
+ }
+ }*/
+
@end
View
8 Less2Do.xcodeproj/project.pbxproj
@@ -94,8 +94,8 @@
A30A5FA310C15B5F00673F02 /* Context.m in Sources */ = {isa = PBXBuildFile; fileRef = CFB932F410BC872B004EAF93 /* Context.m */; };
A30A608E10C16A7C00673F02 /* Less2DoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* Less2DoAppDelegate.m */; };
A30A609A10C16AAB00673F02 /* Less2Do.xcdatamodel in Resources */ = {isa = PBXBuildFile; fileRef = 28C3AD890F43EF2300507BA6 /* Less2Do.xcdatamodel */; };
- A3227ECE10FD21540093C8CB /* SyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A3227ECD10FD21540093C8CB /* SyncTest.m */; };
A3227EE910FD226A0093C8CB /* liblibToodledoAPIiPhone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 39F5AFCC10ED19AF00E54EB1 /* liblibToodledoAPIiPhone.a */; };
+ A328F8E711060EE600867D30 /* TagTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A328F8E611060EE600867D30 /* TagTest.m */; };
A36CF93810D634C9007482E3 /* FolderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A36CF93710D634C9007482E3 /* FolderTest.m */; };
A36CF97510D639E4007482E3 /* Folder.m in Sources */ = {isa = PBXBuildFile; fileRef = A3E3389310BC5C6D004F0F39 /* Folder.m */; };
A36CFA6710D64524007482E3 /* TaskTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A36CFA6610D64524007482E3 /* TaskTest.m */; };
@@ -333,7 +333,7 @@
39F5AFD310ED1A0B00E54EB1 /* ShowTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ShowTaskViewController.xib; path = Classes/ShowTaskViewController.xib; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Less2Do-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Less2Do-Info.plist"; sourceTree = "<group>"; };
A30A5FE910C15D7200673F02 /* Tests_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tests_Prefix.pch; sourceTree = "<group>"; };
- A3227ECD10FD21540093C8CB /* SyncTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyncTest.m; sourceTree = "<group>"; };
+ A328F8E611060EE600867D30 /* TagTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TagTest.m; sourceTree = "<group>"; };
A34471E710BF239000851DCD /* DAOError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAOError.h; sourceTree = "<group>"; };
A36CF93710D634C9007482E3 /* FolderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FolderTest.m; sourceTree = "<group>"; };
A36CFA6610D64524007482E3 /* TaskTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskTest.m; sourceTree = "<group>"; };
@@ -828,7 +828,6 @@
A38B3ADF10BFFB7A00D5D87F /* Tests */ = {
isa = PBXGroup;
children = (
- A3227ECD10FD21540093C8CB /* SyncTest.m */,
A38B3B0410BFFC9E00D5D87F /* ContextTest.m */,
A38B3AE010BFFB8800D5D87F /* GHUnit */,
A36CF93710D634C9007482E3 /* FolderTest.m */,
@@ -836,6 +835,7 @@
A37069C210D7919200E6D556 /* CustomGHUnitAppDelegate.h */,
A37069C310D7919200E6D556 /* CustomGHUnitAppDelegate.m */,
A396B8491104716000C5D254 /* SettingTest.m */,
+ A328F8E611060EE600867D30 /* TagTest.m */,
);
name = Tests;
sourceTree = "<group>";
@@ -1210,9 +1210,9 @@
A36CFA6710D64524007482E3 /* TaskTest.m in Sources */,
A37069C410D7919200E6D556 /* CustomGHUnitAppDelegate.m in Sources */,
A3706ABD10D7AFFC00E6D556 /* BaseManagedObject.m in Sources */,
- A3227ECE10FD21540093C8CB /* SyncTest.m in Sources */,
A396B81E11046E2200C5D254 /* Setting.m in Sources */,
A396B84A1104716000C5D254 /* SettingTest.m in Sources */,
+ A328F8E711060EE600867D30 /* TagTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
104 SyncTest.m
@@ -1,104 +0,0 @@
-//
-// SyncTest.m
-// Less2Do
-//
-// Created by Gerhard Schraml on 27.11.09.
-// Copyright 2009 __MyCompanyName__. All rights reserved.
-//
-
-//#import "TDApi.h"
-#import "SyncManager.h"
-#import "CustomGHUnitAppDelegate.h";
-
-@interface SyncTest : GHTestCase {
- NSManagedObjectContext* managedObjectContext;
-}
-
-@end
-
-@implementation SyncTest
-
-- (void)setUp {
-
- /* delete all contexts from the persistent store */
- /*CustomGHUnitAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
- managedObjectContext = [delegate managedObjectContext];
-
- NSFetchRequest *request = [[NSFetchRequest alloc] init];
- [request setEntity:[NSEntityDescription entityForName:@"Context" inManagedObjectContext:managedObjectContext]];
-
- NSError *error;
- NSArray *allContexts = [managedObjectContext executeFetchRequest:request error:&error];
- [request release];
- for (NSManagedObject* context in allContexts)
- {
- [managedObjectContext deleteObject:context];
- }
- if([managedObjectContext save:&error] == NO)
- GHFail(@"Error at setUp");*/
-}
-
-- (void)tearDown {
- /* do nothing */
- ALog(@"got here");
-}
-
-/* Tests receiving all contexts without adding contexts before */
-/*- (void)testDaFuckinConnection {
- //NSError *error = nil;
- //NSArray *contexts = [Context getAllContexts:&error];
- //GHAssertEquals([contexts count], (NSUInteger)0, @"Context count must be 0");
-
- NSError *error;
-
- TDApi *fuck2 = [[TDApi alloc] initWithUsername:@"g.schraml@gmx.at" password:@"vryehlgg" error:&error];
- GHAssertNil(error, @"Do hots wos");
- GtdFolder *newFolder = [[GtdFolder alloc] init];
- newFolder.title = @"FuckYourself";
- //ALog(@"%@", newFolder.uid);
- NSInteger newId = [fuck2 addFolder:newFolder error:&error];
- //ALog(@"%@", newId);
- newFolder.uid = newId;
-
- GtdFolder *folder2 = [[GtdFolder alloc] init];
- folder2.uid = newId;
-
-
- [fuck2 deleteFolder:newFolder error:&error];
- //ALog(@"deleted: %@", deleted);
- //ALog(@"0: %@", fuck2.isAuthenticated);
- NSArray* folders = [fuck2 getFolders:&error];
- for (GtdFolder *gtdFolder in folders) {
- ALog(@"[Fuck] %@", gtdFolder);
- }
- //ALog(@"1: %@", error);
- //ALog(@"2: %@", fuck2);
-}*/
-
--(void)testSync {
- //NSError *error;
- //[SyncManager syncWithPreference:SyncPreferLocal error:&error];
-}
-/*-(void)testGetLastModificationDates {
- NSError *error = nil;
- TDApi *tdApi = [[TDApi alloc] initWithUsername:@"g.schraml@gmx.at" password:@"vryehlgg" error:&error];
- GHAssertNil(error, @"API not connected");
- NSMutableDictionary *datesDict = [tdApi getLastModificationsDates:&error];
- ALog(@"datesDict: %@", datesDict);
- ALog(@"error: %@", error);
- ALog(@"lastfolderedit: %@", [datesDict valueForKey:@"lastFolderEdit"]);
- //GHAssertNil(error, @"Retrieving dates not successful");
-}*/
-
--(void)testDisableAutocommit
-{
- CustomGHUnitAppDelegate *ghAppDelegate = [[UIApplication sharedApplication] delegate];
- //ALog(@"Aktiver Timer: %@", ghAppDelegate.timer);
- //[SyncManager stopAutocommit];
- //ALog(@"Deaktivierter Timer isValid?: %@", [ghAppDelegate.timer isValid]);
- //ALog(@"Fuck");
- //[SyncManager startAutocommit];
- //ALog(@"Reaktivierter Timer: %@", ghAppDelegate.timer);
-}
-
-@end
View
88 TagTest.m
@@ -0,0 +1,88 @@
+//
+// TagDAOTest.m
+// Less2Do
+//
+// Created by Gerhard Schraml on 27.11.09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "Tag.h"
+#import "CustomGHUnitAppDelegate.h";
+
+@interface TagTest : GHTestCase {
+ NSManagedObjectContext* managedObjectContext;
+}
+
+@end
+
+@implementation TagTest
+
+- (void)setUp {
+
+ /* delete all tags from the persistent store */
+ CustomGHUnitAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
+ managedObjectContext = [delegate managedObjectContext];
+
+ NSFetchRequest *request = [[NSFetchRequest alloc] init];
+ [request setEntity:[NSEntityDescription entityForName:@"Tag" inManagedObjectContext:managedObjectContext]];
+
+ NSError *error;
+ NSArray *allTags = [managedObjectContext executeFetchRequest:request error:&error];
+ [request release];
+ for (NSManagedObject* tag in allTags)
+ {
+ [managedObjectContext deleteObject:tag];
+ }
+ if([managedObjectContext save:&error] == NO)
+ GHFail(@"Error at setUp");
+}
+
+- (void)tearDown {
+ /* do nothing */
+}
+
+/* Tests receiving all tags without adding tags before */
+- (void)testAllTagsEmpty {
+ NSError *error = nil;
+ NSArray *tags = [Tag getAllTags:&error];
+ GHAssertEquals([tags count], (NSUInteger)0, @"Tag count must be 0");
+}
+
+/* adds 3 tags - count must be 3 */
+- (void)testAddTag {
+ NSError *error = nil;
+
+ Tag *newTag1 = (Tag*)[Tag objectOfType:@"Tag"];
+ Tag *newTag2 = (Tag*)[Tag objectOfType:@"Tag"];
+ Tag *newTag3 = (Tag*)[Tag objectOfType:@"Tag"];
+ newTag1.name = @"c1";
+ newTag2.name = @"c2";
+ newTag3.name = @"c3";
+
+ NSArray *tags = [Tag getAllTags:&error];
+ GHAssertEquals([tags count], (NSUInteger)3, @"Add tag not successful");
+}
+
+/* Tests deleting a tag with nil as parameter */
+- (void)testDeleteTagWithNilParameter {
+ NSError *error = nil;
+ BOOL returnValue = [Tag deleteObjectFromPersistentStore:nil error:&error];
+ GHAssertEquals([error code], DAOMissingParametersError, @"Tag must not be deleted without reference");
+ GHAssertFalse(returnValue, @"Return value must be NO.");
+}
+
+/* first adds a tag and then deletes it - count then must be 0 */
+- (void)testDeleteTag {
+ NSError *error = nil;
+ Tag *newTag = (Tag*)[Tag objectOfType:@"Tag"];
+
+ NSArray *tags = [Tag getAllTags:&error];
+ GHAssertEquals([tags count], (NSUInteger)1, @"Add tag not successful");
+
+ BOOL deleteSuccessful = [Tag deleteObjectFromPersistentStore:newTag error:&error];
+ GHAssertTrue(deleteSuccessful, @"Delete tag not successful");
+
+ tags = [Tag getAllTags:&error];
+ GHAssertEquals([tags count], (NSUInteger)0, @"Delete tag not successful");
+}
+@end
View
264 TaskTest.m
@@ -1,14 +1,14 @@
//
-// TaskTest.m
+// TaskDAOTest.m
// Less2Do
//
-// Created by Gerhard Schraml on 14.12.09.
+// Created by Gerhard Schraml on 27.11.09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "Task.h"
-#import "Folder.h"
#import "Tag.h"
+#import "Folder.h"
#import "CustomGHUnitAppDelegate.h";
@interface TaskTest : GHTestCase {
@@ -21,7 +21,7 @@ @implementation TaskTest
- (void)setUp {
- /* delete all Tasks from the persistent store */
+ /* delete all tasks from the persistent store */
CustomGHUnitAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
managedObjectContext = [delegate managedObjectContext];
@@ -43,6 +43,196 @@ - (void)tearDown {
/* do nothing */
}
+/* Tests receiving all tasks without adding tasks before */
+- (void)testAllTasksEmpty {
+ NSError *error = nil;
+ NSArray *tasks = [Task getAllTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)0, @"Task count must be 0");
+}
+
+/* adds 3 tasks - count must be 3 */
+- (void)testAddTask {
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.name = @"c1";
+ newTask2.name = @"c2";
+ newTask3.name = @"c3";
+
+ NSArray *tasks = [Task getAllTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)3, @"Add task not successful");
+}
+
+/* Tests deleting a task with nil as parameter */
+- (void)testDeleteTaskWithNilParameter {
+ NSError *error = nil;
+ BOOL returnValue = [Task deleteObject:nil error:&error];
+ GHAssertEquals([error code], DAOMissingParametersError, @"Task must not be deleted without reference");
+ GHAssertFalse(returnValue, @"Return value must be NO.");
+}
+
+/* first adds a task and then deletes it - count then must be 0 */
+- (void)testDeleteTask {
+ NSError *error = nil;
+ Task *newTask = (Task*)[Task objectOfType:@"Task"];
+
+ NSArray *tasks = [Task getAllTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)1, @"Add task not successful");
+
+ BOOL deleteSuccessful = [Task deleteObject:newTask error:&error];
+ GHAssertTrue(deleteSuccessful, @"Delete task not successful");
+
+ tasks = [Task getAllTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)0, @"Delete task not successful");
+}
+
+- (void)testAllTasksOrdered {
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.name = @"C";
+ newTask1.dueDate = [NSDate dateWithTimeIntervalSince1970:20];
+ newTask2.name = @"A";
+ newTask2.dueDate = [NSDate dateWithTimeIntervalSince1970:10];
+ newTask3.name = @"B";
+ newTask3.dueDate = [NSDate dateWithTimeIntervalSince1970:15];
+
+ NSArray *tasks = [Task getAllTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)3, @"Add tasknot successful");
+ NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [[tasks objectAtIndex:0] name], [[tasks objectAtIndex:1] name], [[tasks objectAtIndex:2] name]];
+ GHAssertEqualStrings(output, @"0: A, 1: B, 2: C", @"Ordered Tasks not successful");
+}
+
+-(void) testGetRemoteStoredTasks
+{
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.remoteId = [NSNumber numberWithInt:-1];
+ newTask2.remoteId = [NSNumber numberWithInt:20000];
+ newTask3.remoteId = [NSNumber numberWithInt:23000];
+
+ NSArray *tasks = [Task getRemoteStoredTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)2, @"");
+}
+
+-(void) testGetRemoteStoredTasksLocallyDeleted
+{
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.remoteId = [NSNumber numberWithInt:-1];
+ newTask2.remoteId = [NSNumber numberWithInt:20000];
+ newTask3.remoteId = [NSNumber numberWithInt:23000];
+ [Task deleteObject:newTask3 error:&error];
+
+ NSArray *tasks = [Task getRemoteStoredTasksLocallyDeleted:&error];
+ GHAssertEquals([tasks count], (NSUInteger)1, @"");
+}
+
+-(void) testGetLocalStoredTasksLocallyDeleted
+{
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.remoteId = [NSNumber numberWithInt:-1];
+ newTask2.remoteId = [NSNumber numberWithInt:-1];
+ newTask3.remoteId = [NSNumber numberWithInt:23000];
+ [Task deleteObject:newTask2 error:&error];
+ [Task commit];
+
+ NSArray *tasks = [Task getLocalStoredTasksLocallyDeleted:&error];
+ GHAssertEquals([tasks count], (NSUInteger)1, @"");
+}
+
+-(void) testGetAllTasksLocallyDeleted
+{
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.remoteId = [NSNumber numberWithInt:-1];
+ newTask2.remoteId = [NSNumber numberWithInt:20000];
+ newTask3.remoteId = [NSNumber numberWithInt:23000];
+ [Task deleteObject:newTask2 error:&error];
+ [Task deleteObject:newTask1 error:&error];
+
+ NSArray *tasks = [Task getAllTasksLocallyDeleted:&error];
+ GHAssertEquals([tasks count], (NSUInteger)2, @"");
+}
+
+-(void) testGetUnsyncedTasks
+{
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.remoteId = [NSNumber numberWithInt:-1];
+ newTask2.remoteId = [NSNumber numberWithInt:20000];
+ newTask3.remoteId = [NSNumber numberWithInt:23000];
+
+ NSArray *tasks = [Task getUnsyncedTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)1, @"");
+}
+
+-(void) testGetModifiedTasks
+{
+ NSError *error = nil;
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+ newTask1.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:0];
+ newTask1.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+ newTask2.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:15];
+ newTask2.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+ newTask3.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:20];
+ newTask3.lastSyncDate = [NSDate dateWithTimeIntervalSince1970:5];
+
+
+ NSArray *tasks = [Task getModifiedTasks:&error];
+ GHAssertEquals([tasks count], (NSUInteger)2, @"");
+}
+
+
+/* adds 3 tasks - count must be 3 */
+/*- (void)testOldestModificationDate {
+ NSError *error = nil;
+
+ NSDateFormatter *format = [[NSDateFormatter alloc] init];
+ [format setDateFormat:@"yyyy:mm:dd hh:mm "];
+
+ Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
+ Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
+
+ newTask1.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:2];
+ newTask2.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:3];
+ newTask3.lastLocalModification = [NSDate dateWithTimeIntervalSince1970:4];
+ ALog(@"date1: %@", newTask1.lastLocalModification);
+
+ [BaseRemoteObject commit];
+
+ NSDate *oldestDate = [Task oldestModificationDateOfType:@"Task" error:&error];
+ if (![oldestDate isEqualToDate:newTask1.lastLocalModification]) {
+ GHFail(@"Oldest Mod Date not successful");
+ }
+ }*/
+
+/* ===================================================================================================== */
+
/* test all tasks */
- (void)testAllTasks {
NSError *error = nil;
@@ -57,8 +247,6 @@ - (void)testAllTasks {
NSArray *tasks = [Task getAllTasks:&error];
GHAssertEquals([tasks count], (NSUInteger)3, @"Add tasks not successful");
- //NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [tasks objectAtIndex:0], [tasks objectAtIndex:1], [tasks objectAtIndex:2]];
- //GHAssertEqualStrings(output, @"0: Task 1, 1: Task 2, 2: Task 3", @"Ordered Folders not successful");
}
/* test starred tasks */
@@ -78,49 +266,6 @@ - (void)testStarredTasks {
NSArray *tasks = [Task getStarredTasks:&error];
GHAssertEquals([tasks count], (NSUInteger)1, @"0 starred tasks not successful");
- //NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [tasks objectAtIndex:0], [tasks objectAtIndex:1], [tasks objectAtIndex:2]];
- //GHAssertEqualStrings(output, @"0: Task 1, 1: Task 2, 2: Task 3", @"Ordered Folders not successful");
-}
-
-/* test ordering of tasks */
-- (void)testOrderedTasks {
- NSError *error = nil;
-
- Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
- Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
- Task *newTask3 = (Task*)[Task objectOfType:@"Task"];
- Task *newTask4 = (Task*)[Task objectOfType:@"Task"];
- Task *newTask5 = (Task*)[Task objectOfType:@"Task"];
- Task *newTask6 = (Task*)[Task objectOfType:@"Task"];
- newTask1.name = @"Task 1";
- newTask1.dueDate = [[NSDate alloc] initWithString:@"2009-12-05 00:00:00 +0100"];
- newTask1.dueTime = nil;
- newTask2.name = @"Task 2";
- //newTask2.dueDate = [[NSDate alloc] initWithString:@"2009-12-04 00:00:00 +0100"];
- newTask2.dueDate = nil;
- newTask3.name = @"Task 3";
- newTask3.dueDate = [[NSDate alloc] initWithString:@"2009-12-05 00:00:00 +0100"];
- newTask3.dueTime = [[NSDate alloc] initWithString:@"2009-12-05 10:40:00 +0100"];
- newTask4.name = @"Task 4";
- newTask4.dueDate = nil;
- newTask5.name = @"Task 5";
- newTask5.dueDate = [[NSDate alloc] initWithString:@"2009-12-05 00:00:00 +0100"];
- newTask5.dueTime = [[NSDate alloc] initWithString:@"2009-12-05 10:20:00 +0100"];
- newTask6.name = @"Task 6";
- newTask6.dueDate = [[NSDate alloc] initWithString:@"2009-12-10 00:00:00 +0100"];
- [managedObjectContext save:&error];
-
- NSArray *tasks = [Task getTasksWithFilterString:nil error:&error];
- ALog(@"ORDERING OF TASKS");
- for(int i=0;i<[tasks count];i++)
- {
- Task *task = [tasks objectAtIndex:i];
- ALog(@"%d - %@ dueDate: %@ dueTime:%@", i, task.name, task.dueDate, task.dueTime);
- }
- /*GHAssertEquals([tasks count], (NSUInteger)3, @"0 starred tasks not successful");
- NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [tasks objectAtIndex:0], [tasks objectAtIndex:1], [tasks objectAtIndex:2]];
- GHFail(output);*/
- //GHAssertEqualStrings(output, @"0: Task 1, 1: Task 2, 2: Task 3", @"Ordered Folders not successful");
}
- (void)testGetTasksInFolder {
@@ -249,16 +394,6 @@ - (void)testGetCompletedTasks
GHAssertEquals([tasks count], (NSUInteger)1, @"Getting tasks that are completed failed!");
}
-- (void)testNextDueDate {
- Task *newTask1 = (Task*)[Task objectOfType:@"Task"];
- Task *newTask2 = (Task*)[Task objectOfType:@"Task"];
-
- newTask1.name = @"Task 1";
- //newTask1.dueDate =
- //TODO: test method nextDueDate
-}
-
-/* test ordering of tasks */
- (void)testTasksToday {
NSError *error = nil;
@@ -284,12 +419,8 @@ - (void)testTasksToday {
ALog(@"%d - %@ dueDate: %@ dueTime:%@", i, task.name, task.dueDate, task.dueTime);
}
GHAssertEquals([tasks count], (NSUInteger)2, @"tasks today not successful");
- /* NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [tasks objectAtIndex:0], [tasks objectAtIndex:1], [tasks objectAtIndex:2]];
- GHFail(output);*/
- //GHAssertEqualStrings(output, @"0: Task 1, 1: Task 2, 2: Task 3", @"Ordered Folders not successful");
}
-/* test ordering of tasks */
- (void)testTasksThisWeek {
NSError *error = nil;
@@ -315,12 +446,8 @@ - (void)testTasksThisWeek {
ALog(@"%d - %@ dueDate: %@ dueTime:%@", i, task.name, task.dueDate, task.dueTime);
}
GHAssertEquals([tasks count], (NSUInteger)2, @"tasks this week not successful");
- /* NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [tasks objectAtIndex:0], [tasks objectAtIndex:1], [tasks objectAtIndex:2]];
- GHFail(output);*/
- //GHAssertEqualStrings(output, @"0: Task 1, 1: Task 2, 2: Task 3", @"Ordered Folders not successful");
}
-/* test ordering of tasks */
- (void)testTasksOverdue {
NSError *error = nil;
@@ -346,9 +473,6 @@ - (void)testTasksOverdue {
ALog(@"%d - %@ dueDate: %@ dueTime:%@", i, task.name, task.dueDate, task.dueTime);
}
GHAssertEquals([tasks count], (NSUInteger)2, @"tasks this week not successful");
- /* NSString *output = [NSString stringWithFormat:@"0: %@, 1: %@, 2: %@", [tasks objectAtIndex:0], [tasks objectAtIndex:1], [tasks objectAtIndex:2]];
- GHFail(output);*/
- //GHAssertEqualStrings(output, @"0: Task 1, 1: Task 2, 2: Task 3", @"Ordered Folders not successful");
}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.