//
// © 2018-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "IoTWrappedRepresentation.h"
#import "IoTRepresentationUtils.h"
#import "IoTResourceAttributes.h"
#import "TestCategories.h"

@interface IoTRepresentationTests : XCTestCase

@property (nonatomic, strong) dispatch_queue_t syncQueue;

@end

@implementation IoTRepresentationTests

- (void)setUp {
    [super setUp];
    self.syncQueue = dispatch_queue_create("com.qualcomm.qti.IoTRepresentationTests", DISPATCH_QUEUE_CONCURRENT);
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testPlayStateAttrSetsEnumsCorrectly {
    IoTPlayStateAttr *playStateAttr = [[IoTPlayStateAttr alloc] initWithStateSyncQueue:self.syncQueue];
    playStateAttr.playState = IoTPlayStatePlaying;
    IoTWrappedRepresentation *wrapped = [playStateAttr packAll];
    XCTAssertEqualObjects([wrapped stringValueForKey:@"playState"], @"playing", @"Play state incorrect");
}

- (void)testMediaPlayerAttrSetsEnumsCorrectly {
    IoTMediaPlayerAttr *mediaPlayerAttr = [[IoTMediaPlayerAttr alloc] initWithStateSyncQueue:self.syncQueue];
    mediaPlayerAttr.shuffleMode = IoTShuffleModeShuffle;
    mediaPlayerAttr.loopMode = IoTLoopModeAll;
    IoTWrappedRepresentation *wrapped = [mediaPlayerAttr packAll];
    XCTAssertEqualObjects([wrapped stringValueForKey:@"shuffleMode"], @"shuffle", @"Shuffle mode incorrect");
    XCTAssertEqualObjects([wrapped stringValueForKey:@"loopMode"], @"all", @"Loop mode incorrect");
}
@end
