NUnit.Framework.Assert.Fail(string)

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 7

1. Example

Project: ContinuousTests
Source File: XmlResultWriterTest.cs
[Test, Explicit]
        public void DemonstrateIllegalSequenceInMessage()
        {
            Assert.Fail("Deliberate failure to illustrate ]]> in message ");
        }

2. Example

Project: ContinuousTests
Source File: XmlResultWriterTest.cs
[Test, Explicit]
        public void DemonstrateIllegalSequenceAtEndOfMessage()
        {
            Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>");
        }

3. Example

Project: ContinuousTests
Source File: FailFixture.cs
[Test]
		[ExpectedException(typeof(AssertionException))]
		public void FailThrowsAssertionException()
		{
			Assert.Fail(String.Empty);
		}

4. Example

Project: ContinuousTests
Source File: MaxTimeTests.cs
[Test, MaxTime(1000)]
        [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")]
        public void FailureReport()
        {
            Assert.Fail("Intentional Failure");
        }

5. Example

Project: ContinuousTests
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]);
        }

6. Example

Project: ContinuousTests
Source File: MockAssembly.cs
[Test]
            public void FailingTest()
            {
                Assert.Fail("Intentional failure");
            }

7. Example

Project: ContinuousTests
Source File: ExpectExceptionTest.cs
[Test]
		[ExpectedException(typeof(Exception))]
		public void TestAssertFail()
		{
			Assert.Fail( "private message" );
		}

8. Example

Project: ContinuousTests
Source File: FailFixtureTests.cs
[Test]
		public void CallAssertFail()
		{
			Assert.Fail(failureMessage);
		}

9. Example

Project: ContinuousTests
Source File: RepeatedTestFixtureTests.cs
[Test, Repeat(3), Ignore("Ignore this test")]
        public void RepeatShouldIgnore()
        {
            Assert.Fail("Ignored test executed");
        }

10. Example

Project: ContinuousTests
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);
        }

11. Example

Project: ContinuousTests
Source File: XmlResultWriterTest.cs
[Test, Explicit]
        public void DemonstrateIllegalSequenceInMessage()
        {
            Assert.Fail("Deliberate failure to illustrate ]]> in message ");
        }

12. Example

Project: ContinuousTests
Source File: XmlResultWriterTest.cs
[Test, Explicit]
        public void DemonstrateIllegalSequenceAtEndOfMessage()
        {
            Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>");
        }

13. Example

Project: ContinuousTests
Source File: FailFixture.cs
[Test]
		[ExpectedException(typeof(AssertionException))]
		public void FailThrowsAssertionException()
		{
			Assert.Fail(String.Empty);
		}

14. Example

Project: ContinuousTests
Source File: MaxTimeTests.cs
[Test, MaxTime(1000)]
        [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")]
        public void FailureReport()
        {
            Assert.Fail("Intentional Failure");
        }

15. Example

Project: ContinuousTests
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]);
        }

16. Example

Project: ContinuousTests
Source File: MockAssembly.cs
[Test]
            public void FailingTest()
            {
                Assert.Fail("Intentional failure");
            }

17. Example

Project: ContinuousTests
Source File: ExpectExceptionTest.cs
[Test]
		[ExpectedException(typeof(Exception))]
		public void TestAssertFail()
		{
			Assert.Fail( "private message" );
		}

18. Example

Project: ContinuousTests
Source File: FailFixtureTests.cs
[Test]
		public void CallAssertFail()
		{
			Assert.Fail(failureMessage);
		}

19. Example

Project: ContinuousTests
Source File: RepeatedTestFixtureTests.cs
[Test, Repeat(3), Ignore("Ignore this test")]
        public void RepeatShouldIgnore()
        {
            Assert.Fail("Ignored test executed");
        }

20. Example

Project: ContinuousTests
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);
        }

21. Example

Project: ContinuousTests
Source File: XmlResultWriterTest.cs
[Test, Explicit]
        public void DemonstrateIllegalSequenceInMessage()
        {
            Assert.Fail("Deliberate failure to illustrate ]]> in message ");
        }

22. Example

Project: ContinuousTests
Source File: XmlResultWriterTest.cs
[Test, Explicit]
        public void DemonstrateIllegalSequenceAtEndOfMessage()
        {
            Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>");
        }

23. Example

Project: ContinuousTests
Source File: FailFixture.cs
[Test]
		[ExpectedException(typeof(AssertionException))]
		public void FailThrowsAssertionException()
		{
			Assert.Fail(String.Empty);
		}

24. Example

Project: ContinuousTests
Source File: MaxTimeTests.cs
[Test, MaxTime(1000)]
        [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")]
        public void FailureReport()
        {
            Assert.Fail("Intentional Failure");
        }

25. Example

Project: ContinuousTests
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]);
        }

26. Example

Project: ContinuousTests
Source File: MockAssembly.cs
[Test]
            public void FailingTest()
            {
                Assert.Fail("Intentional failure");
            }

27. Example

Project: ContinuousTests
Source File: ExpectExceptionTest.cs
[Test]
		[ExpectedException(typeof(Exception))]
		public void TestAssertFail()
		{
			Assert.Fail( "private message" );
		}

28. Example

Project: ContinuousTests
Source File: FailFixtureTests.cs
[Test]
		public void CallAssertFail()
		{
			Assert.Fail(failureMessage);
		}

29. Example

Project: ContinuousTests
Source File: RepeatedTestFixtureTests.cs
[Test, Repeat(3), Ignore("Ignore this test")]
        public void RepeatShouldIgnore()
        {
            Assert.Fail("Ignored test executed");
        }

30. Example

Project: ContinuousTests
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);
        }

31. Example

Project: ContinuousTests
Source File: Fixture1.cs
[TestCase]
		[Category("notworking")]
        public void Should_fail()
        {
            Assert.Fail("failing test");
        }

32. Example

Project: Colore
Source File: ResultTests.cs
[Test]
        public void FalseShouldShortCircuitLogicalAnd()
        {
            // ReSharper disable once RedundantLogicalConditionalExpressionOperand
            if (Result.RzFailed && true)
                Assert.Fail("If-check failed");
        }

33. Example

Project: Piglet
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)
            {
            }
        }

34. Example

Project: Piglet
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)
            {
            }
        }

35. Example

Project: Piglet
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
            }
        }

36. Example

Project: DevExpress.Mvvm.Free
Source File: ParserTests.cs
protected override void Throw(string msg) {
                Assert.Fail(msg);
            }

37. Example

Project: NPOI
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]");
        }

38. Example

Project: NPOI
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]");
        }

39. Example

Project: NPOI
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]");
        }

40. Example

Project: NPOI
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]");
        }

41. Example

Project: NPOI
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");
        }

42. Example

Project: NPOI
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
            }
        }

43. Example

Project: NPOI
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
            }
        }

44. Example

Project: NPOI
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
            }
        }

45. Example

Project: NPOI
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]
                        + "' !");
            }
        }

46. Example

Project: NPOI
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]
                        + "' !");
            }
        }

47. Example

Project: NPOI
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]
                        + "' !");
            }
        }

48. Example

Project: NPOI
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);
                }
            }
        }

49. Example

Project: NPOI
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)
                {
                }
            }
        }

50. Example

Project: NPOI
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);
        }