本文整理汇总了C#中Configuration.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.GetItem方法的具体用法?C# Configuration.GetItem怎么用?C# Configuration.GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.GetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseArguments
private static void ParseArguments(Configuration configuration, ICollection<string> theArguments)
{
if (theArguments.Count == 0) {
return;
}
string lastSwitch = string.Empty;
foreach (string argument in theArguments) {
if (argument.StartsWith("-")) {
lastSwitch = argument.Substring(1).ToLower();
}
else {
switch (lastSwitch) {
case "i":
configuration.GetItem<Settings>().InputFolder = argument;
break;
case "o":
configuration.GetItem<Settings>().OutputFolder = argument;
break;
case "x":
foreach (string pattern in argument.Split(';')) {
configuration.GetItem<FileExclusions>().Add(pattern);
}
break;
}
}
}
if (configuration.GetItem<Settings>().InputFolder == null)
throw new FormatException("Missing input folder");
if (configuration.GetItem<Settings>().OutputFolder == null)
throw new FormatException("Missing output folder");
}
示例2: SetUp
public void SetUp()
{
config = new TypeDictionary();
config.GetItem<Settings>().InputFolder = "in";
config.GetItem<Settings>().OutputFolder = "out";
folders = new FolderTestModel();
}
示例3: Service
public Service(Configuration configuration)
: base(configuration, configuration.GetItem<Operators>())
{
ApplicationUnderTest.AddNamespace("fit");
ApplicationUnderTest.AddNamespace("fitSharp.Fit.Fixtures");
ApplicationUnderTest.AddAssembly(Assembly.GetExecutingAssembly().CodeBase);
configuration.GetItem<Operators>().AddNamespaces(ApplicationUnderTest);
}
示例4: Run
public int Run(string[] commandLineArguments, Configuration configuration, ProgressReporter reporter)
{
service = configuration.GetItem<Service>();
service.ApplicationUnderTest = configuration.GetItem<ApplicationUnderTest>();
ParseCommandLine(commandLineArguments);
new Interpreter(messenger, assemblyPaths, service).ProcessInstructions();
return 0;
}
示例5: Execute
public void Execute()
{
Configuration currentConfig = Context.Configuration;
var newConfig = new Configuration(Context.Configuration);
newConfig.GetItem<Service.Service>().ApplicationUnderTest = newConfig.GetItem<ApplicationUnderTest>();
Context.Configuration = newConfig;
ExecuteOnConfiguration();
Context.Configuration = currentConfig;
}
示例6: CreateStoryTestFolder
StoryTestFolder CreateStoryTestFolder(Configuration configuration)
{
var storyTestFolder = new StoryTestFolder(configuration, new FileSystemModel(configuration.GetItem<Settings>().CodePageNumber));
string tagList = configuration.GetItem<Settings>().TagList;
if (!string.IsNullOrEmpty(tagList))
storyTestFolder.AddPageFilter(new TagFilter(tagList));
return storyTestFolder;
}
示例7: ExecutesSuiteTearDownLast
public void ExecutesSuiteTearDownLast()
{
var folders = new FolderTestModel();
folders.MakeFile("in\\suiteteardown.html", "<table><tr><td>fixture</td></tr></table>");
folders.MakeFile("in\\zzzz.html", "<table><tr><td>fixture</td></tr></table>");
var config = new Configuration();
config.GetItem<Settings>().InputFolder = "in";
config.GetItem<Settings>().OutputFolder = "out";
var runner = new SuiteRunner(config, new NullReporter());
runner.Run(new StoryTestFolder(config, folders), string.Empty);
int tearDown = folders.FileContent("out\\reportIndex.html").IndexOf("suiteteardown.html");
int otherFile = folders.FileContent("out\\reportIndex.html").IndexOf("zzzz.html");
Assert.IsTrue(otherFile < tearDown);
}
示例8: RunTestFixture
public void RunTestFixture(string theRows)
{
string html = string.Format("<table><tr><td>fit.Test.FitUnit.TestFixtureFixture</td></tr>{0}</table>", theRows);
Tables = Parse.ParseFrom(html);
var configuration = new Configuration(Processor.Configuration);
configuration.GetItem<Settings>().Runner = "fit.Test.FitUnit.MyRunner";
new fitSharp.Machine.Application.Runner(new string[] {}, Processor.Configuration, new NullReporter());
}
示例9: Run
public int Run(Configuration configuration, IEnumerable<string> arguments, ProgressReporter reporter)
{
ParseArguments(arguments);
myReporter = reporter;
Run(new StoryTestFolder(configuration, new FileSystemModel(configuration.GetItem<Settings>().CodePageNumber)),
mySelection);
return 0; //todo: return counts exceptions + wrong or whatever
}
示例10: AddAssemblies
public void AddAssemblies(Configuration configuration)
{
foreach (string assemblyPath in AssemblyPaths) {
if (assemblyPath == "defaultPath") continue;
configuration.GetItem<ApplicationUnderTest>().AddAssembly(assemblyPath.Replace("\"", string.Empty));
}
if (HasConfigFilePath())
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", ConfigFilePath);
}
示例11: ChangesDontShowInCopy
public void ChangesDontShowInCopy()
{
var test = new TestConfig {Data = "stuff"};
configuration.SetItem(test.GetType(), test);
var copy = new Configuration(configuration);
configuration.GetItem<TestConfig>().Data = "other";
Assert.AreEqual("stuff", copy.GetItem<TestConfig>().Data);
Assert.AreEqual("other", configuration.GetItem<TestConfig>().Data);
}
示例12: Run
public int Run(IList<string> commandLineArguments, Configuration configuration, ProgressReporter reporter)
{
var now = DateTime.Now;
myProgressReporter = reporter;
var result = Run(configuration, commandLineArguments);
//todo: to suiterunner?
if (!configuration.GetItem<Settings>().DryRun)
reporter.Write(string.Format("\n{0}, time: {1}\n", Results, DateTime.Now - now));
return result;
}
示例13: ExecuteOnConfiguration
public void ExecuteOnConfiguration(Configuration configuration)
{
string apartmentConfiguration = configuration.GetItem<Settings>().ApartmentState;
if (apartmentConfiguration != null) {
var desiredState = (ApartmentState)Enum.Parse(typeof(ApartmentState), apartmentConfiguration);
if (Thread.CurrentThread.GetApartmentState() != desiredState) {
var thread = new Thread(o => DoTables((Configuration)o));
thread.SetApartmentState(desiredState);
thread.Start(configuration);
thread.Join();
return;
}
}
DoTables(configuration);
}
示例14: ParseArguments
void ParseArguments(Configuration configuration, IList<string> arguments)
{
if (arguments.Count == 0) {
return;
}
var argumentParser = new ArgumentParser();
argumentParser.AddSwitchHandler("d", () => configuration.GetItem<Settings>().DryRun = true);
argumentParser.AddArgumentHandler("i", value => configuration.GetItem<Settings>().InputFolder = value);
argumentParser.AddArgumentHandler("o", value => configuration.GetItem<Settings>().OutputFolder = value);
argumentParser.AddArgumentHandler("s", value => selectedFile = value);
argumentParser.AddArgumentHandler("x", value => configuration.GetItem<FileExclusions>().AddRange(value.Split(';')));
argumentParser.AddArgumentHandler("t", value => configuration.GetItem<Settings>().TagList = value);
argumentParser.Parse(arguments);
if (configuration.GetItem<Settings>().InputFolder == null)
throw new FormatException("Missing input folder");
if (configuration.GetItem<Settings>().OutputFolder == null)
throw new FormatException("Missing output folder");
}
示例15: ParseArgs
public bool ParseArgs(Configuration configuration, string[] args)
{
string resultsFile = null;
string outputType = "text";
int index = 0;
try {
while (args[index].StartsWith("-")) {
string option = args[index++];
if ("-results".Equals(option))
resultsFile = args[index++];
else if ("-v".Equals(option))
verbose = true;
else if ("-debug".Equals(option))
debug = true;
else if ("-nopaths".Equals(option))
usingDownloadedPaths = false;
else if (option == "-suiteFilter")
suiteFilter = args[index++];
else if ("-format".Equals(option))
outputType = args[index++];
else
throw new Exception("Bad option: " + option);
}
CreateResultWriter(resultsFile, outputType,
new FileSystemModel(configuration.GetItem<Settings>().CodePageNumber));
host = args[index++];
port = Int32.Parse(args[index++]);
pageName = args[index++];
string assemblies = null;
while (args.Length > index)
assemblies = assemblies == null ? args[index++] : (assemblies + ";" + args[index++]);
if (assemblies != null) {
new PathParser(assemblies).AddAssemblies(configuration);
}
return true;
}
catch (Exception) {
return false;
}
}