本文整理汇总了C#中System.Test.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Test.Add方法的具体用法?C# Test.Add怎么用?C# Test.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Test
的用法示例。
在下文中一共展示了Test.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: create_example_test
public void create_example_test()
{
var test = new Test("some test");
test.Section("a");
test.Section("b");
test.Section("c");
Section section = new Section("Math").WithStep("MultiplyBy").WithStep("step1").WithStep("step2");
test.Add(section);
var structure = new StubGrammarStructure
{
Name = "MultiplyBy",
Parent = new FixtureGraph("Math")
};
structure.ModifyExampleTest(test);
test.Parts.Count.ShouldEqual(1);
var theSection = test.Parts[0].ShouldBeOfType<Section>();
theSection.Parts.Count.ShouldEqual(1);
theSection.Parts[0].ShouldBeOfType<IStep>().GrammarKey.ShouldEqual("MultiplyBy");
}
示例2: readFromChildNode
private void readFromChildNode(INode node, Test test)
{
if (node.IsComment())
{
test.AddComment(node.InnerText);
}
else if (node.IsTags())
{
test.AddTags(node.InnerText);
}
else
{
Section section = ReadSection(node);
test.Add(section);
}
}
示例3: addTest
private void addTest(string name, Action<StepLeaf> configure)
{
var test = new Test(name);
var section = new Section(typeof(SampleTableFixture).GetFixtureAlias());
test.Add(section);
var step = new Step("Table1");
section.Add(step);
var leaf = step.LeafFor("rows");
configure(leaf);
AddTest(name, test);
}
示例4: SelectorTester
public JavaScriptTestFile SelectorTester()
{
var mathTest = new Test("math");
mathTest.Add(new Section("Math"));
return new JavaScriptTestFile("Selector Tester")
.TestFile("SelectorTester.js")
.AddTest("math", mathTest)
.Html(x =>
{
FixtureLibrary library =
FixtureLibrary.For(o => o.AddFixturesFromAssemblyContaining<SentenceFixture>());
x.Add("div").Append(new TestEditorTag(library));
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section1").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section2").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section3").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section4").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section5").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section6").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section7").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
x.Add("Div").AddClass(GrammarConstants.EMBEDDED).Id("section8").Add("div").AddClass(
GrammarConstants.STEP_HOLDER).AddClass(GrammarConstants.SECTION);
})
.Fixtures(x => x.AddFixturesFromAssemblyContaining<SentenceFixture>());
}
示例5: Load
private Test Load( XmlDocument document )
{
XmlNode testNode = document.GetElementsByTagName( Constants.TAG_ROOT ).Item( 0 );
Test test = new Test ( testNode.Attributes.GetNamedItem ( Constants.ATTR_NAME ).Value );
XmlNode questionsNode = document.GetElementsByTagName( Constants.TAG_QUESTIONS ).Item( 0 );
foreach ( XmlNode questionNode in questionsNode.ChildNodes )
{
TestQuestion question = new TestQuestion ( questionNode.Attributes.GetNamedItem (Constants.ATTR_TEXT).Value );
foreach ( XmlNode variantNode in questionNode.ChildNodes )
{
question.Add( new TestQuestionVariant(
variantNode.Attributes.GetNamedItem( Constants.ATTR_TEXT ).Value
, int.Parse( variantNode.Attributes.GetNamedItem( Constants.ATTR_WEIGHT ).Value )
) );
}
test.Add ( question );
}
XmlNode conclusionsNode = document.GetElementsByTagName( Constants.TAG_CONCLUSIONS ).Item( 0 );
test.Conclusions.AllowedLimit = int.Parse ( conclusionsNode.Attributes.GetNamedItem ( Constants.ATTR_ALLOWED ).Value );
foreach ( XmlNode conclusionNode in conclusionsNode )
{
test.Conclusions.Add ( new TestConclusion (
int.Parse( conclusionNode.Attributes.GetNamedItem( Constants.ATTR_FROM ).Value )
, int.Parse( conclusionNode.Attributes.GetNamedItem( Constants.ATTR_TO ).Value )
, conclusionNode.InnerText
) );
}
return test;
}