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

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

73 Examples 7

1. Example

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

2. Example

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

3. Example

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

4. Example

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

5. Example

Project: markdown-scanner
Source File: PropertyTests.cs
View license
[Test]
        public void PropertyTableEntryIsCorrectlyFormattedForPrimitiveType()
        {
            string description = "Inline property description";
            string propertyType = "Int32";
            string propertyName = "PrimitiveProperty";
            string expected = $"|{propertyName}|{propertyType}|{description}|";
            ComplexType ct = this.GetComplexType(this.schema, "Test");
            this.AddProperty(ct, propertyName, type: $"Edm.{propertyType}", inlineDescription: description);
            string markDown = this.documentationGenerator.GetMarkDownForType(this.entityFramework, ct);

            Assert.IsTrue(markDown.Contains(expected), "Generated markdown should contain '{0}' Actual:\n{1}", expected, markDown);
        }

6. Example

Project: EmailValidation
Source File: Test.cs
View license
[Test]
		public void TestValidationAttributeValidInternationalAddresses ()
		{
			var target = new InternationalEmailValidationTarget ();

			foreach (var email in ValidInternationalAddresses) {
				target.Email = email;

				Assert.IsTrue (AreAttributesValid (target), "Valid International Address {0}", email);
			}
		}

7. Example

Project: EmailValidation
Source File: Test.cs
View license
[Test]
		public void TestValidationAttributeValidAddresses ()
		{
			EmailValidationTarget target = new EmailValidationTarget ();

			foreach (var email in ValidAddresses) {
				target.Email = email;

				Assert.IsTrue (AreAttributesValid (target), "Valid Address {0}", email);
			}
		}

8. Example

Project: nant
Source File: FileSetTest.cs
View license
[Test]
        public void Test_NewestFile() {
            string file1 = this.CreateTempFile("testfile1.txt", "hellow");
            string file2 = this.CreateTempFile("testfile2.txt", "hellow");
            string file3 = this.CreateTempFile("testfile3.txt", "hellow");
            string file4 = this.CreateTempFile("testfile4.txt", "hellow");

            //file1 was created first, but we will set the time in the future.
            FileInfo f1 = new FileInfo(file1);
            f1.LastWriteTime = DateTime.Now.AddDays(2);

            FileSet fs = new FileSet();
            fs.Includes.Add(file1);
            fs.Includes.Add(file2);
            fs.Includes.Add(file3);
            fs.Includes.Add(file4);

            FileInfo newestfile = fs.MostRecentLastWriteTimeFile;

            Assert.IsTrue(f1.FullName == newestfile.FullName, "Most Recent File should be '{0}', but was '{1}'", f1.Name, newestfile.Name);
        }

9. Example

Project: markdown-scanner
Source File: PropertyTests.cs
View license
[Test]
        public void PropertyTableEntryIsCorrectlyFormattedForComplexType()
        {
            string propertyType = "propertyComplexType";
            ComplexType ct = this.GetComplexType(this.schema, "test");
            ComplexType ct2 = this.GetComplexType(this.schema, "propertyComplexType");
            string description = "Inline property description";
            string propertyName = "ComplexProperty";
            this.AddProperty(ct, propertyName, type: $"{this.schema.Namespace}.{propertyType}", inlineDescription: description);

            string expected = $"|{propertyName}|[{propertyType}]({propertyType}.md)|{description}|";

            string markDown = this.documentationGenerator.GetMarkDownForType(this.entityFramework, ct);

            Assert.IsTrue(markDown.Contains(expected), "Generated markdown should contain '{0}' Actual:\n{1}", expected, markDown);
        }

10. Example

Project: markdown-scanner
Source File: PropertyTests.cs
View license
[Test]
        public void PropertyTableEntryIsCorrectlyFormattedForPrimitiveTypeCollection()
        {
            string description = "Inline property description";
            string propertyType = "Boolean";
            string propertyName = "PrimitiveProperty";
            string expected = $"|{propertyName}|{propertyType} collection|{description}|";
            ComplexType ct = this.GetComplexType(this.schema, "Test");
            this.AddProperty(ct, propertyName, type: $"Collection(Edm.{propertyType})", inlineDescription: description);
            string markDown = this.documentationGenerator.GetMarkDownForType(this.entityFramework, ct);

            Assert.IsTrue(markDown.Contains(expected), "Generated markdown should contain '{0}' Actual:\n{1}", expected, markDown);
        }

11. Example

Project: markdown-scanner
Source File: PropertyTests.cs
View license
[Test]
        public void PropertyTableEntryIsCorrectlyFormattedForComplexTypeCollection()
        {
            string propertyType = "propertyComplexType";
            ComplexType ct = this.GetComplexType(this.schema, "test");
            ComplexType ct2 = this.GetComplexType(this.schema, "propertyComplexType");
            string description = "Inline property description";
            string propertyName = "ComplexProperty";
            this.AddProperty(ct, propertyName, type: $"Collection({this.schema.Namespace}.{propertyType})", inlineDescription: description);

            string expected = $"|{propertyName}|[{propertyType}]({propertyType}.md) collection|{description}|";

            string markDown = this.documentationGenerator.GetMarkDownForType(this.entityFramework, ct);

            Assert.IsTrue(markDown.Contains(expected), "Generated markdown should contain '{0}' Actual:\n{1}", expected, markDown);
        }

12. Example

View license
[Test]
        public void RelationshipTableEntryIsCorrectlyFormattedForEntityCollection()
        {
            EntityType entity = this.GetEntityType(this.schema, "TestEntity");
            EntityType target = this.GetEntityType(this.schema, "TargetEntity");
            string description = "Inline navigation property description";
            string propertyType = $"Collection({this.schema.Namespace}.{target.Name})";
            string propertyName = "EntityNavigationProperty";
            string expected = $"|{propertyName}|[{target.Name}]({target.Name}.md) collection|{description}|";
            ComplexType ct = this.GetComplexType(this.schema, "Test");
            this.AddNavigationProperty(entity, propertyName, propertyType, inlineDescription: description);
            string markDown = this.documentationGenerator.GetMarkDownForType(this.entityFramework, entity);

            Assert.IsTrue(markDown.Contains(expected), "Generated markdown should contain '{0}' Actual:\n{1}", expected, markDown);
        }

13. Example

View license
[Test]
        public void RelationshipTableEntryIsCorrectlyFormattedForEntity()
        {
            EntityType entity = this.GetEntityType(this.schema, "TestEntity");
            EntityType target = this.GetEntityType(this.schema, "TargetEntity");
            string description = "Inline navigation property description";
            string propertyType = $"{this.schema.Namespace}.{target.Name}";
            string propertyName = "EntityNavigationProperty";
            string expected = $"|{propertyName}|[{target.Name}]({target.Name}.md)|{description}|";
            ComplexType ct = this.GetComplexType(this.schema, "Test");
            this.AddNavigationProperty(entity, propertyName, propertyType, inlineDescription: description);
            string markDown = this.documentationGenerator.GetMarkDownForType(this.entityFramework, entity);

            Assert.IsTrue(markDown.Contains(expected), "Generated markdown should contain '{0}' Actual:\n{1}", expected, markDown);
        }

14. Example

Project: FieldWorks
Source File: FwRegistryHelperTests.cs
View license
private void AssertRegistrySubkeyPresent(RegistryKey key, string subKeyName)
		{
			Assert.IsTrue(key.SubKeyCount > 0, "Registry key {0} does not have any subkeys, can't find {1}", key.Name, subKeyName);
			Assert.IsTrue(RegistryHelper.KeyExists(key, subKeyName),
				"Registry subkey {0} was not found in {1}.", subKeyName, key.Name);
		}

15. Example

Project: ContinuousTests
Source File: CommandLineTests.cs
View license
[TestCase("domain")]
        [TestCase("trace")]
		public void EnumOptionsAreRecognized( string fieldName )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.IsTrue( field.FieldType.IsEnum, "Field {0} is not an enum", fieldName );
		}

16. Example

Project: nant
Source File: ClTaskTest.cs
View license
[Test]
        public void Test_BuildAll() {
            if (!CanCompileAndLink) {
                return;
            }

            CleanAllObjs();
            RunBuild(_test_build);
            for (int i = 0; i < _sourceCount; ++i) {
                Assert.IsTrue(File.Exists(_objPathName[i]), "Object file \"{0}\" not created.", _objPathName[i]);
            }
        }

17. Example

Project: AutoTest.Net
Source File: CommandLineTests.cs
View license
[TestCase("domain")]
        [TestCase("trace")]
		public void EnumOptionsAreRecognized( string fieldName )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.IsTrue( field.FieldType.IsEnum, "Field {0} is not an enum", fieldName );
		}

18. Example

Project: AutoTest.Net
Source File: CommandLineTests.cs
View license
private void TestEnumOption( string fieldName )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.IsTrue( field.FieldType.IsEnum, "Field {0} is not an enum", fieldName );
		}

19. Example

Project: AutoTest.Net
Source File: CommandLineTests.cs
View license
private void TestEnumOption( string fieldName )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.IsTrue( field.FieldType.IsEnum, "Field {0} is not an enum", fieldName );
		}

20. Example

Project: dropkick
Source File: Extensions.cs
View license
public static void ShouldContain<T>(this ICollection<T> collection, T item)
		{
			Guard.AgainstNull(collection, "Collection is null, cannot assert item membership.");
			Assert.IsTrue(collection.Contains(item), 
				"Collection of type '{0}' does not contain expected item '{1}'", 
				typeof(T).Name, 
				item == null ? "(null)" : item.ToString());
		}

21. Example

Project: duality
Source File: SerializerTest.cs
View license
private void TestSequential<T>(T writeObjA, T writeObjB, Type format, Func<T,T,bool> checkEqual = null)
		{
			if (checkEqual == null) checkEqual = (a, b) => object.Equals(a, b);

			T readObjA;
			T readObjB;

			using (MemoryStream stream = new MemoryStream())
			{
				long beginPos = stream.Position;
				// Write
				using (Serializer formatter = Serializer.Create(stream, format))
				{
					stream.Position = beginPos;
					formatter.WriteObject(writeObjA);
					formatter.WriteObject(writeObjB);

					stream.Position = beginPos;
					readObjA = (T)formatter.ReadObject();
					readObjB = (T)formatter.ReadObject();

					stream.Position = beginPos;
					formatter.WriteObject(writeObjA);
					formatter.WriteObject(writeObjB);
				}

				// Read
				stream.Position = beginPos;
				using (Serializer formatter = Serializer.Create(stream))
				{
					readObjA = (T)formatter.ReadObject();
					readObjB = (T)formatter.ReadObject();
				}
			}

			Assert.IsTrue(checkEqual(writeObjA, readObjA), "Failed sequential WriteRead of Type {0} with Value {1}", typeof(T), writeObjA);
			Assert.IsTrue(checkEqual(writeObjB, readObjB), "Failed sequential WriteRead of Type {0} with Value {1}", typeof(T), writeObjB);
		}

22. Example

Project: duality
Source File: SerializerTest.cs
View license
private void TestRandomAccess<T>(T writeObjA, T writeObjB, Type format, Func<T,T,bool> checkEqual = null)
		{
			if (checkEqual == null) checkEqual = (a, b) => object.Equals(a, b);

			T readObjA;
			T readObjB;

			using (MemoryStream stream = new MemoryStream())
			{
				long posB = 0;
				long posA = 0;
				// Write
				using (Serializer formatter = Serializer.Create(stream, format))
				{
					posB = stream.Position;
					formatter.WriteObject(writeObjB);
					posA = stream.Position;
					formatter.WriteObject(writeObjA);
					stream.Position = posB;
					formatter.WriteObject(writeObjB);

					stream.Position = posA;
					readObjA = (T)formatter.ReadObject();
					stream.Position = posB;
					readObjB = (T)formatter.ReadObject();

					stream.Position = posA;
					formatter.WriteObject(writeObjA);
					stream.Position = posB;
					formatter.WriteObject(writeObjB);
				}

				// Read
				using (Serializer formatter = Serializer.Create(stream, format))
				{
					stream.Position = posA;
					readObjA = (T)formatter.ReadObject();
					stream.Position = posB;
					readObjB = (T)formatter.ReadObject();
				}
			}

			Assert.IsTrue(checkEqual(writeObjA, readObjA), "Failed random access WriteRead of Type {0} with Value {1}", typeof(T), writeObjA);
			Assert.IsTrue(checkEqual(writeObjB, readObjB), "Failed random access WriteRead of Type {0} with Value {1}", typeof(T), writeObjB);
		}

23. Example

Project: ContinuousTests
Source File: CommandLineTests.cs
View license
private void TestEnumOption( string fieldName )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.IsTrue( field.FieldType.IsEnum, "Field {0} is not an enum", fieldName );
		}

24. Example

Project: helix-toolkit
Source File: ObjReaderTests.cs
View license
public static void AssertContains(this Vector3DCollection collection, params double[][] points) {
            Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length);
            foreach (var point in points)
                Assert.IsTrue(collection.Contains(new Vector3D(point[0],point[1],point[2])), "Expected collection to contain point [{0},{1},{2}]", point[0], point[1], point[2]);
        }

25. Example

Project: helix-toolkit
Source File: ObjReaderTests.cs
View license
public static void AssertContains(this PointCollection collection, params double[][] points) {
            Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length);
            foreach (var point in points)
                Assert.IsTrue(collection.Contains(new Point(point[0],point[1])), "Expected collection to contain point [{0},{1}]", point[0], point[1]);
        }

26. Example

Project: helix-toolkit
Source File: ObjReaderTests.cs
View license
public static void AssertHasVertices(this Model3D model, params double[][] vertices) 
        {
            var geometryModel = (GeometryModel3D) model;
            var geometry = (MeshGeometry3D) geometryModel.Geometry;
            Assert.AreEqual(vertices.Length, geometry.Positions.Count, "Expected to find {0} vertices in model", vertices.Length);
            foreach (var vertex in vertices)
                Assert.IsTrue(geometry.Positions.Contains(new Point3D(vertex[0], vertex[1], vertex[2])), "Expected geometry to contain vertex [{0},{1},{2}]", vertex[0],vertex[1],vertex[2]);
        }

27. Example

Project: NodaTime
Source File: LocalTimePatternTest.cs
View license
private static void AssertValidNodaPattern(CultureInfo culture, string pattern)
        {
            Assert.IsTrue(pattern.All(c => ExpectedCharacters.Contains(c)),
                "Culture {0} uses pattern '{1}' which contains unexpected characters",
                culture.Name, pattern);
            // Check that the pattern parses
            LocalTimePattern.Create(pattern, NodaFormatInfo.GetFormatInfo(culture));
        }

28. Example

Project: helix-toolkit
Source File: ObjReaderTests.cs
View license
public static void AssertContains(this Core.Vector3Collection collection, params double[][] points) 
        {
            Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length);
            foreach (var point in points)
                Assert.IsTrue(collection.Contains(point), "Expected collection to contain point [{0},{1},{2}]", point[0], point[1], point[2]);
        }

29. Example

Project: Tempest
Source File: CollectionAssert.cs
View license
public static void Contains (IEnumerable collection, object actual)
		{
			Assert.IsTrue (collection.Cast<object>().Contains (actual), "Collection did not contain {0}", actual);
		}

30. Example

Project: helix-toolkit
Source File: ObjReaderTests.cs
View license
public static void AssertContains(this Point3DCollection collection, params double[][] points) {
            Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length);
            foreach (var point in points)
                Assert.IsTrue(collection.Contains(new Point3D(point[0],point[1],point[2])), "Expected collection to contain point [{0},{1},{2}]", point[0], point[1], point[2]);
        }

31. Example

View license
[Test]
        public void ContainerMustHoldAnonymousFactoryInstance()
        {
            var mockFactory = new Mock<IFactory>();
            var container = new ServiceContainer();

            // Give it a random service interface type
            Type serviceType = typeof (IDisposable);

            // Manually add the factory instance
            container.AddFactory(serviceType, mockFactory.Object);
            Assert.IsTrue(container.Contains(serviceType),
                          "The container needs to have a factory for service type '{0}'", serviceType);
        }

32. Example

Project: helix-toolkit
Source File: ObjReaderTests.cs
View license
public static void AssertContains(this Core.Vector2Collection collection, params double[][] points) 
        {
            Assert.AreEqual(points.Length, collection.Count, "Expected to find {0} points in collection", points.Length);
            foreach (var point in points)
                Assert.IsTrue(collection.Contains(point), "Expected collection to contain point [{0},{1}]", point[0], point[1]);
        }

33. Example

Project: ContinuousTests
Source File: CommandLineTests.cs
View license
private void TestEnumOption( string fieldName )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.IsTrue( field.FieldType.IsEnum, "Field {0} is not an enum", fieldName );
		}

34. Example

Project: MimeKit
Source File: ParseUtilsTests.cs
View license
[Test]
		public void TestTryParseGoodDomains ()
		{
			var sentinels = new [] { (byte) ',' };

			for (int i = 0; i < GoodDomains.Length; i += 2) {
				var buffer = Encoding.UTF8.GetBytes (GoodDomains[i]);
				string domain;
				int index = 0;

				Assert.IsTrue (ParseUtils.TryParseDomain (buffer, ref index, buffer.Length, sentinels, false, out domain), "Should have parsed '{0}'.", GoodDomains[i]);
				Assert.AreEqual (GoodDomains[i + 1], domain, "Parsed domains did not match.");
			}
		}

35. Example

Project: MimeKit
Source File: HtmlEntityDecoderTests.cs
View license
static void TestDecodeNumericEntity (string text, string expected)
		{
			var decoder = new HtmlEntityDecoder ();

			for (int i = 0; i < text.Length; i++)
				Assert.IsTrue (decoder.Push (text[i]), "Failed to push char #{0} of \"{1}\".", i, text);

			Assert.AreEqual (expected, decoder.GetValue (), "Decoded entity did not match for \"{0}\".", text);
		}

36. Example

View license
public static void ShouldHaveSameElementsAs<T, V>(this IEnumerable<T> r1,
		                                                  IEnumerable<V> r2,
		                                                  Func<T, V, bool> comparer)
		{
			using (var enumerator1 = r1.GetEnumerator())
			using (var enumerator2 = r2.GetEnumerator())
			{
				while (true)
				{
					var enum1HasMoved = enumerator1.MoveNext();
					var enum2HasMoved = enumerator2.MoveNext();
					if (!enum1HasMoved && !enum2HasMoved)
						return;
					if (enum1HasMoved != enum2HasMoved)
						return;
					Assert.IsTrue(comparer(enumerator1.Current, enumerator2.Current),
					              "Two elements didnt match:\na:\n{0}\nb:\n{1}",
					              enumerator1.Current,
					              enumerator2.Current);
				}
			}
		}

37. Example

Project: pgina
Source File: RollingFileAppenderTest.cs
View license
private void VerifyFileConditions( string sBaseFileName, RollFileEntry[] fileEntries )
		{
			ArrayList alExisting = GetExistingFiles( sBaseFileName );
			if (null != fileEntries )
			{
				//					AssertEquals( "File count mismatch", alExisting.Count, fileEntries.Length );
				foreach( RollFileEntry rollFile in fileEntries )
				{
					string sFileName = rollFile.FileName;
					FileInfo file = new FileInfo(sFileName);

					if (rollFile.FileLength > 0 )
					{
						Assert.IsTrue(file.Exists, "filename {0} does not exist", sFileName );
						VerifyExistenceAndRemoveFromList( alExisting, sFileName, file, rollFile );
					}
					else
					{
						// If length is 0, file may not exist yet.  If file exists, make sure length
						// is zero.  If file doesn't exist, this is OK

						if (file.Exists )
						{
							VerifyExistenceAndRemoveFromList( alExisting, sFileName, file, rollFile );
						}
					}
				}
			}
			else
			{
				Assert.AreEqual(0, alExisting.Count);
			}

			// This check ensures no extra files matching the wildcard pattern exist.
			// We only want the files we expect, and no others
			Assert.AreEqual(0, alExisting.Count);
		}

38. Example

Project: pgina
Source File: RollingFileAppenderTest.cs
View license
private void VerifyExistenceAndRemoveFromList( ArrayList alExisting, string sFileName, FileInfo file, RollFileEntry entry )
		{
			Assert.IsTrue(alExisting.Contains( sFileName ), "filename {0} not found in test directory", sFileName);
			Assert.AreEqual(entry.FileLength, file.Length, "file length mismatch");
			// Remove this file from the list
			alExisting.Remove( sFileName );
		}

39. Example

Project: duality
Source File: SerializerTest.cs
View license
private void TestDataEqual<T>(string name, T writeObj, Type format, Func<T,T,bool> checkEqual = null)
		{
			if (checkEqual == null) checkEqual = (a, b) => object.Equals(a, b);

			T readObj = (T)this.ReadReferenceFile(name, format);
			Assert.IsTrue(checkEqual(writeObj, readObj), "Failed data equality check of Type {0} with Value {1}", typeof(T), writeObj);
		}

40. Example

Project: nant
Source File: CheckoutTaskTest.cs
View license
[Test]
        [Category("InetAccess")]
        public void TestCheckoutDate () {
            object[] args = { 
                 TestModule, TestCvsRoot, destination, "2003/08/16", "2003_08_16"};

            string checkoutPath = Path.Combine(destination, "2003_08_16");
            string checkFilePath = Path.Combine(checkoutPath, CheckFile);

            RunBuild(FormatBuildFile(_checkoutByDateProjectXML, 
                args), Level.Info);
            Assert.IsTrue(File.Exists(checkFilePath), "File \"{0}\" does not exist.", checkFilePath);
        }

41. Example

Project: NosDB
Source File: TestFragmentedFile.cs
View license
public void AssertThrows<TException>(ThreadStart proc) where TException : Exception
        {
            try
            {
                proc();
            }
            catch (Exception error)
            {
                Assert.IsTrue(error is TException, "Unexpected Exception type {0} thrown from {1}", error.GetType(), proc.Method);
                return;
            }

            Assert.Fail("Expected Exception of type {0} from {1}", typeof(TException), proc.Method);
        }

42. Example

Project: duality
Source File: SerializerTest.cs
View license
private void TestWriteRead<T>(T writeObj, Type format, Func<T,T,bool> checkEqual = null)
		{
			if (checkEqual == null) checkEqual = (a, b) => object.Equals(a, b);

			T readObj = this.WriteRead(writeObj, format);
			Assert.IsTrue(checkEqual(writeObj, readObj), "Failed single WriteRead of Type {0} with Value {1}", typeof(T), writeObj);
		}

43. Example

Project: nant
Source File: LinkTaskTest.cs
View license
[Test]
        public void Test_BuildSourceChanged() {
            if (!CanCompileAndLink) {
                Assert.Ignore ("Compiler, linker or header files are not available"
                    + " or do not match the expected version.");
            }

            Test_BuildAll();
            for (int i = 0; i < _sourceCount; ++i) {
                File.SetLastWriteTime(_objPathName[i], DateTime.Now);
                RunBuild(_test_build);
                FileInfo objFileInfo = new FileInfo(_objPathName[i]);
                FileInfo binFileInfo = new FileInfo(_binPathName);
                Assert.IsTrue(binFileInfo.LastWriteTime >= objFileInfo.LastWriteTime,
                    "{0} must be newer than {1}.", _binPathName, _objPathName[i]);
            }
        }

44. Example

Project: nant
Source File: SetEnvTaskTest.cs
View license
[Test]
        public void Test_NestedPathElement() {
            string expectedPath = string.Format(@"{0}{1}dir1{2}{0}{1}dir2",
                TempDirectory.FullName, Path.DirectorySeparatorChar, Path.PathSeparator);
            string _xml = @"
                    <project>
                        <setenv>
                            <variable name='test_path2'>
                                <path>
                                    <pathelement dir='dir1' />
                                    <pathelement dir='dir2' />
                                </path>
                            </variable>
                        </setenv>
                    </project>";
            RunBuild(_xml);
            Assert.IsTrue( Environment.GetEnvironmentVariable("test_path2") != null, 
                "Environment variable test_path2 should have been set" );
            Assert.IsTrue( Environment.GetEnvironmentVariable("test_path2") == expectedPath, 
                "Environment variable test_path2 should have been set to '{0}' actual value is {1}",
                    expectedPath, Environment.GetEnvironmentVariable("test_path2") );
        }

45. Example

Project: nant
Source File: ClTaskTest.cs
View license
[Test]
        public void Test_BuildSourceChanged() {
            if (!CanCompileAndLink) {
                Assert.Ignore ("Compiler, linker or header files are not available"
                    + " or do not match the expected version.");
                return;
            }

            Test_BuildAll();

            for (int i = 0; i < _sourceCount; ++i) {
                File.SetLastWriteTime(_sourcePathName[i], DateTime.Now);
                RunBuild(_test_build);
                FileInfo sourceFileInfo = new FileInfo(_sourcePathName[i]);
                FileInfo objFileInfo = new FileInfo(_objPathName[i]);
                Assert.IsTrue(objFileInfo.LastWriteTime >= sourceFileInfo.LastWriteTime,
                    "{0} must be newer than {1}.", _objPathName[i], _sourcePathName[i]);
            }
        }

46. Example

Project: Dnn.Platform
Source File: EnumerableAssert.cs
View license
public static void ElementsMatch<TExpected, TActual>(IEnumerable<TExpected> expected, IEnumerable<TActual> actual, Func<TExpected, TActual, bool> matcher, string message, params object[] args)
        {
            IEnumerator<TExpected> expectedEnumerator = expected.GetEnumerator();
            IEnumerator<TActual> actualEnumerator = actual.GetEnumerator();

            while (actualEnumerator.MoveNext())
            {
                Assert.IsTrue(expectedEnumerator.MoveNext());
                Assert.IsTrue(matcher(expectedEnumerator.Current, actualEnumerator.Current), message, args);
            }
        }

47. Example

Project: imt-wanke-client
Source File: MainLoopTests.cs
View license
[Test]
        public void RepeatedTask()
        {
            //Console.WriteLine("Starting");
            ManualResetEvent handle = new ManualResetEvent(false);
            loop.QueueTimeout(TimeSpan.FromMilliseconds(0), delegate {
                this.count++;
                if (count == 3)
                {
                    handle.Set();
                    return false;
                }

                return true;
            });
            Assert.IsTrue(handle.WaitOne(5000, true), "#1: Executed {0} times", count);
            Assert.AreEqual(3, count, "#2");
        }

48. Example

Project: nant
Source File: LinkTaskTest.cs
View license
[Test]
        public void Test_BuildAll() {
            if (!CanCompileAndLink) {
                Assert.Ignore ("Compiler, linker or header files are not available"
                    + " or do not match the expected version.");
            }

            CleanAllObjs();
            CleanAllBins();
            RunBuild(_test_build);
            Assert.IsTrue(File.Exists(_binPathName), "Binary file \"{0}\" not created.", _binPathName);
        }

49. Example

Project: MimeKit
Source File: ContentTypeTests.cs
View license
[Test]
		public void TestUnquotedBoundaryWithTrailingNewLineAndSpace ()
		{
			const string text = "multipart/mixed;\n boundary=--boundary_0_8ab0e518-760f-4a94-acc0-66f7cdea5c9f\n ";
			var options = ParserOptions.Default.Clone ();
			var buffer = Encoding.ASCII.GetBytes (text);
			ContentType type;

			options.ParameterComplianceMode = RfcComplianceMode.Strict;
			Assert.IsTrue (ContentType.TryParse (options, buffer, out type), "Failed to parse: {0}", text);
			Assert.AreEqual (type.MediaType, "multipart", "Media type does not match: {0}", text);
			Assert.AreEqual (type.MediaSubtype, "mixed", "Media subtype does not match: {0}", text);
			Assert.AreEqual ("--boundary_0_8ab0e518-760f-4a94-acc0-66f7cdea5c9f", type.Boundary, "The boundary parameter does not match: {0}", text);

			options.ParameterComplianceMode = RfcComplianceMode.Loose;
			Assert.IsTrue (ContentType.TryParse (options, buffer, out type), "Failed to parse: {0}", text);
			Assert.AreEqual (type.MediaType, "multipart", "Media type does not match: {0}", text);
			Assert.AreEqual (type.MediaSubtype, "mixed", "Media subtype does not match: {0}", text);
			Assert.AreEqual ("--boundary_0_8ab0e518-760f-4a94-acc0-66f7cdea5c9f", type.Boundary, "The boundary parameter does not match: {0}", text);
		}

50. Example

View license
private static void ValidateScan(IEnumerable<KeyValuePair<byte [], byte []>> scan, int keyCount, string pageStoreName)
        {
            int ix = 0;
            foreach (var keyValuePair in scan)
            {
                Assert.AreEqual((ulong) ix, BitConverter.ToUInt64(keyValuePair.Key, 0), "Unexpected key at index {0} in test store {1}", ix, pageStoreName);
                Assert.AreEqual(ix, BitConverter.ToInt32(keyValuePair.Value, 0), "Unexpected value at index {0} in test store {1}", ix, pageStoreName);
                ix++;
                Assert.IsTrue(ix <= keyCount, "Scan returned more entries than expected in test store {0}", pageStoreName);
            }
            Assert.AreEqual(keyCount, ix, "Scan returned unexpected number of entries in test store {0}",pageStoreName);
        }