Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preliminary unit tests for external data
- Loading branch information
1 parent
71e995a
commit 3866096
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package mesh.store | ||
{ | ||
import org.flexunit.assertThat; | ||
import org.hamcrest.object.equalTo; | ||
import org.hamcrest.object.notNullValue; | ||
|
||
[RunWith("org.flexunit.runners.Parameterized")] | ||
public class ExternalDataTests | ||
{ | ||
public static var READ_DATA:Array = [ | ||
[{name:"Bill Clinton"}, "name"] | ||
]; | ||
|
||
public static var SET_DATA:Array = [ | ||
[{}, "name", "Bill Clinton"] | ||
]; | ||
|
||
[Test] | ||
public function testIdFieldOption():void | ||
{ | ||
var ID:int = 1; | ||
var data:ExternalData = new ExternalData({personId:ID}, {idField:"personId"}); | ||
assertThat(data.id, equalTo(ID)); | ||
} | ||
|
||
[Test(dataProvider="READ_DATA")] | ||
public function testReadProperty(obj:Object, property:String):void | ||
{ | ||
var data:ExternalData = new ExternalData(obj); | ||
assertThat(data[property], notNullValue()); | ||
} | ||
|
||
[Test(dataProvider="SET_DATA")] | ||
public function testSetProperty(obj:Object, property:String, value:Object):void | ||
{ | ||
var data:ExternalData = new ExternalData(obj); | ||
data[property] = value; | ||
assertThat(data[property], equalTo(value)); | ||
} | ||
} | ||
} |