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 140 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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


We recommend putting the factory method in its own factory class. The factory
class always has the same form; only a few identifiers must be changed for each
particular model program. Figure 6.3 shows the factory class from our newsreader
model program.
The factory class appears in the same namespace as the model program and must
be compiled in the same assembly. For example, the code in Figure 6.3 appears in
the same NewsReader namespace as the code in Chapter 5, Figures 5.4 and 5.5. The
factory class must be declared public static. (The class or classes that contain
the state variables and action methods of the model program need not be public;
we recommend they have the default private access.) We usually name the factory
class Factory and the factory method Create, but this is not required. In the body
of the factory method, in the LibraryModelProgram constructor, the argument of
the typeof operator must be the same class, Factory here. The second argument
100 Exploring and Analyzing Finite Model Programs
public static class Factory
{
public static ModelProgram Create()
{
return new LibraryModelProgram(typeof(Factory).Assembly, "NewsReader");
}
}
Figure 6.3. Newsreader model program: factory class with factory method.
is a string that contains the name of the model program namespace, NewsReader
here.
To invoke a tool on a model program, reference the assembly that contains the
compiled model program, and provide the fully qualified name of the factory method
in that assembly.


Pages:
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6