NUnit.Framework.Assert.Fail(string, params object[])

Here are the examples of the csharp api class NUnit.Framework.Assert.Fail(string, params object[]) 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: FormTester.cs
View license
public void AssertControlsAreStackedVertically( params string[] names )
		{
			string prior = null;
			foreach( string current in names )
			{
				if ( prior != null )
				{
					if ( Controls[prior].Bottom > Controls[current].Top )
						Assert.Fail( "The {0} control should be above the {1} control", prior, current );
				}
				prior = current;
			}
		}

2. Example

Project: ContinuousTests
Source File: FormTester.cs
View license
public void AssertControlsAreStackedVertically( params string[] names )
		{
			string prior = null;
			foreach( string current in names )
			{
				if ( prior != null )
				{
					if ( Controls[prior].Bottom > Controls[current].Top )
						Assert.Fail( "The {0} control should be above the {1} control", prior, current );
				}
				prior = current;
			}
		}

3. Example

Project: ContinuousTests
Source File: FormTester.cs
View license
public void AssertControlsAreStackedVertically( params string[] names )
		{
			string prior = null;
			foreach( string current in names )
			{
				if ( prior != null )
				{
					if ( Controls[prior].Bottom > Controls[current].Top )
						Assert.Fail( "The {0} control should be above the {1} control", prior, current );
				}
				prior = current;
			}
		}

4. Example

Project: ContinuousTests
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

5. Example

Project: ContinuousTests
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

6. Example

Project: ContinuousTests
Source File: MessageBusTests.cs
View license
[TearDown]
        public void TearDown()
        {
            _container.Dispose();
            if (_threadException.Length > 0)
                Assert.Fail("Caught thread exception{1}{0}", _threadException, Environment.NewLine);
        }

7. Example

Project: ContinuousTests
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

8. Example

Project: ContinuousTests
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

9. Example

Project: ContinuousTests
Source File: Assert.template.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

10. Example

Project: ContinuousTests
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

11. Example

Project: ContinuousTests
Source File: Assert.template.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

12. Example

Project: ContinuousTests
Source File: Assert.template.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

13. Example

Project: ContinuousTests
Source File: Assert.template.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

14. Example

Project: ContinuousTests
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

15. Example

Project: api
Source File: Assert.cs
View license
public static void IsTrue(bool condition, string message, params object[] args)
        {
            if (!condition)
            {
                Fail(message, args);
            }
        }

16. Example

Project: api
Source File: Assert.cs
View license
public static void IsFalse(bool condition, string message, params object[] args)
        {
            if (condition)
            {
                Fail(message, args);
            }
        }

17. Example

Project: NosDB
Source File: TestWorkQueue.cs
View license
[Test, ExpectedException(typeof(ObjectDisposedException))]
        public void TestEnqueueAfterDispose()
        {
            int counter = 0;
            WorkQueue worker = new WorkQueue(1);
            worker.Complete(false, 100);
            worker.Enqueue(delegate() { counter++; });
            Assert.Fail("Enqueue after Dispose()", counter);
        }

18. Example

View license
private void Callback2(object obj)
        {
            if (obj is int)
            {
                var i = (int) obj;
                switch (i)
                {
                    case 0:
                        ++aCalled;
                        break;
                    case 1:
                        ++cCalled;
                        break;
                    case 2:
                        ++bCalled;
                        break;
                }
            }
            else Assert.Fail("Junk sent back in callback", obj);
        }

19. Example

View license
private void CallbackSetTest1(object obj)
        {
            if (obj is int)
            {
                var i = (int) obj;
                if (i != test1 + 1) Assert.Fail("Callbacks called in the wrong order", obj);
                test1 = i;
            }
            else Assert.Fail("Junk sent back in callback", obj);
        }

20. Example

Project: NodaTime
Source File: TestHelper.cs
View license
internal static void AssertCharEqual(char expected, char actual, string message)
        {
            if (expected != actual)
            {
                if (message == null)
                {
                    message = "";
                }
                else
                {
                    message = message + "\n";
                }
                Assert.Fail("{0}  Expected: '{1}'\n  But was:  '{2}'", message, expected, actual);
            }
        }

21. Example

Project: iOS4Unity
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

22. Example

Project: iOS4Unity
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

23. Example

Project: imt-wanke-client
Source File: BitFieldTest.cs
View license
[Ignore("This is deliberately broken to work around bugs in azureus")]
        public void InvalidBitfieldTest()
        {
            // Set each of the 4 trailing bits to 1 to force a decode error
            for (byte i = 8; i > 0; i /= 2)
            {
                try
                {
                    initialByteValues[1] += i;
                    bf = new BitField(initialByteValues, initalValues.Length);
                    Assert.Fail("The bitfield was corrupt but decoded correctly: Loop {0}", i);
                }
                catch (MessageException) { initialByteValues[1] -= i; }
            }
        }

24. Example

Project: 32feet
Source File: Assert.cs
View license
static public void Fail(string message) 
		{
			Assert.Fail(message, null);
		}

25. Example

Project: 32feet
Source File: Assert.cs
View license
static public void Fail() 
		{
			Assert.Fail(string.Empty, null);
		}

26. Example

Project: 32feet
Source File: Assert.cs
View license
static public void Fail(string message) 
		{
			Assert.Fail(message, null);
		}

27. Example

Project: 32feet
Source File: Assert.cs
View license
static public void Fail() 
		{
			Assert.Fail(string.Empty, null);
		}

28. Example

Project: mathnet-numerics
Source File: AssertHelpers.cs
View license
public static void AlmostEqual(IList<Complex> expected, IList<Complex> actual, int decimalPlaces)
        {
            for (var i = 0; i < expected.Count; i++)
            {
                if (!actual[i].AlmostEqual(expected[i], decimalPlaces))
                {
                    Assert.Fail("Not equal within {0} places. Expected:{1}; Actual:{2}", decimalPlaces, expected[i], actual[i]);
                }
            }
        }

29. Example

Project: mathnet-numerics
Source File: AssertHelpers.cs
View license
public static void AlmostEqualRelative(IList<Complex> expected, IList<Complex> actual, int decimalPlaces)
        {
            for (var i = 0; i < expected.Count; i++)
            {
                if (!actual[i].AlmostEqualRelative(expected[i], decimalPlaces))
                {
                    Assert.Fail("Not equal within {0} places. Expected:{1}; Actual:{2}", decimalPlaces, expected[i], actual[i]);
                }
            }
        }

30. Example

Project: mathnet-numerics
Source File: AssertHelpers.cs
View license
public static void AlmostEqualList(IList<Complex> expected, IList<Complex> actual, double maximumError)
        {
            for (var i = 0; i < expected.Count; i++)
            {
                if (!actual[i].AlmostEqual(expected[i], maximumError))
                {
                    Assert.Fail("Not equal within a maximum error {0}. Expected:{1}; Actual:{2}", maximumError, expected[i], actual[i]);
                }
            }
        }

31. Example

Project: msgpack-cli
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

32. Example

Project: msgpack-cli
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

33. Example

Project: msgpack-cli
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

34. Example

Project: msgpack-cli
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

35. Example

Project: nunitlite
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

36. Example

Project: nunitlite
Source File: AssertFailFixture.cs
View license
[Test]
        public void CallAssertFailWithMessageAndArgs()
        {
            Assert.Fail("MESSAGE: {0}+{1}={2}", 2, 2, 4);
        }

37. Example

Project: nunitlite
Source File: AssertFailTests.cs
View license
[Test, ExpectedException(typeof(AssertionException), ExpectedMessage = "MESSAGE: 2+2=4")]
        public void ThrowsAssertionExceptionWithMessageAndArgs()
        {
            Assert.Fail("MESSAGE: {0}+{1}={2}", 2, 2, 4);
        }

38. Example

Project: nunitlite
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

39. Example

Project: nunit
Source File: Assert.cs
View license
static public void Fail()
        {
            Assert.Fail(string.Empty, null);
        }

40. Example

Project: nunit
Source File: AssertFailFixture.cs
View license
[Test]
        public void CallAssertFailWithMessageAndArgs()
        {
            Assert.Fail("MESSAGE: {0}+{1}={2}", 2, 2, 4);
        }

41. Example

Project: nunit
Source File: Assert.cs
View license
static public void Fail(string message)
        {
            Assert.Fail(message, null);
        }

42. Example

View license
[TestCaseSource("KNOWN_EXTENSION_POINT_PATHS")]
        public void CanListExtensionPoints(string path)
        {
            foreach (var ep in _serviceInterface.ExtensionPoints)
                if (ep.Path == path)
                    return;

            Assert.Fail("Couldn't find known ExtensionPoint {0}", path);
        }

43. Example

Project: discutils
Source File: BlockCacheTest.cs
View license
private void AssertSequenced(byte[] buffer, int offset, int count, int seqOffset)
        {
            for (int i = 0; i < count; ++i)
            {
                if (buffer[i + offset] != (byte)(i + seqOffset))
                {
                    Assert.Fail("Expected {0} at index {1}, was {2}", (byte)(i + seqOffset), i + offset, buffer[i + offset]);
                }
            }
        }

44. Example

Project: Jayrock
Source File: TestInternetDate.cs
View license
[ Test ]
        public void CannotParseUnknownZones()
        {
            foreach (string zone in new string[] {"ZT", "ZZT", "EZT", "ZST"})
            {
                try 
                { 
                    InternetDate.Parse("Sun, 26 Feb 2006 17:52:20 " + zone);
                    Assert.Fail("{0} is not a valid zone.", zone);
                } 
                catch (FormatException) 
                {
                    continue;
                }
            }
        }

45. Example

Project: Rosalia
Source File: TaskResultExtensions.cs
View license
public static ITaskResult<T> AssertSuccess<T>(this ITaskResult<T> result)
        {
            if (!result.IsSuccess)
            {
                Assert.Fail("Expected success result but was error {0}", result.Error);
            }

            return result;
        }

46. Example

Project: Rosalia
Source File: SpyLogRenderer.cs
View license
public void AssertHasMessage(MessageLevel level, string message)
        {
            foreach (var messageTuple in _messages)
            {
                if (messageTuple.Item1.Level == level && messageTuple.Item1.Text == message)
                {
                    return;
                }
            }

            Assert.Fail("Message [{0}] with level {1} not found", message, level);
        }

47. Example

Project: Rosalia
Source File: ResultWrapper.cs
View license
public ResultWrapper<T> AssertSuccess()
        {
            if (!_result.IsSuccess)
            {
                Assert.Fail("Expected success result but was error {0}", _result.Error);
            }

            return this;
        }

48. Example

Project: NClass
Source File: NStubCoreTest.cs
View license
[Test]
		public void GenerateCodeTest()
		{
			try
			{
				_nStubCore.GenerateCode();
			}
			catch (Exception exception)
			{
				Assert.Fail("This operation should be able to complete with no errors: {0}",
					exception.Message);
			}
		}

49. Example

View license
[Test]
		public void GenerateProjectFileTest()
		{
			try
			{
				_cSharpProjectGenerator.GenerateProjectFile();
			}
			catch (Exception exception)
			{
				Assert.Fail("Any exception will be considered a failure: {0}",
							exception.Message);
			}
		}

50. Example

Project: NClass
Source File: CSharpCodeGeneratorTest.cs
View license
[Test]
		public void GenerateCodeTest()
		{
			try
			{
				_cSharpCodeGenerator.GenerateCode();
			}
			catch (Exception exception)
			{
				Assert.Fail("Any exception will be considered a failure: {0}",
					exception.Message);
			}
		}