Here are the examples of the csharp api class NUnit.Framework.Assert.Fail(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
0
51. Example
Project: ContinuousTests
Source File: FailFixture.cs
Source File: FailFixture.cs
[Test] [ExpectedException(typeof(AssertionException))] public void FailThrowsAssertionException() { Assert.Fail(String.Empty); }
0
52. Example
Project: ContinuousTests
Source File: MaxTimeTests.cs
Source File: MaxTimeTests.cs
[Test, MaxTime(1000)] [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")] public void FailureReport() { Assert.Fail("Intentional Failure"); }
0
53. Example
Project: ContinuousTests
Source File: Mock.cs
Source File: Mock.cs
public virtual void Verify() { foreach (IMethod method in methods.Values) method.Verify(); if (unexpected.Count > 0) Assert.Fail("Unexpected call to " + (string)unexpected[0]); }
0
54. Example
Project: ContinuousTests
Source File: MockAssembly.cs
Source File: MockAssembly.cs
[Test] public void FailingTest() { Assert.Fail("Intentional failure"); }
0
55. Example
Project: ContinuousTests
Source File: ExpectExceptionTest.cs
Source File: ExpectExceptionTest.cs
[Test] [ExpectedException(typeof(Exception))] public void TestAssertFail() { Assert.Fail( "private message" ); }
0
56. Example
Project: ContinuousTests
Source File: FailFixtureTests.cs
Source File: FailFixtureTests.cs
[Test] public void CallAssertFail() { Assert.Fail(failureMessage); }
0
57. Example
Project: ContinuousTests
Source File: RepeatedTestFixtureTests.cs
Source File: RepeatedTestFixtureTests.cs
[Test, Repeat(3), Ignore("Ignore this test")] public void RepeatShouldIgnore() { Assert.Fail("Ignored test executed"); }
0
58. Example
Project: ContinuousTests
Source File: TestBuilder.cs
Source File: TestBuilder.cs
public static Test MakeTestCase( Type type, string methodName ) { MethodInfo method = Reflect.GetNamedMethod(type, methodName); if (method == null) Assert.Fail("Method not found: " + methodName); return testBuilder.BuildFrom(method); }
0
59. Example
Project: ContinuousTests
Source File: XmlResultWriterTest.cs
Source File: XmlResultWriterTest.cs
[Test, Explicit] public void DemonstrateIllegalSequenceInMessage() { Assert.Fail("Deliberate failure to illustrate ]]> in message "); }
0
60. Example
Project: ContinuousTests
Source File: XmlResultWriterTest.cs
Source File: XmlResultWriterTest.cs
[Test, Explicit] public void DemonstrateIllegalSequenceAtEndOfMessage() { Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>"); }
0
61. Example
Project: ContinuousTests
Source File: FailFixture.cs
Source File: FailFixture.cs
[Test] [ExpectedException(typeof(AssertionException))] public void FailThrowsAssertionException() { Assert.Fail(String.Empty); }
0
62. Example
Project: ContinuousTests
Source File: MaxTimeTests.cs
Source File: MaxTimeTests.cs
[Test, MaxTime(1000)] [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")] public void FailureReport() { Assert.Fail("Intentional Failure"); }
0
63. Example
Project: ContinuousTests
Source File: Mock.cs
Source File: Mock.cs
public virtual void Verify() { foreach (IMethod method in methods.Values) method.Verify(); if (unexpected.Count > 0) Assert.Fail("Unexpected call to " + (string)unexpected[0]); }
0
64. Example
Project: ContinuousTests
Source File: MockAssembly.cs
Source File: MockAssembly.cs
[Test] public void FailingTest() { Assert.Fail("Intentional failure"); }
0
65. Example
Project: ContinuousTests
Source File: ExpectExceptionTest.cs
Source File: ExpectExceptionTest.cs
[Test] [ExpectedException(typeof(Exception))] public void TestAssertFail() { Assert.Fail( "private message" ); }
0
66. Example
Project: ContinuousTests
Source File: FailFixtureTests.cs
Source File: FailFixtureTests.cs
[Test] public void CallAssertFail() { Assert.Fail(failureMessage); }
0
67. Example
Project: ContinuousTests
Source File: RepeatedTestFixtureTests.cs
Source File: RepeatedTestFixtureTests.cs
[Test, Repeat(3), Ignore("Ignore this test")] public void RepeatShouldIgnore() { Assert.Fail("Ignored test executed"); }
0
68. Example
Project: ContinuousTests
Source File: TestBuilder.cs
Source File: TestBuilder.cs
public static Test MakeTestCase( Type type, string methodName ) { MethodInfo method = Reflect.GetNamedMethod(type, methodName); if (method == null) Assert.Fail("Method not found: " + methodName); return testBuilder.BuildFrom(method); }
0
69. Example
Project: ContinuousTests
Source File: XmlResultWriterTest.cs
Source File: XmlResultWriterTest.cs
[Test, Explicit] public void DemonstrateIllegalSequenceInMessage() { Assert.Fail("Deliberate failure to illustrate ]]> in message "); }
0
70. Example
Project: ContinuousTests
Source File: XmlResultWriterTest.cs
Source File: XmlResultWriterTest.cs
[Test, Explicit] public void DemonstrateIllegalSequenceAtEndOfMessage() { Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>"); }
0
71. Example
Project: ContinuousTests
Source File: FailFixture.cs
Source File: FailFixture.cs
[Test] [ExpectedException(typeof(AssertionException))] public void FailThrowsAssertionException() { Assert.Fail(String.Empty); }
0
72. Example
Project: ContinuousTests
Source File: MaxTimeTests.cs
Source File: MaxTimeTests.cs
[Test, MaxTime(1000)] [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")] public void FailureReport() { Assert.Fail("Intentional Failure"); }
0
73. Example
Project: ContinuousTests
Source File: Mock.cs
Source File: Mock.cs
public virtual void Verify() { foreach (IMethod method in methods.Values) method.Verify(); if (unexpected.Count > 0) Assert.Fail("Unexpected call to " + (string)unexpected[0]); }
0
74. Example
Project: ContinuousTests
Source File: MockAssembly.cs
Source File: MockAssembly.cs
[Test] public void FailingTest() { Assert.Fail("Intentional failure"); }
0
75. Example
Project: ContinuousTests
Source File: ExpectExceptionTest.cs
Source File: ExpectExceptionTest.cs
[Test] [ExpectedException(typeof(Exception))] public void TestAssertFail() { Assert.Fail( "private message" ); }
0
76. Example
Project: ContinuousTests
Source File: FailFixtureTests.cs
Source File: FailFixtureTests.cs
[Test] public void CallAssertFail() { Assert.Fail(failureMessage); }
0
77. Example
Project: ContinuousTests
Source File: RepeatedTestFixtureTests.cs
Source File: RepeatedTestFixtureTests.cs
[Test, Repeat(3), Ignore("Ignore this test")] public void RepeatShouldIgnore() { Assert.Fail("Ignored test executed"); }
0
78. Example
Project: ContinuousTests
Source File: TestBuilder.cs
Source File: TestBuilder.cs
public static Test MakeTestCase( Type type, string methodName ) { MethodInfo method = Reflect.GetNamedMethod(type, methodName); if (method == null) Assert.Fail("Method not found: " + methodName); return testBuilder.BuildFrom(method); }
0
79. Example
Project: ContinuousTests
Source File: Fixture1.cs
Source File: Fixture1.cs
[TestCase] [Category("notworking")] public void Should_fail() { Assert.Fail("failing test"); }
0
80. Example
Project: Colore
Source File: ResultTests.cs
Source File: ResultTests.cs
[Test] public void FalseShouldShortCircuitLogicalAnd() { // ReSharper disable once RedundantLogicalConditionalExpressionOperand if (Result.RzFailed && true) Assert.Fail("If-check failed"); }
0
81. Example
Project: Piglet
Source File: TestNonTerminal.cs
Source File: TestNonTerminal.cs
[Test] public void TestBadProduction() { try { var configurator = new ParserConfigurator<string>(); var nt = configurator.CreateNonTerminal(); nt.AddProduction("abc", 123, 2.0, false); Assert.Fail("No exception for bad type in production rule list"); } catch (ArgumentException) { } }
0
82. Example
Project: Piglet
Source File: TestTerminal.cs
Source File: TestTerminal.cs
[Test] public void TestMultipleDefinedTerminalWithDifferentRegEx() { try { var configurator = new ParserConfigurator<string>(); configurator.CreateTerminal("abc", f => "abc"); configurator.CreateTerminal("abc", f => "ABC"); Assert.Fail("No exception for multiple definition of terminal with different regex"); } catch (ParserConfigurationException) { } }
0
83. Example
Project: Piglet
Source File: TokenPrecedenceTest.cs
Source File: TokenPrecedenceTest.cs
[Test] public void TestNonAssociativity() { try { // Configure an illegal rule var configurator = ParserFactory.Configure<int>(); var number = configurator.CreateTerminal(@"\d+", int.Parse); var equals = configurator.CreateTerminal("="); configurator.NonAssociative(equals); var exp = configurator.CreateNonTerminal(); exp.AddProduction(exp, equals, exp) .SetReduceFunction(f => f[0] - f[2]); exp.AddProduction(number).SetReduceFunction( f => f[0]); configurator.CreateParser(); Assert.Fail("You shall not parse!"); } catch (ShiftReduceConflictException<int>) { // We cool } }
0
84. Example
Project: DevExpress.Mvvm.Free
Source File: ParserTests.cs
Source File: ParserTests.cs
protected override void Throw(string msg) { Assert.Fail(msg); }
0
85. Example
Project: NPOI
Source File: TestOPCCompliancePackageModel.cs
Source File: TestOPCCompliancePackageModel.cs
[Test] public void TestPartNameDerivationAdditionAssert_Failure() { OPCPackage pkg = OPCPackage.Create("TODELETEIFEXIST.docx"); try { PackagePartName name = PackagingUriHelper .CreatePartName("/word/document.xml"); PackagePartName nameDerived = PackagingUriHelper .CreatePartName("/word/document.xml/image1.gif"); pkg.CreatePart(name, ContentTypes.XML); pkg.CreatePart(nameDerived, ContentTypes.EXTENSION_GIF); } catch (InvalidOperationException e) { pkg.Revert(); return; } Assert.Fail("A package implementer shall neither create nor recognize a part with a" + " part name derived from another part name by appending segments to it." + " [M1.11]"); }
0
86. Example
Project: NPOI
Source File: TestOPCCompliancePackageModel.cs
Source File: TestOPCCompliancePackageModel.cs
[Test] public void TestPartNameDerivationReadingAssert_Failure() { String filename = "OPCCompliance_DerivedPartNameFail.docx"; try { OPCPackage.Open(POIDataSamples.GetOpenXml4NetInstance().OpenResourceAsStream(filename)); } catch (InvalidFormatException e) { return; } Assert.Fail("A package implementer shall neither create nor recognize a part with a" + " part name derived from another part name by appending segments to it." + " [M1.11]"); }
0
87. Example
Project: NPOI
Source File: TestOPCCompliancePackageModel.cs
Source File: TestOPCCompliancePackageModel.cs
[Test] public void TestAddPackageAlreadyAddFailure() { OPCPackage pkg = OPCPackage.Create("DELETEIFEXISTS.docx"); PackagePartName name1 = null; PackagePartName name2 = null; try { name1 = PackagingUriHelper.CreatePartName("/word/document.xml"); name2 = PackagingUriHelper.CreatePartName("/word/document.xml"); } catch (InvalidFormatException e) { throw new Exception(e.Message); } pkg.CreatePart(name1, ContentTypes.XML); try { pkg.CreatePart(name2, ContentTypes.XML); } catch (PartAlreadyExistsException e) { return; } Assert.Fail("Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]"); }
0
88. Example
Project: NPOI
Source File: TestOPCCompliancePackageModel.cs
Source File: TestOPCCompliancePackageModel.cs
[Test] public void TestAddPackageAlreadyAddAssert_Failure2() { OPCPackage pkg = OPCPackage.Create("DELETEIFEXISTS.docx"); PackagePartName partName = null; try { partName = PackagingUriHelper.CreatePartName("/word/document.xml"); } catch (InvalidFormatException e) { throw new Exception(e.Message); } pkg.CreatePart(partName, ContentTypes.XML); try { pkg.CreatePart(partName, ContentTypes.XML); } catch (InvalidOperationException e) { return; } Assert.Fail("Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]"); }
0
89. Example
Project: NPOI
Source File: TestOPCCompliancePackageModel.cs
Source File: TestOPCCompliancePackageModel.cs
[Test] public void TestAddRelationshipRelationshipsPartAssert_Failure() { OPCPackage pkg = OPCPackage.Create("DELETEIFEXISTS.docx"); PackagePartName name1 = null; try { name1 = PackagingUriHelper .CreatePartName("/test/_rels/document.xml.rels"); } catch (InvalidFormatException e) { Assert.Fail("This exception should never happen !"); } try { pkg.AddRelationship(name1, TargetMode.Internal, PackageRelationshipTypes.CORE_DOCUMENT); } catch (InvalidOperationException e) { return; } Assert.Fail("Assert.Fail test -> M1.25: The Relationships part shall not have relationships to any other part"); }
0
90. Example
Project: NPOI
Source File: TestOPCCompliancePartName.cs
Source File: TestOPCCompliancePartName.cs
[Test] public void TestEmptyPartNameFailure() { try { PackagingUriHelper.CreatePartName(new Uri("",UriKind.Relative)); Assert.Fail("A part name shall not be empty. [M1.1]"); } catch (InvalidFormatException e) { // Normal behaviour } }
0
91. Example
Project: NPOI
Source File: TestOPCCompliancePartName.cs
Source File: TestOPCCompliancePartName.cs
[Test] public void TestPartNameStartsWithAForwardSlashFailure() { try { PackagingUriHelper.CreatePartName(new Uri("document.xml", UriKind.RelativeOrAbsolute)); Assert.Fail("A part name shall start with a forward slash ('/') character. [M1.4]"); } catch (InvalidFormatException e) { // Normal behaviour } }
0
92. Example
Project: NPOI
Source File: TestOPCCompliancePartName.cs
Source File: TestOPCCompliancePartName.cs
[Test] public void TestPartNameEndsWithAForwardSlashFailure() { try { PackagingUriHelper.CreatePartName(new Uri("/document.xml/", UriKind.Relative)); Assert.Fail("A part name shall not have a forward slash as the last character. [M1.5]"); } catch (InvalidFormatException e) { // Normal behaviour } }
0
93. Example
Project: NPOI
Source File: TestContentType.cs
Source File: TestContentType.cs
[Test] public void TestContentTypeValidationFailure() { String[] contentTypesToTest = new String[] { "text/xml/app", "", "test", "text(xml/xml", "text)xml/xml", "text<xml/xml", "text>/xml", "text@/xml", "text,/xml", "text;/xml", "text:/xml", "text\\/xml", "t/ext/xml", "t\"ext/xml", "text[/xml", "text]/xml", "text?/xml", "tex=t/xml", "te{xt/xml", "tex}t/xml", "te xt/xml", "text" + (char) 9 + "/xml", "text xml", " text/xml " }; for (int i = 0; i < contentTypesToTest.Length; ++i) { try { new ContentType(contentTypesToTest[i]); } catch (InvalidFormatException e) { continue; } Assert.Fail("Must have fail for content type: '" + contentTypesToTest[i] + "' !"); } }
0
94. Example
Project: NPOI
Source File: TestContentType.cs
Source File: TestContentType.cs
[Test] public void TestContentTypeParameterFailure() { String[] contentTypesToTest = new String[] { "mail/toto;\"titi=tata\"", // quotes not allowed like that "mail/toto;titi = tata", // spaces not allowed "text/\u0080" // characters above ASCII are not allowed }; for (int i = 0; i < contentTypesToTest.Length; ++i) { try { new ContentType(contentTypesToTest[i]); } catch (InvalidFormatException e) { continue; } Assert.Fail("Must have fail for content type: '" + contentTypesToTest[i] + "' !"); } }
0
95. Example
Project: NPOI
Source File: TestContentType.cs
Source File: TestContentType.cs
[Test] public void TestContentTypeCommentFailure() { String[] contentTypesToTest = new String[] { "text/xml(comment)" }; for (int i = 0; i < contentTypesToTest.Length; ++i) { try { new ContentType(contentTypesToTest[i]); } catch (InvalidFormatException e) { continue; } Assert.Fail("Must have fail for content type: '" + contentTypesToTest[i] + "' !"); } }
0
96. Example
Project: NPOI
Source File: TestPackagingURIHelper.cs
Source File: TestPackagingURIHelper.cs
[Test] public void TestCreateUriFromString() { String[] href = { "..\\\\\\cygwin\\home\\yegor\\.vim\\filetype.vim", "..\\Program%20Files\\AGEIA%20Technologies\\v2.3.3\\NxCooking.dll", "file:///D:\\seva\\1981\\r810102ns.mp3", "..\\cygwin\\home\\yegor\\dinom\\%5baccess%5d.2010-10-26.log", "#'Instructions (Text)'!B21", "javascript://" }; foreach (String s in href) { try { Uri Uri = PackagingUriHelper.ToUri(s); } catch (UriFormatException e) { Assert.Fail("Failed to create Uri from " + s); } } }
0
97. Example
Project: NPOI
Source File: TestXSSFHyperlink.cs
Source File: TestXSSFHyperlink.cs
[Test] public void TestInvalidURLs() { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFCreationHelper CreateHelper = workbook.GetCreationHelper() as XSSFCreationHelper; String[] invalidURLs = { "http:\\apache.org", "www.apache .org", "c:\\temp", "\\poi"}; foreach (String s in invalidURLs) { try { CreateHelper.CreateHyperlink(HyperlinkType.Url).Address = (s); Assert.Fail("expected ArgumentException: " + s); } catch (ArgumentException) { } } }
0
98. Example
Project: NPOI
Source File: TestXSSFRichTextString.cs
Source File: TestXSSFRichTextString.cs
[Test] public void TestApplyFontWithStyles() { XSSFRichTextString rt = new XSSFRichTextString("Apache POI"); StylesTable tbl = new StylesTable(); rt.SetStylesTableReference(tbl); try { rt.ApplyFont(0, 10, (short)1); Assert.Fail("Fails without styles in the table"); } catch (ArgumentOutOfRangeException e) { // expected } tbl.PutFont(new XSSFFont()); rt.ApplyFont(0, 10, (short)1); rt.ApplyFont((short)1); }
0
99. Example
Project: NPOI
Source File: TestXSSFRichTextString.cs
Source File: TestXSSFRichTextString.cs
[Ignore("")] public void TestLineBreaks_bug48877() { //XSSFFont font = /n ..... /n //View Source file for more details /n }
0
100. Example
Project: NPOI
Source File: TestXSSFSheet.cs
Source File: TestXSSFSheet.cs
[Test] public void TestReadFails() { XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = wb.CreateSheet() as XSSFSheet; try { sheet.OnDocumentRead(); Assert.Fail("Throws exception because we cannot read here"); } catch (POIXMLException e) { // expected here } }