root/lang/objective-c/Atompub/Tests/AtomCollectionTest.m @ 13814

Revision 13814, 1.6 kB (checked in by lyokato, 7 years ago)

lang/objective-c/Atompub: initial import.

RevLine 
[13814]1#import "AtomCollectionTest.h"
2#import "AtomCollection.h"
3#import "AtomCategory.h"
4#import "AtomCategories.h"
5
6@implementation AtomCollectionTest
7
8- (void)testElement {
9  AtomCollection *coll = [ [ AtomCollection alloc ] init ];
10  NSString *collString = [ coll stringValue ];
11  STAssertEqualObjects( collString, @"<collection xmlns=\"http://www.w3.org/2007/app\"></collection>", nil );
12  [ coll release ];
13}
14
15- (void)testParams {
16  AtomCollection *coll = [ AtomCollection collection ];
17  [ coll setTitle:@"mytitle" ];
18  [ coll setHref:[ NSURL URLWithString:@"http://example.org/" ] ];
19  [ coll addAccept:@"image/jpeg" ];
20  [ coll addAccept:@"image/png" ];
21  AtomCategories *cats = [ AtomCategories categories ];
22  [ cats setFixed:YES ];
23  [ cats setHref:[ NSURL URLWithString:@"http://example.org/" ] ];
24  [ cats setScheme:@"foobar" ];
25  AtomCategory *cat = [ AtomCategory category ];
26  [ cat setTerm:@"foo" ];
27  [ cat setLabel:@"bar" ];
28  [ cat setScheme:@"buz" ];
29  [ cats addCategory:cat ];
30  [ coll setCategories:cats ];
31  NSString *collString = [ coll stringValue ];
32  STAssertEqualObjects( collString, @"<collection xmlns=\"http://www.w3.org/2007/app\" href=\"http://example.org/\"><title xmlns=\"http://www.w3.org/2005/Atom\">mytitle</title><accept xmlns=\"http://www.w3.org/2007/app\">image/jpeg</accept><accept xmlns=\"http://www.w3.org/2007/app\">image/png</accept><categories xmlns=\"http://www.w3.org/2007/app\" fixed=\"yes\" href=\"http://example.org/\" scheme=\"foobar\"><category xmlns:atom=\"http://www.w3.org/2005/Atom\" term=\"foo\" label=\"bar\" scheme=\"buz\"></category></categories></collection>", nil );
33}
34
35
36@end
Note: See TracBrowser for help on using the browser.