本文整理汇总了C#中NUnit.Framework类的典型用法代码示例。如果您正苦于以下问题:C# NUnit.Framework类的具体用法?C# NUnit.Framework怎么用?C# NUnit.Framework使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NUnit.Framework类属于命名空间,在下文中一共展示了NUnit.Framework类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Detect_multiple_anagrams
public void Detect_multiple_anagrams()
{
var detector = new Anagram("master");
var words = new[] { "stream", "pigeon", "maters" };
var results = new[] { "maters", "stream" };
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例2: ItOnlyReturnsTriggeredBundles
public void ItOnlyReturnsTriggeredBundles()
{
var collection = new TriggerCollection();
var bundles = new[]
{
new TriggerBundle(TriggerTestHelpers.StaticTrigger(true)),
new TriggerBundle(TriggerTestHelpers.StaticTrigger(false)),
new TriggerBundle(TriggerTestHelpers.StaticTrigger(true)),
new TriggerBundle(TriggerTestHelpers.StaticTrigger(false)),
new TriggerBundle(TriggerTestHelpers.StaticTrigger(false))
};
var expected = new[]
{
bundles[0],
bundles[2],
};
foreach(var bundle in bundles)
{
collection.Add(bundle);
}
var actual = collection.Check();
CollectionAssert.AreEqual(expected, actual);
}
开发者ID:Mavtak,项目名称:roomie,代码行数:28,代码来源:TriggerCollectionTests.cs
示例3: ShouldInsertPeoples
public void ShouldInsertPeoples()
{
// Given
var db = new DataBaseMicrosoft(DataBasesTypes.MicrosoftAccess, TestHelper.CreateTempFile());
var peoples = new[]
{
new People("Акакий", "Программист"),
new People("Генка", "Плотник")
};
var expected = new[]
{
new People("Иванов Иван", "Плотник"),
new People("Князь Владимир", "Программист"),
new People("Петров Петр", "Плотник"),
new People("Клинт Бартон", "Программист"),
new People("Акакий", "Программист"),
new People("Генка", "Плотник")
};
// When
foreach (var people in peoples)
{
db.ExecuteCommand(Parameters.Insert, people);
}
var actual = db.GetElements<People>();
TestHelper.DeleteTemp();
// Then
Assert.AreEqual(expected.Length, actual.Length);
Assert.IsInstanceOf<People>(actual[0]);
CollectionAssert.AreEqual(expected, actual);
}
开发者ID:sunriselink,项目名称:OLAProject,代码行数:32,代码来源:PeopleTests.cs
示例4: Should_Return_False_For_PropertyInfo_Objects_With_Different_Names
public void Should_Return_False_For_PropertyInfo_Objects_With_Different_Names()
{
var type = new { Prop1 = 10, Prop2 = 20 }.GetType();
var propData1 = new PropertyData(type.GetProperties()[0]);
var propData2 = new PropertyData(type.GetProperties()[1]);
Assert.IsFalse(propData1.Equals(propData2));
}
开发者ID:jbrechtel,项目名称:plant,代码行数:7,代码来源:PropertyDataTest.cs
示例5: Can_campaignTemplateContent
public void Can_campaignTemplateContent()
{
var args = new { cid = "9349a04e77" };
var templateContentResponse = tree.Do(x => x.Campaign.campaignTemplateContent(args));
Assert.True(templateContentResponse.Success);
}
开发者ID:ChrisMissal,项目名称:Freddie,代码行数:7,代码来源:CampaignTests.cs
示例6: MergeSortTestWithNegativeNumbers
public void MergeSortTestWithNegativeNumbers()
{
var input = new[] { 2, 3, 1, -7, 4, 9 };
var expected = new[] { -7, 1, 2, 3, 4, 9 };
SortingProblems.MergeSort(input);
CollectionAssert.AreEqual(expected, input);
}
开发者ID:adilmughal,项目名称:Algorithms-and-Programming-Problems,代码行数:7,代码来源:SortingProblemsTest.cs
示例7: Cmasp_Do
public void Cmasp_Do()
{
var addr = Address.SegPtr(0x0C20, 0);
var proc = new Procedure("foo", null);
var progaddr = new ProgramAddress(program, addr);
var dc = mr.Stub<IDecompiler>();
var dcSvc = mr.Stub<IDecompilerService>();
var brSvc = mr.Stub<IProjectBrowserService>();
dcSvc.Decompiler = dc;
sc.AddService<IDecompilerService>(dcSvc);
sc.AddService<IProjectBrowserService>(brSvc);
sc.AddService<IDecompilerShellUiService>(new FakeShellUiService());
dc.Expect(d => d.ScanProcedure(progaddr)).IgnoreArguments().Return(proc);
brSvc.Expect(b => b.Reload());
mr.ReplayAll();
var locations = new[] { new ProgramAddress(program, addr) };
var cmd = new Cmd_MarkProcedures(sc, locations);
cmd.DoIt();
mr.VerifyAll();
Assert.AreEqual(1, program.User.Procedures.Count);
var uproc = program.User.Procedures.Values[0];
Assert.AreEqual("0C20:0000", uproc.Address);
}
开发者ID:gitter-badger,项目名称:reko,代码行数:25,代码来源:Cmd_MarkProcedureTests.cs
示例8: Anagrams_are_case_insensitive
public void Anagrams_are_case_insensitive()
{
var detector = new Anagram("Orchestra");
var words = new[] { "cashregister", "Carthorse", "radishes" };
var results = new[] { "Carthorse" };
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例9: No_matches
public void No_matches()
{
var detector = new Anagram("diaper");
var words = new[] { "hello", "world", "zombies", "pants" };
var results = new string[0];
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例10: Eliminate_anagram_subsets
public void Eliminate_anagram_subsets()
{
var detector = new Anagram("good");
var words = new[] { "dog", "goody" };
var results = new string[0];
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例11: Identical_word_is_not_anagram
public void Identical_word_is_not_anagram()
{
var detector = new Anagram("corn");
var words = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" };
var results = new[] { "cron" };
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例12: Eliminate_anagrams_with_same_checksum
public void Eliminate_anagrams_with_same_checksum()
{
var detector = new Anagram("mass");
var words = new[] { "last" };
var results = new string[0];
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例13: Does_not_confuse_different_duplicates
public void Does_not_confuse_different_duplicates()
{
var detector = new Anagram("galea");
var words = new[] { "eagle" };
var results = new string[0];
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例14: Detect_simple_anagram
public void Detect_simple_anagram()
{
var detector = new Anagram("ant");
var words = new[] { "tan", "stand", "at" };
var results = new[] { "tan" };
Assert.That(detector.Match(words), Is.EquivalentTo(results));
}
开发者ID:Zero-man,项目名称:exercism,代码行数:7,代码来源:AnagramTest.cs
示例15: InsertionSortTestWithNegativeNumbers
public void InsertionSortTestWithNegativeNumbers()
{
var input = new[] { 2, 3, 1, -7, 4, 9 };
var expected = new[] { -7, 1, 2, 3, 4, 9 };
int[] actual = SortingProblems.InsertionSort(input);
CollectionAssert.AreEqual(expected, actual);
}
开发者ID:adilmughal,项目名称:Algorithms-and-Programming-Problems,代码行数:7,代码来源:SortingProblemsTest.cs
示例16: Can_describe_a_field_reference
public void Can_describe_a_field_reference()
{
var Foo = new {Bar = 6};
string description = SpecDescriber.DescribeSpec(() => Foo.Bar == 42);
description.ShouldBe("Foo.Bar should equal 42");
}
开发者ID:davidmfoley,项目名称:bickle,代码行数:7,代码来源:Describing_a_spec.cs
示例17: MergeSortTestHappyFlow2
public void MergeSortTestHappyFlow2()
{
var input = new[] { 2, 5, 3 };
var expected = new[] { 2, 3, 5 };
SortingProblems.MergeSort(input);
CollectionAssert.AreEqual(expected, input);
}
开发者ID:adilmughal,项目名称:Algorithms-and-Programming-Problems,代码行数:7,代码来源:SortingProblemsTest.cs
示例18: StartAndEndOfStringOrLine
public void StartAndEndOfStringOrLine()
{
string input = "One thing or another\nAnd then some";
string[] patterns = new[] {
@"^\w+",
@"\w+$",
@"^\w+|\w+$",
@"\w+$|^\w+",
@"\w*^\w*",
@"\w*$\w*",
@"\w+$\w*",
@"\A\w+",
@"\w+\Z",
@"\w+\z",
@"\A\w+|\w+\Z",
};
RegexAssert.AreMatchesSameAsMsoft(input, patterns, AlgorithmType);
RegexAssert.AreMatchesSameAsMsoft(input, patterns, AlgorithmType, RegexOptions.Multiline);
}
开发者ID:aistrate,项目名称:RegexParser,代码行数:26,代码来源:AnchorMatcherTests.cs
示例19: QuickSortPositiveTest
public void QuickSortPositiveTest()
{
var input = new[] { 2, 5, 3, 1 };
var expected = new[] { 1, 2, 3, 5 };
SortingProblems.QuickSort(input);
CollectionAssert.AreEqual(expected, input);
}
开发者ID:adilmughal,项目名称:Algorithms-and-Programming-Problems,代码行数:7,代码来源:SortingProblemsTest.cs
示例20: Language_DoesProduceCorrectTokens
public void Language_DoesProduceCorrectTokens()
{
string test = null;
Func<Grammar.Token[]> testit = () =>
new Grammar.Lexer(new StringReader(test)).ToArray();
test = "using namespace @namespace;";
var expected = new[] { Using, Namespace, Identifier, Semicolon, Eof };
var result = testit();
var resultTerminals = result.Select(r => r.Terminal).ToArray();
Assert.That(resultTerminals, Is.EquivalentTo(expected));
Assert.That(result[2], Is.AssignableFrom<IdentifierToken>());
Assert.That((result[2] as IdentifierToken).Name, Is.EqualTo("namespace"));
Assert.That(result[2].Lexeme, Is.EqualTo("@namespace"));
Assert.That(result.AsLexemes(), Is.EquivalentTo(new[] { "using", "namespace", "@namespace", ";", null }));
test = "34.3f";
result = testit();
Assert.That(result[0], Is.TypeOf<NumberToken>());
var number = result[0] as NumberToken;
Assert.That(number.GetFloatValue(), Is.EqualTo(34.3f));
Assert.That(number.IsTypeSpecified, Is.True);
Assert.That(number.TypeSuffix, Is.EqualTo('f'));
}
开发者ID:joshwyant,项目名称:ParserGenerator,代码行数:28,代码来源:LanguageTests.cs
注:本文中的NUnit.Framework类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论