Created
February 9, 2010 10:32
-
-
Save lukeredpath/299081 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // MusicServiceItemTest.m | |
| // Squeemote | |
| // | |
| // Created by Luke Redpath on 08/02/2010. | |
| // Copyright 2010 LJR Software Limited. All rights reserved. | |
| // | |
| #include "TargetConditionals.h" | |
| #import <SenTestingKit/SenTestingKit.h> | |
| #define HC_SHORTHAND | |
| #import <hamcrest/hamcrest.h> | |
| #import <OCMock/OCMock.h> | |
| #pragma mark - | |
| #import "MusicServiceItem.h" | |
| #import "MusicService.h" | |
| @interface MusicServiceItemTest : SenTestCase { | |
| MusicServiceItem *item; | |
| } | |
| @end | |
| @implementation MusicServiceItemTest | |
| - (void)setUp; | |
| { | |
| item = [[MusicServiceItem alloc] initWithIdentifier:@"123" musicService:nil]; | |
| } | |
| - (void)testParsingOfPropertyValueFromName { | |
| item.name = @"Bitrate: 128kbps"; | |
| assertThat(item.propertyValue, equalTo(@"128kbps")); | |
| } | |
| - (void)testParsingOfPropertyNameFromName { | |
| item.name = @"Bitrate: 128kbps"; | |
| assertThat(item.propertyName, equalTo(@"Bitrate"));; | |
| } | |
| - (void)testNonPropertyStyleNameReturnsNothing { | |
| item.name = @"Top 100 Songs"; | |
| assertThat(item.propertyName, equalTo(nil)); | |
| assertThat(item.propertyValue, equalTo(nil)); | |
| } | |
| @end | |
| #pragma mark - | |
| @interface NapsterMusicServiceItemTest : SenTestCase { | |
| MusicServiceItem *item; | |
| } | |
| @end | |
| @implementation NapsterMusicServiceItemTest | |
| - (void)setUp | |
| { | |
| MusicService *napster = [[MusicService alloc] initWithCommand:@"napster"]; | |
| item = [[MusicServiceItem alloc] initWithIdentifier:@"123" musicService:napster]; | |
| } | |
| - (void)testExtractionOfTrackNameAndArtistAlbumFromName; | |
| { | |
| item.name = @"You've Got The Love by Florence & The Machine from Lungs"; | |
| assertThat(item.trackName, equalTo(@"You've Got The Love")); | |
| assertThat(item.artistName, equalTo(@"Florence & The Machine")); | |
| assertThat(item.albumName, equalTo(@"Lungs")); | |
| } | |
| - (void)testExtractionOfAlbumNameAndArtistFromName; | |
| { | |
| item.name = @"One Life Stand by Hot Chip"; | |
| assertThat(item.artistName, equalTo(@"Hot Chip")); | |
| assertThat(item.albumName, equalTo(@"One Life Stand")); | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment