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: MaxTimeTests.cs
View license
[Test, MaxTime(1000)]
        [ExpectedException(typeof(AssertionException), ExpectedMessage = "Intentional Failure")]
        public void FailureReport()
        {
            Assert.Fail("Intentional Failure");
        }

2. Example

Project: ContinuousTests
Source File: TestBuilder.cs
View license
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);
        }

3. Example

View license
[Test, Explicit]
        public void DemonstrateIllegalSequenceInMessage()
        {
            Assert.Fail("Deliberate failure to illustrate ]]> in message ");
        }

4. Example

Project: ContinuousTests
Source File: TestBuilder.cs
View license
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);
        }

5. Example

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

6. Example

View license
[Test, Repeat(3), Ignore("Ignore this test")]
        public void RepeatShouldIgnore()
        {
            Assert.Fail("Ignored test executed");
        }

7. Example

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

8. Example

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

9. Example

View license
[Test, Explicit]
        public void DemonstrateIllegalSequenceInMessage()
        {
            Assert.Fail("Deliberate failure to illustrate ]]> in message ");
        }

10. Example

View license
[Test, Repeat(3), Ignore("Ignore this test")]
        public void RepeatShouldIgnore()
        {
            Assert.Fail("Ignored test executed");
        }

11. Example

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

12. Example

View license
[Test, Explicit]
        public void DemonstrateIllegalSequenceAtEndOfMessage()
        {
            Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>");
        }

13. Example

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

14. Example

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

15. Example

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

16. Example

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

17. Example

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

18. Example

View license
[Test, Repeat(3), Ignore("Ignore this test")]
        public void RepeatShouldIgnore()
        {
            Assert.Fail("Ignored test executed");
        }

19. Example

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

20. Example

View license
[Test, Explicit]
        public void DemonstrateIllegalSequenceAtEndOfMessage()
        {
            Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>");
        }

21. Example

View license
[Test]
		[ExpectedException(typeof(Exception))]
		public void TestAssertFail()
		{
			Assert.Fail( "private message" );
		}

22. Example

View license
[Test]
		[ExpectedException(typeof(Exception))]
		public void TestAssertFail()
		{
			Assert.Fail( "private message" );
		}

23. Example

View license
[Test]
		[ExpectedException(typeof(Exception))]
		public void TestAssertFail()
		{
			Assert.Fail( "private message" );
		}

24. Example

Project: ContinuousTests
Source File: Mock.cs
View license
public virtual void Verify()
        {
            foreach (IMethod method in methods.Values)
                method.Verify();

            if (unexpected.Count > 0)
                Assert.Fail("Unexpected call to " + (string)unexpected[0]);
        }

25. Example

View license
[Test, Explicit]
        public void DemonstrateIllegalSequenceAtEndOfMessage()
        {
            Assert.Fail("The CDATA was: <![CDATA[ My <xml> ]]>");
        }

26. Example

Project: ContinuousTests
Source File: Mock.cs
View license
public virtual void Verify()
        {
            foreach (IMethod method in methods.Values)
                method.Verify();

            if (unexpected.Count > 0)
                Assert.Fail("Unexpected call to " + (string)unexpected[0]);
        }

27. Example

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

28. Example

Project: ContinuousTests
Source File: TestBuilder.cs
View license
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);
        }

29. Example

View license
[Test, Explicit]
        public void DemonstrateIllegalSequenceInMessage()
        {
            Assert.Fail("Deliberate failure to illustrate ]]> in message ");
        }

30. Example

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

31. Example

Project: ContinuousTests
Source File: Mock.cs
View license
public virtual void Verify()
        {
            foreach (IMethod method in methods.Values)
                method.Verify();

            if (unexpected.Count > 0)
                Assert.Fail("Unexpected call to " + (string)unexpected[0]);
        }

32. Example

Project: Colore
Source File: ResultTests.cs
View license
[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
View license
[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: TokenPrecedenceTest.cs
View license
[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
            }
        }

35. Example

Project: Piglet
Source File: TestTerminal.cs
View license
[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)
            {
            }
        }

36. Example

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

37. Example

Project: NPOI
Source File: TestOPCCompliancePartName.cs
View license
[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
            }
        }

38. Example

Project: NPOI
Source File: TestCellReference.cs
View license
[Test]
        public void TestInvalidReference()
        {
            try
            {
                new CellReference("Sheet1!#REF!");
                Assert.Fail("Shouldn't be able to create a #REF! refence");
            }
            catch (ArgumentException) { }

            try
            {
                new CellReference("'MySheetName'!#REF!");
                Assert.Fail("Shouldn't be able to create a #REF! refence");
            }
            catch (ArgumentException) { }

            try
            {
                new CellReference("#REF!");
                Assert.Fail("Shouldn't be able to create a #REF! refence");
            }
            catch (ArgumentException) { }
        }

39. Example

View license
[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: TestHexDump.cs
View license
[Test]
        public void TestDumpToStringOutOfIndex()
        {
            byte[] testArray = new byte[0];

            try
            {
                HexDump.Dump(testArray, 0, -1);
                Assert.Fail("Should throw an exception with invalid input");
            }
            catch (IndexOutOfRangeException)
            {
                // expected
            }

            try
            {
                HexDump.Dump(testArray, 0, 1);
                Assert.Fail("Should throw an exception with invalid input");
            }
            catch (IndexOutOfRangeException)
            {
                // expected
            }
        }

41. Example

Project: NPOI
Source File: TestNPOIFSStream.cs
View license
[Test]
        public void TestWriteFailsOnLoop()
        {
            NPOIFSFileSystem fs = new NPOIFSFileSystem(_inst.GetFile("BlockSize512.zvi"));

            // Hack the FAT so that it goes 0->1->2->0
            fs.SetNextBlock(0, 1);
            fs.SetNextBlock(1, 2);
            fs.SetNextBlock(2, 0);

            // Try to write a large amount, should fail on the write
            byte[] data = new byte[512 * 4];
            NPOIFSStream stream = new NPOIFSStream(fs, 0);
            try
            {
                stream.UpdateContents(data);
                Assert.Fail("Loop should have been detected but wasn't!");
            }
            catch (Exception) { }

            // Now reset, and try on a small bit
            // Should fail during the freeing set
            fs.SetNextBlock(0, 1);
            fs.SetNextBlock(1, 2);
            fs.SetNextBlock(2, 0);

            data = new byte[512];
            stream = new NPOIFSStream(fs, 0);
            try
            {
                stream.UpdateContents(data);
                Assert.Fail("Loop should have been detected but wasn't!");
            }
            catch (Exception) { }

            fs.Close();
        }

42. Example

View license
[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]");
        }

43. Example

Project: NPOI
Source File: TestBlockListImpl.cs
View license
[Test]
        public void TestSetBAT()
        {
            BlockListImpl list = new BlockListImpl();

            list.BAT = null;
            list.BAT = new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
            try
            {
                list.BAT = new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
                Assert.Fail("second attempt should have Assert.Failed");
            }
            catch (IOException )
            {
            }
        }

44. Example

Project: NPOI
Source File: TestOPCCompliancePartName.cs
View license
[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: TestPLVRecord.cs
View license
[Test]
        public void TestPLVRecord1()
        {
            Stream is1 = HSSFTestDataSamples.OpenSampleFileStream(XLS_FILENAME);
            HSSFWorkbook workbook = new HSSFWorkbook(is1);

            CellRangeAddressList cellRange = new CellRangeAddressList(0, 0, 1, 1);
            IDataValidationConstraint constraint = DVConstraint.CreateFormulaListConstraint(DV_DEFINITION);
            HSSFDataValidation dataValidation = new HSSFDataValidation(cellRange, constraint);

            // This used to throw an error before
            try
            {
                workbook.GetSheet(SHEET_NAME).AddValidationData(dataValidation);
            }
            catch (InvalidOperationException)
            {
                Assert.Fail("Identified bug 53972, PLV record breaks addDataValidation()");
            }
        }

46. Example

Project: NPOI
Source File: TestXSSFHyperlink.cs
View license
[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)
                {
                }
            }
        }

47. Example

Project: NPOI
Source File: TestWrite.cs
View license
void reader3_StreamReaded(object sender, POIFSReaderEventArgs e)
        {
            try
            {
                PropertySetFactory.Create(e.Stream);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }

48. Example

Project: NPOI
Source File: TestBorderCode.cs
View license
private Paragraph FindParagraph(String expectedText)
        {
            while (pos < range.NumParagraphs - 1)
            {
                Paragraph par = range.GetParagraph(pos);
                pos++;
                if (par.Text.Equals(expectedText))
                    return par;
            }

            Assert.Fail("Expected paragraph not found");

            // should never come here
            throw null;
        }

49. Example

Project: NPOI
Source File: TestMarkerFormatRecord.cs
View license
[Test]
        public void TestLoad()
        {
            Assert.Fail("should complete the test");
        }

50. Example

Project: NPOI
Source File: TestArrayUtil.cs
View license
[Test]
        public void TestCharFill()
        {
            char[] a=new char[100];
            Arrays.Fill(a, 'a');
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] != 'a')
                {
                    Assert.Fail("incorrect default value");
                }
            }
        }