NUnit.Framework.Assert.That(object, NUnit.Framework.Constraints.IResolveConstraint, string)

Here are the examples of the csharp api class NUnit.Framework.Assert.That(object, NUnit.Framework.Constraints.IResolveConstraint, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

2. Example

Project: ContinuousTests
Source File: CollectionAssert.cs
View license
public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
		{
            Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
		}

3. Example

Project: ContinuousTests
Source File: CollectionAssert.cs
View license
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) 
		{
			//AreEqual(expected, actual, null, message, null);
            Assert.That(actual, new EqualConstraint(expected), message);
		}

4. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

5. Example

Project: ContinuousTests
Source File: CollectionAssert.cs
View license
public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
		{
            Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
		}

6. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

7. Example

Project: ContinuousTests
Source File: CollectionAssert.cs
View license
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) 
		{
			//AreEqual(expected, actual, null, message, null);
            Assert.That(actual, new EqualConstraint(expected), message);
		}

8. Example

Project: ContinuousTests
Source File: CollectionAssert.cs
View license
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) 
		{
			//AreEqual(expected, actual, null, message, null);
            Assert.That(actual, new EqualConstraint(expected), message);
		}

9. Example

Project: ContinuousTests
Source File: CollectionAssert.cs
View license
public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
		{
            Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
		}

10. Example

Project: Cirqus
Source File: TestInMemorySnapshotCache.cs
View license
protected override void DoSetUp()
        {
            Assert.That(MethodInfo, Is.Not.Null, "Expected reflection to have found the test method RunHasCodeTestWith");
        }

11. Example

View license
[Test]
		public void MembershipFunctionCollection_Types_Success()
		{
			//Arrange
			var collection = new MembershipFunctionCollection();

			//Act
			var trap = collection.AddTrapezoid("trap", 0, 0, 20, 40);
			var tri = collection.AddTriangle("tri", 20, 40, 60);
			collection.AddRectangle("rect", 10, 50);
			collection.AddGaussian("gaus", 50, 20);
			collection.AddBell("bell", 10, 3, 50);
			collection.AddSShaped("sshaped", 50, 10);
			collection.AddZShaped("zshaped", 50, 10);
			collection.AddComposite("comp", trap, tri, 20);

			//Assert
			Assert.That(collection.Any(mf => mf is TrapezoidMembershipFunction), Is.True, "Trapezoid");
			Assert.That(collection.Any(mf => mf is TriangleMembershipFunction), Is.True, "Triangle");
			Assert.That(collection.Any(mf => mf is RectangleMembershipFunction), Is.True, "Rectangle");
			Assert.That(collection.Any(mf => mf is GaussianMembershipFunction), Is.True, "Gaussian");
			Assert.That(collection.Any(mf => mf is BellMembershipFunction), Is.True, "Bell");
			Assert.That(collection.Any(mf => mf is SShapedMembershipFunction), Is.True, "SShaped");
			Assert.That(collection.Any(mf => mf is ZShapedMembershipFunction), Is.True, "ZShaped");
			Assert.That(collection.Any(mf => mf is CompositeMembershipFunction), Is.True, "Composite");
		}

12. Example

View license
[Test]
		public async Task Test_FdbBlob_NotFound_Blob_Is_Empty()
		{
			using (var db = await OpenTestPartitionAsync())
			{
				var location = await GetCleanDirectory(db, "BlobsFromOuterSpace");

				// clear previous values
				await DeleteSubspace(db, location);

				var blob = new FdbBlob(location.Partition.ByKey("Empty"));

				long? size;

				using (var tr = db.BeginReadOnlyTransaction(this.Cancellation))
				{
					size = await blob.GetSizeAsync(tr);
					Assert.That(size, Is.Null, "Non existing blob should have no size");
				}

				size = await db.ReadAsync((tr) => blob.GetSizeAsync(tr), this.Cancellation);
				Assert.That(size, Is.Null, "Non existing blob should have no size");

			}
		}

13. Example

Project: GlobalPhone
Source File: SmokeTest.cs
View license
private void assert_can_handle_invalid(object @string, object territory_name)
        {
            Number number;
            Context.TryParse((string)@string, out number, (string)territory_name);
            Assert.That(number, Is.Null, "expected " + @string + " to fail to parse for territory " + territory_name);
            string normalized;
            Context.TryNormalize((string)@string, out normalized, (string)territory_name);
            Assert.That(normalized, Is.Null, "expected " + @string + " to fail to normalize for territory " + territory_name);
        }

14. Example

Project: IdSharp
Source File: ByteUtilsTest.cs
View license
[Test]
        public void Compare_TwoParameters_Nulls()
        {
            // first parameter null
            bool result = ByteUtils.Compare(null, new byte[0]);
            Assert.That(result, Is.False, "first parameter null (1)");
            result = ByteUtils.Compare(null, new byte[] { 0xFF });
            Assert.That(result, Is.False, "first parameter null (2)");

            // second parameter null
            result = ByteUtils.Compare(new byte[0], null);
            Assert.That(result, Is.False, "second parameter null (1)");
            result = ByteUtils.Compare(new byte[] { 0xFF }, null);
            Assert.That(result, Is.False, "second parameter null (2)");

            // both parameters null
            result = ByteUtils.Compare(null, null);
            Assert.That(result, Is.True, "both parameters null");
        }

15. Example

Project: IdSharp
Source File: ByteUtilsTest.cs
View license
[Test]
        public void Compare_ThreeParameters_Nulls()
        {
            // first parameter null
            bool result = ByteUtils.Compare(null, new byte[0], 0);
            Assert.That(result, Is.False, "first parameter null, second parameter byte[0]");
            result = ByteUtils.Compare(null, new byte[] { 0xFF }, 0);
            Assert.That(result, Is.False, "first parameter null, second paramter byte[1]");

            // second parameter null
            result = ByteUtils.Compare(new byte[0], null, 0);
            Assert.That(result, Is.False, "second parameter null, first parameter byte[0]");
            result = ByteUtils.Compare(new byte[] { 0xFF }, null, 0);
            Assert.That(result, Is.False, "second parameter null, first parameter byte[1]");

            // both parameters null
            result = ByteUtils.Compare(null, null, 10);
            Assert.That(result, Is.True, "both parameters null");
        }

16. Example

Project: IdSharp
Source File: ByteUtilsTest.cs
View license
[Test]
        public void Compare_ThreeParameters()
        {
            bool result;

           /n ..... /n //View Source file for more details /n }

17. Example

Project: AutomateThePlanet
Source File: NunitAssert.cs
View license
public void IsTrue(bool condition, string message)
        {
            NUF.Assert.That(condition, NUF.Is.True, message);
        }

18. Example

Project: AutomateThePlanet
Source File: NunitAssert.cs
View license
public void IsNotNull(object value, string message)
        {
            NUF.Assert.That(value, NUF.Is.Not.Null, message);
        }

19. Example

Project: AutomateThePlanet
Source File: NunitAssert.cs
View license
public void IsNull(object value, string message)
        {
            NUF.Assert.That(value, NUF.Is.Null, message);
        }

20. Example

Project: AutomateThePlanet
Source File: NunitAssert.cs
View license
public void IsFalse(bool condition, string message)
        {
            NUF.Assert.That(condition, NUF.Is.False, message);
        }

21. Example

Project: mathnet-iridium
Source File: BugRegression.cs
View license
[Test]
        public void IRID209_InterpolationWithThreeSamples()
        {
            double[] values = new double[] { 6.0, 12.0, 16.0 };
            double[] points = new double[] { 1.0, 2.0, 3.0 };

            IInterpolationMethod method2 = Interpolation.CreatePolynomial(points, values);
            double b = method2.Interpolate(2.5);
            Assert.That(b, Is.Not.NaN, "polynomial (neville)");

            IInterpolationMethod method = Interpolation.Create(points, values);
            double a = method.Interpolate(2.5);
            Assert.That(a, Is.Not.NaN, "rational pole-free");
        }

22. Example

View license
[Test]
		public void TestBuildCacheFromConfig()
		{
			ICache cache = DefaultProvider.BuildCache("foo", null);
			Assert.That(cache, Is.Not.Null, "pre-configured cache not found");
		}

23. Example

View license
[Test]
		public void TestBuildCacheFromConfig()
		{
			ICache cache = DefaultProvider.BuildCache("foo", null);
			Assert.That(cache, Is.Not.Null, "pre-configured cache not found");
		}

24. Example

Project: NSubstitute
Source File: WhenCalledDo.cs
View license
[Test]
        public void Execute_when_called_for_any_args()
        {
            var called = false;
            _something.WhenForAnyArgs(x => x.Echo(1)).Do(x => called = true);

            Assert.That(called, Is.False, "Called");
            _something.Echo(1234);
            Assert.That(called, Is.True, "Called");
        }

25. Example

Project: NSubstitute
Source File: CallbackCalling.cs
View license
[Test]
        public void Execute_when_called()
        {
            var called = false;
            _something.When(substitute => substitute.Echo(1)).Do(Callback.Always(info => called = true));

            Assert.That(called, Is.False, "Called");
            _something.Echo(1);
            Assert.That(called, Is.True, "Called");
        }

26. Example

Project: NSubstitute
Source File: CallbackCalling.cs
View license
[Test]
        public void Execute_when_called_for_any_args()
        {
            var called = false;
            _something.WhenForAnyArgs(x => x.Echo(1)).Do(Callback.Always(x => called = true));

            Assert.That(called, Is.False, "Called");
            _something.Echo(1234);
            Assert.That(called, Is.True, "Called");
        }

27. Example

Project: NSubstitute
Source File: WhenCalledDo.cs
View license
[Test]
        public void Execute_when_called()
        {
            var called = false;
            _something.When(substitute => substitute.Echo(1)).Do(info => called = true);

            Assert.That(called, Is.False, "Called");
            _something.Echo(1);
            Assert.That(called, Is.True, "Called");
        }

28. Example

View license
[Test]
        public void TestSuite_HasTestSuiteElement()
        {
            Assert.That(suiteNode, Is.Not.Null, "Missing test-suite element");
        }

29. Example

View license
[Test]
        public void Environment_HasEnvironmentElement()
        {
            Assert.That(envNode, Is.Not.Null, "Missing environment element");
        }

30. Example

View license
[Test]
        public void CultureInfo_HasCultureInfoElement()
        {
            Assert.That(cultureNode, Is.Not.Null, "Missing culture-info element");
        }

31. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

32. Example

Project: nunit
Source File: NUnit2XmlOutputWriterTests.cs
View license
[Test]
        public void Environment_HasEnvironmentElement()
        {
            Assert.That(envNode, Is.Not.Null, "Missing environment element");
        }

33. Example

Project: nunit
Source File: NUnit2XmlOutputWriterTests.cs
View license
[Test]
        public void TestSuite_HasTestSuiteElement()
        {
            Assert.That(suiteNode, Is.Not.Null, "Missing test-suite element");
        }

34. Example

Project: nunit
Source File: NUnit2XmlOutputWriterTests.cs
View license
[Test]
        public void CultureInfo_HasCultureInfoElement()
        {
            Assert.That(cultureNode, Is.Not.Null, "Missing culture-info element");
        }

35. Example

Project: nunit
Source File: ReusableConstraintTests.cs
View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

36. Example

View license
[Test]
        public void CultureInfo_HasCultureInfoElement()
        {
            Assert.That(_cultureNode, Is.Not.Null, "Missing culture-info element");
        }

37. Example

View license
[Test]
        public void Environment_HasEnvironmentElement()
        {
            Assert.That(_envNode, Is.Not.Null, "Missing environment element");
        }

38. Example

View license
protected void CompileMethod(string source, IMetadataImporter metadataImporter = null, INamer namer = null, IRuntimeLibrary runtimeLibrary = null, IErrorReporter errorReporter = null, string methodName = "M", bool addSkeleton = true, IEnumerable<IAssemblyReference> references = null) {
			Compile(new[] { addSkeleton ? "using System; class C { " + source + "}" : source }, metadataImporter: metadataImporter, namer: namer, runtimeLibrary: runtimeLibrary, errorReporter: errorReporter, methodCompiled: (m, res, mc) => {
				if (m.Name == methodName) {
					Method = m;
					MethodCompiler = mc;
					CompiledMethod = res;
				}
			}, references: references);

			Assert.That(Method, Is.Not.Null, "Method " + methodName + " was not compiled");
		}

39. Example

Project: ZedGraph
Source File: ValuesToolTipTests.cs
View license
[Test]
        public void Create_EnableCreatedToolTip_SetsToolTipActive()
        {
            var toolTip = new ToolTip { Active = false };
            ValuesToolTip sut = ValuesToolTip.Create(new Control(), toolTip);

            sut.Enable();

            Assert.That(toolTip.Active, Is.True, "The non-active tool tip was not set to active.");
        }

40. Example

Project: ZedGraph
Source File: ValuesToolTipTests.cs
View license
[Test]
        public void Create_DisableCreatedToolTip_SetsToolTipNotActive()
        {
            var toolTip = new ToolTip { Active = true };
            ValuesToolTip sut = ValuesToolTip.Create(new Control(), toolTip);

            sut.Disable();

            Assert.That(toolTip.Active, Is.False, "The active tool tip was still active.");
        }

41. Example

View license
[Test]
		[Category("SkipOnTeamCity")] //I don't know why this is blocked, probably we need a firewall opening
		[Platform(Exclude = "Linux", Reason = "YouTrackSharp is too Windows-centric")]
		[STAThread]
		public void CanSubmitProblemReportTestProject()
		{
			using (var dlg = new ProblemReporterDialogDouble())
			{
				dlg.ShowDialog();
				Assert.That(dlg.Success, Is.True, "Automatic submission of issue failed");
			}
		}

42. Example

Project: AutoTest.Net
Source File: CollectionAssert.cs
View license
public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
		{
            Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
		}

43. Example

Project: AutoTest.Net
Source File: CollectionAssert.cs
View license
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) 
		{
			//AreEqual(expected, actual, null, message, null);
            Assert.That(actual, new EqualConstraint(expected), message);
		}

44. Example

Project: AutoTest.Net
Source File: CollectionAssert.cs
View license
public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
		{
            Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
		}

45. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

46. Example

Project: AutoTest.Net
Source File: CollectionAssert.cs
View license
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) 
		{
			//AreEqual(expected, actual, null, message, null);
            Assert.That(actual, new EqualConstraint(expected), message);
		}

47. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }

48. Example

Project: AutoTest.Net
Source File: CollectionAssert.cs
View license
public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) 
		{
			//AreEqual(expected, actual, null, message, null);
            Assert.That(actual, new EqualConstraint(expected), message);
		}

49. Example

Project: AutoTest.Net
Source File: CollectionAssert.cs
View license
public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
		{
            Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
		}

50. Example

View license
[Test]
        public void CanCreateReusableConstraintByImplicitConversion()
        {
            ReusableConstraint c = Is.Not.Null;

            string s = "test";
            Assert.That(s, c, "Should pass first time");
            Assert.That(s, c, "Should pass second time");
            Assert.That(s, c, "Should pass third time");
        }