PageRenderTime 55ms CodeModel.GetById 48ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/model/properties/propertyispresent.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 29 lines | 24 code | 5 blank | 0 comment | 0 complexity | 09cb10e261079a5c17c196f08334394e MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_returns_true_when_property_is_set">
 4		<cfset loc.model = model("author") />
 5		<cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
 6		<cfset loc.model = loc.model.new(properties=loc.properties) />
 7		<cfset assert('loc.model.propertyIsPresent("firstName") eq true') />
 8	</cffunction>
 9
10	<cffunction name="test_returns_false_when_property_is_blank">
11		<cfset loc.model = model("author").new() />
12		<cfset loc.model.lastName = "" />
13		<cfset assert('loc.model.propertyIsPresent("lastName") eq false') />
14	</cffunction>
15
16	<cffunction name="test_returns_false_when_property_does_not_exist">
17		<cfset loc.model = model("author").new() />
18		<cfset StructDelete(loc.model, "lastName")>
19		<cfset assert('loc.model.propertyIsPresent("lastName") eq false') />
20	</cffunction>
21
22	<cffunction name="test_dynamic_method_call">
23		<cfset loc.model = model("author") />
24		<cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
25		<cfset loc.model = loc.model.new(properties=loc.properties) />
26		<cfset assert('loc.model.firstNameIsPresent() eq true') />
27	</cffunction>
28
29</cfcomponent>