Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Person & tests

  • Loading branch information...
commit eafcd9e1801b2095f9ab120656031b4e37cf0220 1 parent 4dd59b1
@grosshei authored
View
14 BrowseOverflow.xcodeproj/project.pbxproj
@@ -7,8 +7,11 @@
objects = {
/* Begin PBXBuildFile section */
+ 1E13C432325ECF9A4BF696E6 /* PersonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E13CDE0D945AF9838139F5F /* PersonTests.m */; };
1E13C98A10FE6EF954E81D6D /* Question.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E13C668BB194139649A1575 /* Question.m */; };
+ 1E13CA01EF9FC6BBF7BE8313 /* Person.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E13C4FA4EA96FC59063F3D4 /* Person.m */; };
1E13CB5B54FD3022E65BD66B /* Question.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E13C668BB194139649A1575 /* Question.m */; };
+ 1E13CE3518E22DCEEFFF0132 /* Person.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E13C4FA4EA96FC59063F3D4 /* Person.m */; };
7B06FA7616460FD7001B35F9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B06FA7516460FD7001B35F9 /* UIKit.framework */; };
7B06FA7816460FD7001B35F9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B06FA7716460FD7001B35F9 /* Foundation.framework */; };
7B06FA7A16460FD7001B35F9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B06FA7916460FD7001B35F9 /* CoreGraphics.framework */; };
@@ -44,7 +47,11 @@
/* Begin PBXFileReference section */
1E13C498B10A812C2A0B9AEF /* Question.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Question.h; sourceTree = "<group>"; };
+ 1E13C4FA4EA96FC59063F3D4 /* Person.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Person.m; sourceTree = "<group>"; };
+ 1E13C65AFFEEDDE8B71285F5 /* Person.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Person.h; sourceTree = "<group>"; };
1E13C668BB194139649A1575 /* Question.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Question.m; sourceTree = "<group>"; };
+ 1E13CA507F1ABF4B32015C99 /* PersonTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PersonTests.h; sourceTree = "<group>"; };
+ 1E13CDE0D945AF9838139F5F /* PersonTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PersonTests.m; sourceTree = "<group>"; };
7B06FA7116460FD7001B35F9 /* BrowseOverflow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BrowseOverflow.app; sourceTree = BUILT_PRODUCTS_DIR; };
7B06FA7516460FD7001B35F9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
7B06FA7716460FD7001B35F9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -146,6 +153,8 @@
7BB720541646123500C5D1C4 /* Topic.m */,
1E13C668BB194139649A1575 /* Question.m */,
1E13C498B10A812C2A0B9AEF /* Question.h */,
+ 1E13C4FA4EA96FC59063F3D4 /* Person.m */,
+ 1E13C65AFFEEDDE8B71285F5 /* Person.h */,
);
path = BrowseOverflow;
sourceTree = "<group>";
@@ -172,6 +181,8 @@
7BB720501646119100C5D1C4 /* TopicTests.m */,
7B5D0C721652EC7F00D0920E /* QuestionTests.h */,
7B5D0C731652EC7F00D0920E /* QuestionTests.m */,
+ 1E13CA507F1ABF4B32015C99 /* PersonTests.h */,
+ 1E13CDE0D945AF9838139F5F /* PersonTests.m */,
);
path = BrowseOverflowTests;
sourceTree = "<group>";
@@ -301,6 +312,7 @@
7B06FA9216460FD7001B35F9 /* DetailViewController.m in Sources */,
7BB720551646123500C5D1C4 /* Topic.m in Sources */,
1E13CB5B54FD3022E65BD66B /* Question.m in Sources */,
+ 1E13CA01EF9FC6BBF7BE8313 /* Person.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -312,6 +324,8 @@
7BB720561646123500C5D1C4 /* Topic.m in Sources */,
7B5D0C741652EC7F00D0920E /* QuestionTests.m in Sources */,
1E13C98A10FE6EF954E81D6D /* Question.m in Sources */,
+ 1E13C432325ECF9A4BF696E6 /* PersonTests.m in Sources */,
+ 1E13CE3518E22DCEEFFF0132 /* Person.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
19 BrowseOverflow/Person.h
@@ -0,0 +1,19 @@
+//
+// Created by grosshei on 11/13/12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import <Foundation/Foundation.h>
+
+
+@interface Person : NSObject
+
+@property NSString *name;
+@property NSURL *avatarURL;
+
+- (id)initWithName:(NSString *)aName avatarLocation:(NSString *)location;
+
+
+@end
View
22 BrowseOverflow/Person.m
@@ -0,0 +1,22 @@
+//
+// Created by grosshei on 11/13/12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import "Person.h"
+
+
+@implementation Person
+@synthesize name, avatarURL;
+
+-(id)initWithName:(NSString *)aName avatarLocation:(NSString *)location{
+ if(self = [super init]){
+ name = [aName copy];
+ avatarURL = [[NSURL alloc] initWithString:location];
+ }
+ return self;
+}
+
+@end
View
19 BrowseOverflowTests/PersonTests.h
@@ -0,0 +1,19 @@
+//
+// PersonTests.h
+// BrowseOverflow
+//
+// Created by Mike Grossheim on 11/13/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <SenTestingKit/SenTestingKit.h>
+
+@class Person;
+
+@interface PersonTests : SenTestCase{
+ Person *person;
+}
+
+
+
+@end
View
33 BrowseOverflowTests/PersonTests.m
@@ -0,0 +1,33 @@
+//
+// PersonTests.m
+// BrowseOverflow
+//
+// Created by Mike Grossheim on 11/13/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "PersonTests.h"
+#import "Person.h"
+
+@implementation PersonTests
+
+-(void)setUp
+{
+ person = [[Person alloc] initWithName:@"Graham Lee" avatarLocation:@"http://example.com/avatar.png"];
+}
+
+-(void)tearDown{
+ person = nil;
+}
+
+-(void)testThatPersonHasTheRightName{
+ STAssertEqualObjects(person.name, @"Graham Lee", @"expectxing a person to provide its name");
+}
+
+-(void)testThatPersonHasAnAvatarURL{
+ NSURL *url = person.avatarURL;
+ STAssertEqualObjects([url absoluteString], @"http://example.com/avatar.png",
+ @"The Person's avatar should be represented by a URL");
+}
+
+@end
View
5 BrowseOverflowTests/QuestionTests.h
@@ -8,6 +8,11 @@
#import <SenTestingKit/SenTestingKit.h>
+@class Question;
+
@interface QuestionTests : SenTestCase
+{
+ Question *question;
+}
@end
View
3  BrowseOverflowTests/QuestionTests.m
@@ -10,9 +10,6 @@
#import "Question.h"
@implementation QuestionTests
-{
- Question *question;
-}
-(void)setUp
{
Please sign in to comment.
Something went wrong with that request. Please try again.