本文整理汇总了C#中Options.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Options.Contains方法的具体用法?C# Options.Contains怎么用?C# Options.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options.Contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldAllowLookupOfAllAddedValuesForEachKey
public void ShouldAllowLookupOfAllAddedValuesForEachKey()
{
var lookup = new Options();
lookup.Add("A", "A1");
lookup.Add("B", "B1");
lookup.Add("A", "A2");
lookup.Add("A", "A3");
lookup.Count.ShouldEqual(2);
lookup.Keys.ShouldEqual("A", "B");
lookup.Contains("A").ShouldBeTrue();
lookup.Contains("B").ShouldBeTrue();
lookup.Contains("C").ShouldBeFalse();
lookup["A"].ShouldEqual("A1", "A2", "A3");
lookup["B"].ShouldEqual("B1");
}
示例2: SaveReport
static void SaveReport(Options options, ExecutionResult executionResult)
{
if (options.Contains(CommandLineOption.NUnitXml))
{
var xDocument = new NUnitXmlReport().Transform(executionResult);
foreach (var fileName in options[CommandLineOption.NUnitXml])
xDocument.Save(fileName, SaveOptions.None);
}
if (options.Contains(CommandLineOption.XUnitXml))
{
var xDocument = new XUnitXmlReport().Transform(executionResult);
foreach (var fileName in options[CommandLineOption.XUnitXml])
xDocument.Save(fileName, SaveOptions.None);
}
}
示例3: CreateListener
static Listener CreateListener(Options options)
{
var teamCityExplicitlySpecified = options.Contains(CommandLineOption.TeamCity);
var runningUnderTeamCity = Environment.GetEnvironmentVariable("TEAMCITY_PROJECT_NAME") != null;
var useTeamCityListener =
(teamCityExplicitlySpecified && options[CommandLineOption.TeamCity].First() == "on") ||
(!teamCityExplicitlySpecified && runningUnderTeamCity);
if (useTeamCityListener)
return new TeamCityListener();
return new ConsoleListener();
}
示例4: Process
private string Process(string html, Options options = Options.Default)
{
if (options.Contains(Options.CleanUpWordHTML)) {
html = WordCleanup.CleanWordHtml(html);
}
using (Input = new StringReader(html))
using (Output = new StringWriter()) {
EntitiesOnly = options.Contains(Options.EntitiesOnly);
EnforceHtmlElement = options.Contains(Options.EnforceHtmlElement);
RemoveExtraWhitespace = options.Contains(Options.RemoveExtraWhitespace);
RemoveComments = options.Contains(Options.RemoveComments);
RemoveXmlns = options.Contains(Options.RemoveXMLNS);
KeepTagCase = options.Contains(Options.KeepTagCase);
while (Next != null) {
var next = Next;
Next = null;
next();
}
if (NumTagsWritten == 0 && !EntitiesOnly) return string.Empty;
if (OpenTags.Count > 0) {
OpenTags.Reverse();
foreach (var tag in OpenTags) {
Output.Write("</" + tag + ">");
}
}
html = Output.ToString().Trim();
if (options.Contains(Options.Pretty)) {
var xml = System.Xml.Linq.XDocument.Parse(html);
using (var str = new System.IO.StringWriter())
using (var xmlw = new System.Xml.XmlTextWriter(str)) {
xmlw.Formatting = System.Xml.Formatting.Indented;
xml.WriteTo(xmlw);
html = str.ToString();
}
html = html.Substring(html.IndexOf("?>") + 2).Trim();
}
return html;
}
}