SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 255 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

Attributes;
namespace BagModel
{
[Feature]
static class ElementRestriction
{
readonly static Set E = new Set(null,"","b");
[Action]
static void Add([Domain("E")]string e)\verb+{}+
[Action]
static void Delete([Domain("E")]string e)\verb+{}+
[Action]
static void Lookup_Start([Domain("E")]string e)\verb+{}+
[AcceptingStateCondition]
static bool IsAcceptingState() {return Contract.content.IsEmpty;}
}
public static class Factory
{
public static ModelProgram CreateScenario()
{
return new LibraryModelProgram(typeof(Contract).Assembly,
"BagModel", new Set("ElementRestriction"));
}
}
}
Figure 12.3. A feature of the bag model and a scenario including the feature.
The factory method CreateScenario creates a restricted model where the input
parameters to the actions are restricted to the given elements. The method uses
the LibraryModelProgram constructor that takes an assembly, a namespace that
identifies a model program in the assembly, and a set of feature names within that
198 Testing Systems with Complex State
model program as arguments. Notice that the ElementRestriction feature has a
void Lookup Start method as opposed to a Lookup method that returns an integer.
This is because the feature does not need to restrict the return values. Using features
to restrict parameter domains is one possible use of features. We discuss more
about the use of features in forthcoming sections.


Pages:
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6