NUnit.Framework.Assert.That(bool)

Here are the examples of the csharp api class NUnit.Framework.Assert.That(bool) 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, Sequential]
        public void TwoArguments_Sequential(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
        }

2. Example

View license
[Test, Combinatorial]
        public void TwoArguments_Combinatorial(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
        }

3. Example

Project: ContinuousTests
Source File: ValueSourceTests.cs
View license
[Test]
        public void ValueSourceIsInvokedWithCorrectCurrentDirectory(
            [ValueSource("CheckCurrentDirectory")] bool isOK)
        {
            Assert.That(isOK);
        }

4. Example

Project: ContinuousTests
Source File: ValueSourceTests.cs
View license
[Test]
        public void ValueSourceIsInvokedWithCorrectCurrentDirectory(
            [ValueSource("CheckCurrentDirectory")] bool isOK)
        {
            Assert.That(isOK);
        }

5. Example

View license
[Test]
        public void SingleArgument(
            [Values(1.3, 1.7, 1.5)] double x)
        {
            Assert.That(x > 1.0 && x < 2.0);
        }

6. Example

View license
[Test]
        public void ConstructWithoutArguments()
        {
            TestFixtureAttribute attr = new TestFixtureAttribute();
            Assert.That(attr.Arguments.Length == 0);
#if NET_2_0
            Assert.That(attr.TypeArgs.Length == 0);
#endif
        }

7. Example

View license
[Test]
        public void closed_generic_parameter_translates_to_generic_argument_on_static()
        {
            var method = assembly.GetMethodDefinition<ParameterTestMethods>("ClosedStaticGenericCall");
            var result = TypeScanner.ScanMethod(method);
            var type = result.MemberAccesses[0].ActualMethodDefinition.Parameters[0].GetTypeWithGenericResolve();
            Assert.That(type.FullName == "System.Int32");
        }

8. Example

Project: ContinuousTests
Source File: NUnitTestFixture.cs
View license
[Test]
        public void test_with_passing_assert()
        {
            Assert.That(1 == 1);
        }

9. Example

View license
[Test, TestCaseSource("CheckCurrentDirectory")]
        public void SourceIsInvokedWithCorrectCurrentDirectory(bool isOK)
        {
            Assert.That(isOK);
        }

10. Example

View license
[Test, Sequential]
        public void ThreeArguments_Sequential(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y,
            [Values("Charlie", "Joe", "Frank")] string name)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
            Assert.That(name.Length >= 2);
        }

11. Example

View license
[Test]
        public void generic_argument_and_generic_parameter_on_static()
        {
            var method = assembly.GetMethodDefinition<ParameterTestMethods>("ClosedStaticWithGenericParameter");
            var result = TypeScanner.ScanMethod(method);
            var testReference = (GenericInstanceMethod) result.MemberAccesses[0].ActualMethodDefinition;
            var type = testReference.Parameters[0].GetTypeWithGenericResolve( testReference);
            Assert.That(type.FullName == "System.String");
            type = testReference.Parameters[1].GetTypeWithGenericResolve(testReference);
            Assert.That(type.FullName == "System.Int32");
        }

12. Example

View license
[Test]
        public void non_generic_parameter_translates_to_itself()
        {
            var method = assembly.GetMethodDefinition<ParameterTestMethods>("NonGenericCall");
            var result = TypeScanner.ScanMethod(method);
            var type = result.MemberAccesses[0].ActualMethodDefinition.Parameters[0].GetTypeWithGenericResolve();
            Assert.That(type == result.MemberAccesses[0].ActualMethodDefinition.Parameters[0].ParameterType);
        }

13. Example

View license
[Test, Explicit("Run this test manually with PrincipalPolicy set to WindowsPrincipal in the advanced loader settings")]
        public void CanSetPrincipalPolicy()
        {
            Assert.That(Thread.CurrentPrincipal is WindowsPrincipal);
        }

14. Example

View license
[Test]
        public void SingleArgument(
            [Values(1.3, 1.7, 1.5)] double x)
        {
            Assert.That(x > 1.0 && x < 2.0);
        }

15. Example

View license
[Test]
        public void ConstructWithoutArguments()
        {
            TestFixtureAttribute attr = new TestFixtureAttribute();
            Assert.That(attr.Arguments.Length == 0);
#if CLR_2_0 || CLR_4_0
            Assert.That(attr.TypeArgs.Length == 0);
#endif
        }

16. Example

View license
[Test, Combinatorial]
        public void ThreeArguments_Combinatorial(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y,
            [Values("Charlie", "Joe", "Frank")] string name)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
            Assert.That(name.Length >= 2);
        }

17. Example

View license
[Test]
        public void ConstructWithoutArguments()
        {
            TestFixtureAttribute attr = new TestFixtureAttribute();
            Assert.That(attr.Arguments.Length == 0);
#if NET_2_0
            Assert.That(attr.TypeArgs.Length == 0);
#endif
        }

18. Example

View license
[Test, Sequential]
        public void TwoArguments_Sequential(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
        }

19. Example

View license
[Test]
        public void CanAccessValueSource(
            [ValueSource("intvals")] int x)
        {
            Assert.That(answer % x == 0);
        }

20. Example

View license
[Test]
        public void CanAccessValueSource(
            [ValueSource("intvals")] int x)
        {
            Assert.That(answer % x == 0);
        }

21. Example

View license
[Test, TestCaseSource("CheckCurrentDirectory")]
        public void SourceIsInvokedWithCorrectCurrentDirectory(bool isOK)
        {
            Assert.That(isOK);
        }

22. Example

View license
[Test, TestCaseSource("CheckCurrentDirectory")]
        public void SourceIsInvokedWithCorrectCurrentDirectory(bool isOK)
        {
            Assert.That(isOK);
        }

23. Example

View license
[Test]
        public void SingleArgument(
            [Values(1.3, 1.7, 1.5)] double x)
        {
            Assert.That(x > 1.0 && x < 2.0);
        }

24. Example

Project: ContinuousTests
Source File: ValueSourceTests.cs
View license
[Test]
        public void ValueSourceIsInvokedWithCorrectCurrentDirectory(
            [ValueSource("CheckCurrentDirectory")] bool isOK)
        {
            Assert.That(isOK);
        }

25. Example

View license
[Test]
        public void generic_parameter_on_static_method_can_be_translated()
        {
            var method = assembly.GetMethodDefinition<ParameterTestMethods>("StaticWithGenericParameter");
            var result = TypeScanner.ScanMethod(method);
            var testReference = (GenericInstanceMethod)result.MemberAccesses[0].ActualMethodDefinition;
            var type = testReference.Parameters[0].GetTypeWithGenericResolve(testReference);
            Assert.That(type.FullName == "System.String");               
        }

26. Example

View license
[Test, Combinatorial]
        public void ThreeArguments_Combinatorial(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y,
            [Values("Charlie", "Joe", "Frank")] string name)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
            Assert.That(name.Length >= 2);
        }

27. Example

View license
[Test, Sequential]
        public void ThreeArguments_Sequential(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y,
            [Values("Charlie", "Joe", "Frank")] string name)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
            Assert.That(name.Length >= 2);
        }

28. Example

Project: ContinuousTests
Source File: NUnitTestFixture.cs
View license
[Test]
        public void test_with_failing_assert()
        {
            Assert.That(1 == 0);
        }

29. Example

View license
[Test, Combinatorial]
        public void TwoArguments_Combinatorial(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
        }

30. Example

View license
[Test, Sequential]
        public void ThreeArguments_Sequential(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y,
            [Values("Charlie", "Joe", "Frank")] string name)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
            Assert.That(name.Length >= 2);
        }

31. Example

View license
[Test]
        public void CanAccessValueSource(
            [ValueSource("intvals")] int x)
        {
            Assert.That(answer % x == 0);
        }

32. Example

View license
[Test, Combinatorial]
        public void ThreeArguments_Combinatorial(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y,
            [Values("Charlie", "Joe", "Frank")] string name)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
            Assert.That(name.Length >= 2);
        }

33. Example

View license
[Test, Combinatorial]
        public void TwoArguments_Combinatorial(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
        }

34. Example

View license
[Test, Sequential]
        public void TwoArguments_Sequential(
            [Values(1, 2, 3)] int x,
            [Values(10, 20)] int y)
        {
            Assert.That(x > 0 && x < 4 && y % 10 == 0);
        }

35. Example

View license
[Test]
        public void TestCreateRootShouldCreateBooleanFilterTreeRoot()
        {
            var column = new ColumnBuilder().WithDataType(typeof(Boolean)).Build();
            var result = _factory.CreateRoot(column);
            Assert.That(result is BooleanFilterTreeRoot);
        }

36. Example

View license
[Test]
        public void TestCreateRootShouldCreateIntegerFilterTreeRoot()
        {
            var column = new ColumnBuilder()
                .WithDataType(typeof(Int32))
                .WithValue(0)
                .Build();
            var result = _factory.CreateRoot(column);
            Assert.That(result is IntegerFilterTreeRoot);
        }

37. Example

View license
[Test]
        public void TestCreateChildrenShouldCreateNullLeafIfColumnHasNulls()
        {
            var column = new ColumnBuilder()
                .WithValue(DateTime.MinValue)
                .WithValue(DateTime.MinValue)
                .WithNulls()
                .Build();
            var root = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateChildren();
            Assert.That(result.Single() is NullFilterTreeLeaf);
        }

38. Example

View license
[Test]
        public void TestCreateRootShouldCreateStringFilterTreeRoot()
        {
            var column = new ColumnBuilder().WithDataType(typeof(String)).Build();
            var result = _factory.CreateRoot(column);
            Assert.That(result is StringFilterTreeRoot);
        }

39. Example

View license
[Test]
        public void TestCreateFilterShouldCreateStringFilterIfColumnDoesNotHasNulls()
        {
            var column = new ColumnBuilder()
                .WithValue("test")
                .Build();
            var root = new StringFilterTreeRoot(string.Empty, column);
            var result = root.CreateFilter();
            Assert.That(result is StringFilter);
        }

40. Example

View license
[Test]
        public void TestCreateRootShouldCreateFloatFilterTreeRoot()
        {
            var column = new ColumnBuilder()
                .WithDataType(typeof(Double))
                .WithValue(double.MinValue)
                .Build();
            var result = _factory.CreateRoot(column);
            Assert.That(result is FloatFilterTreeRoot);
        }

41. Example

View license
[Test]
        public void TestCreateFilterShouldCreateDateTimeFilterIfColumnDoesNotHasNulls()
        {
            var column = new ColumnBuilder()
                .WithValue(DateTime.MinValue)
                .WithValue(DateTime.MaxValue)
                .Build();
            var root = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateFilter();
            Assert.That(result is DateTimeFilter);
        }

42. Example

View license
[Test]
        public void TestCreateRootShouldCreateImageFilterTreeRoot()
        {
            var column = new ColumnBuilder()
                .WithDataType(typeof(BitmapImage))
                .Build();
            var result = _factory.CreateRoot(column);
            Assert.That(result is ImageFilterTreeRoot);
        }

43. Example

View license
[Test]
        public void TestCreateRootShouldCreateDateTimeFilterTreeRoot()
        {
            var column = new ColumnBuilder()
                .WithDataType(typeof(DateTime))
                .WithValue(DateTime.MinValue)
                .Build();
            var result = _factory.CreateRoot(column);
            Assert.That(result is DateTimeFilterTreeRoot);
        }

44. Example

Project: DotSpatial
Source File: RasterToPolygonTests.cs
View license
[Test]
        [TestCase(@"Data\DEM_w.tif")]
        [TestCase(@"Data\DanSite1w.tif")]
        [TestCase(@"Data\DanSite2w.tif")]
        [TestCase(@"Data\c1w.tif")]
        public void CanCreateMultiPartPolygons(string file)
        {
            var target = new RasterToPolygon();
            var p = new GdalRasterProvider();
            var raster = p.Open(file);
            var outShape = new PolygonShapefile { Filename = FileTools.GetTempFileName(".shp") };
            target.Execute(raster, outShape, new MockProgressHandler());
            FileTools.DeleteShapeFile(outShape.Filename);

            var mpCount = outShape.Features.Count(t => t.Geometry is MultiPolygon);
            Assert.That(mpCount > 0);
        }

45. Example

Project: DotSpatial
Source File: RasterToPolygonTests.cs
View license
[Test]
        [TestCase(@"Data\DEM_w.tif", @"Data\DEM_p.tif")]
        [TestCase(@"Data\c1w.tif", @"Data\c1p.tif")]
        public void NoMultiPartPolygonsWithConnectionGrid(string rasterFile, string flowDirectionGridFile)
        {
            var p = new GdalRasterProvider();
            var raster = p.Open(rasterFile);
            var flowDirectionGrid = p.Open(flowDirectionGridFile);

            var target = new RasterToPolygon();
            var outShape = new PolygonShapefile { Filename = FileTools.GetTempFileName(".shp") };
            target.Execute(raster, flowDirectionGrid, outShape, new MockProgressHandler());
            FileTools.DeleteShapeFile(outShape.Filename);

            var mpCount = outShape.Features.Count(t => t.Geometry is MultiPolygon);
            Assert.That(mpCount == 0);
        }

46. Example

Project: mulder
Source File: DictionaryExtensionsTests.cs
View license
[Test]
			public void should_be_able_handle_a_collection_as_a_value()
			{
				var dictionary = new Dictionary<string, object> {
					{
						"item_one", 
						new List<string> { "one", "two", "three" }
					}
				};

				dynamic expando = dictionary.ToExpando();
				Assert.That(expando.item_one.Contains("one"));
				Assert.That(expando.item_one.Contains("two"));
				Assert.That(expando.item_one.Contains("three"));
			}

47. Example

Project: mulder
Source File: DictionaryExtensionsTests.cs
View license
[Test]
			public void should_contain_dictionary_items_and_values()
			{
				var dictionary = new Dictionary<string, object> {
					{ "item_one", 1 },
					{ "item_two", "two" }
				};

				dynamic expando = dictionary.ToExpando();
				Assert.That(expando.item_one == 1);
				Assert.That(expando.item_two == "two");
			}

48. Example

Project: mulder
Source File: DictionaryExtensionsTests.cs
View license
[Test]
			public void should_be_able_to_handle_a_dictionary_as_a_value()
			{
				var dictionary = new Dictionary<string, object> {
					{ "item_one", 1 },
					{ "item_two", "two" },
					{
						"item_three", 
						new Dictionary<string, object> {
							{ "item_one", 1 },
							{ "item_two", "two" }
						}
					}
				};

				dynamic expando = dictionary.ToExpando();
				Assert.That(expando.item_one == 1);
				Assert.That(expando.item_two == "two");
				Assert.That(expando.item_three.item_one == 1);
				Assert.That(expando.item_three.item_two == "two");
			}

49. Example

View license
[Test]
        public void TestGetSupportedRegions()
        {
            Assert.That(phoneUtil.GetSupportedRegions().Count > 0);
        }

50. Example

View license
[Test]
        public void MustInitializeConsoleWithConnectionArgument()
        {
            new MigratorConsole("/db", Database);
            Assert.That(Environment.ExitCode == 1);
        }