NUnit.Framework.Assert.AreNotEqual(object, object, string)

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

33 Examples 7

1. Example

Project: Portable.Xaml
Source File: XamlXmlReaderTest.cs
View license
[Test]
		public void SchemaContext ()
		{
			Assert.AreNotEqual (XamlLanguage.Type.SchemaContext, new XamlXmlReader (XmlReader.Create (new StringReader ("<root/>"))).SchemaContext, "#1");
		}

2. Example

Project: riak-dotnet-client
Source File: Extensions.cs
View license
public static void ShouldNotEqual<T>(this T actual, T expected, string message = null)
        {
            Assert.AreNotEqual(expected, actual, message);
        }

3. Example

Project: hbm-to-fnh
Source File: AssertExtensions.cs
View license
public static void ShouldNotBeEqualTo<T>(this T item, T expected, [NotNull] string errorMessage)
		{
			Assert.AreNotEqual(expected, item, errorMessage);
		}

4. Example

Project: DReAM
Source File: DreamMiscTest.cs
View license
[Test]
        public void ResourceUri() {
            Plug p = Plug.New("resource://test.mindtouch.dream/MindTouch.Dream.Test.Resources.resource-test.txt");
            string text = p.Get().ToText();
            Assert.AreNotEqual(string.Empty, text, "resource was empty");
        }

5. Example

Project: nhibernate-core
Source File: Fixture.cs
View license
[Test]
		public void Bug()
		{
			Table table1 = new Table("ATABLE");

			Column table1ITestManyA = new Column("itestmanyaid");
			Column table1ITestManyB = new Column("itestmanybid");
			string t1Fk = table1.UniqueColumnString(new object[] { table1ITestManyA }, "BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyA");
			string t2Fk = table1.UniqueColumnString(new object[] { table1ITestManyB }, "BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyB");
			Assert.AreNotEqual(t1Fk, t2Fk, "Different columns in differents tables create the same FK name.");
		}

6. Example

View license
[Test]
		public async Task SupportsEnlistingInDistributedAsync()
		{
			using (new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
			{
				ForceEscalationToDistributedTx.Escalate();

				Assert.AreNotEqual(
					Guid.Empty,
					System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier,
					"Transaction lacks a distributed identifier");

				using (var s = OpenSession())
				{
					await (s.SaveAsync(new Person()));
					// Ensure the connection is acquired (thus enlisted)
					Assert.DoesNotThrowAsync(() => s.FlushAsync(), "Failure enlisting a connection in a distributed transaction.");
				}
			}
		}

7. Example

Project: Portable.Xaml
Source File: XamlLanguageTest.cs
View license
[Test]
		public void Type_Type ()
		{
			var m = XamlLanguage.Type.GetMember ("Type");
			TestMemberCommon (m, "Type", typeof (Type), typeof (TypeExtension), true);
			Assert.AreNotEqual (XamlLanguage.Type, m.Type, "#1");
		}

8. Example

Project: MiniMessagePack
Source File: Test.cs
View license
[Test()]
		[TestCase( new object[] {},       new byte[]{ 0x90 }, "fixed array")]
		[TestCase( new object[] { 1 },    new byte[]{ 0x91, 0x01 }, "fixed array")]
		[TestCase( new object[] { 1, 2 }, new byte[]{ 0x92, 0x01, 0x02 }, "fixed array")]
		[TestCase( new object[] {},       new byte[]{ 0xdc, 0x00, 0x00 }, "array16")]
		[TestCase( new object[] { 1 },    new byte[]{ 0xdc, 0x00, 0x01, 0x01 }, "array16")]
		[TestCase( new object[] { 1, 2 }, new byte[]{ 0xdc, 0x00, 0x02, 0x01, 0x02 }, "array16")]
		[TestCase( new object[] {},       new byte[]{ 0xdd, 0x00, 0x00, 0x00, 0x00 }, "array32")]
		[TestCase( new object[] { 1 },    new byte[]{ 0xdd, 0x00, 0x00, 0x00, 0x01, 0x01 }, "array32")]
		[TestCase( new object[] { 1, 2 }, new byte[]{ 0xdd, 0x00, 0x00, 0x00, 0x02, 0x01, 0x02 }, "array32")]
		public void ArrayValues(object[] expected, byte[] data, string message)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Unpack (data) as List<object>;
			Assert.AreNotEqual (actual, null, message + ": type");
			Assert.AreEqual (expected.Length, actual.Count, message + ": count");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], message + "[" + i + "]");
			}
		}

9. Example

View license
[Test]
		public async Task SupportsPromotingToDistributedAsync()
		{
			using (new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
			{
				using (var s = OpenSession())
				{
					await (s.SaveAsync(new Person()));
					// Ensure the connection is acquired (thus enlisted)
					await (s.FlushAsync());
				}
				Assert.DoesNotThrow(() => ForceEscalationToDistributedTx.Escalate(),
					"Failure promoting the transaction to distributed while already having enlisted a connection.");
				Assert.AreNotEqual(
					Guid.Empty,
					System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier,
					"Transaction lacks a distributed identifier");
			}
		}

10. Example

View license
[Test]
		public void SupportsPromotingToDistributed()
		{
			using (new TransactionScope())
			{
				using (var s = OpenSession())
				{
					s.Save(new Person());
					// Ensure the connection is acquired (thus enlisted)
					s.Flush();
				}
				Assert.DoesNotThrow(() => ForceEscalationToDistributedTx.Escalate(),
					"Failure promoting the transaction to distributed while already having enlisted a connection.");
				Assert.AreNotEqual(
					Guid.Empty,
					System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier,
					"Transaction lacks a distributed identifier");
			}
		}

11. Example

View license
[Test]
		public void SupportsEnlistingInDistributed()
		{
			using (new TransactionScope())
			{
				ForceEscalationToDistributedTx.Escalate();

				Assert.AreNotEqual(
					Guid.Empty,
					System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier,
					"Transaction lacks a distributed identifier");

				using (var s = OpenSession())
				{
					s.Save(new Person());
					// Ensure the connection is acquired (thus enlisted)
					Assert.DoesNotThrow(s.Flush, "Failure enlisting a connection in a distributed transaction.");
				}
			}
		}

12. Example

View license
[Test]
    public void TestWrongAnalyzeLanguage ()
    {

      Dictionary<string,string> Texts = new Dictionary<string, string> ();

      Texts.Add( "zh-tw", "Der schnelle braune Fuchs springt über den faulen Hund." );
      Texts.Add( "zh-cn", "The quick brown fox jumps over the lazy dog." );
      Texts.Add( "en", "El zorro marrón rápido salta sobre el perro perezoso." );
      Texts.Add( "ja", "Le renard brun rapide saute sur le chien paresseux." );
      Texts.Add( "de", "La volpe marrone veloce salta sul cane pigro." );
      Texts.Add( "es", "????????????????????????????????????????" );
      Texts.Add( "fr", "A rápida raposa marrom salta sobre o cão preguiçoso." );
      Texts.Add( "it", "Den snabba brunräven hoppar över den lata hunden." );
      Texts.Add( "pt", "?????????????" );
      Texts.Add( "sv", "?????????????" );

      MacroscopeAnalyzeTextLanguage AnalyzeTextLanguage;

      foreach( string LanguageCode in Texts.Keys )
      {

        AnalyzeTextLanguage = new MacroscopeAnalyzeTextLanguage ();

        string ProbableLanguage = AnalyzeTextLanguage.AnalyzeLanguage( Text: Texts[ LanguageCode ] );

        Assert.AreNotEqual(
          LanguageCode,
          ProbableLanguage,
          string.Format(
            "Wrong language detected for: {0} :: {1} :: {2}",
            ProbableLanguage,
            LanguageCode,
            Texts[ LanguageCode ]
          )
        );

      }

    }

13. Example

Project: OpenGL.Net
Source File: BenchmarkPInvoke.cs
View license
private static void Initialize_GetDelegateForFunctionPointer()
		{
			IntPtr glFlushAddress = GetProcAddressGL.GetProcAddress("glFlush");
			Assert.AreNotEqual(IntPtr.Zero, glFlushAddress);

			Delegate delegatePtr = Marshal.GetDelegateForFunctionPointer(glFlushAddress, typeof(glFlushDelegate));
			Assert.AreNotEqual(null, delegatePtr, "Marshal.GetDelegateForFunctionPointer has failed");

			pglFlush = (glFlushDelegate)delegatePtr;
			pglFlushHandle = glFlushAddress;

			IntPtr glEnableAddress = GetProcAddressGL.GetProcAddress("glFlush");
			Assert.AreNotEqual(IntPtr.Zero, glFlushAddress);

			Delegate glEnableDelegate = Marshal.GetDelegateForFunctionPointer(glEnableAddress, typeof(glEnableDelegate));
			Assert.AreNotEqual(null, delegatePtr, "Marshal.GetDelegateForFunctionPointer has failed");

			pglEnable = (glEnableDelegate)glEnableDelegate;
			pglEnableHandle = glEnableAddress;
		}

14. Example

Project: gitextensions
Source File: ConfigFileTest.cs
View license
public void CheckIsNotEqual(ConfigFile configFile, string key, string expectedValue)
        {
            Assert.AreNotEqual(GetConfigValue(configFile.FileName, key), expectedValue, "git config --get");
            Assert.AreNotEqual(expectedValue, configFile.GetValue(key), "ConfigFile");
        }

15. Example

Project: Portable.Xaml
Source File: XamlTypeTest.cs
View license
[Test]
		public void EqualityAcrossConstructors ()
		{
			var t1 = new XamlType (typeof (int), sctx);
			var t2 = new XamlType (t1.PreferredXamlNamespace, t1.Name, null, sctx);
			// not sure if it always returns false for different .ctor comparisons...
			Assert.IsFalse (t1 == t2, "#3");
			
			Assert.AreNotEqual (XamlLanguage.Type, new XamlSchemaContext ().GetXamlType (typeof (Type)), "#4");
		}

16. Example

View license
public static void IsNot<T>(this T actual, T notExpected, string message = "")
        {
            if (typeof(T) != typeof(string) && typeof(IEnumerable).IsAssignableFrom(typeof(T)))
            {
                ((IEnumerable)actual).Cast<object>().IsNot(((IEnumerable)notExpected).Cast<object>(), message);
                return;
            }

            Assert.AreNotEqual(notExpected, actual, message);
        }

17. Example

View license
public static void IsNot<T>(this T actual, T notExpected, string message = "")
        {
            if (typeof(T) != typeof(string) && typeof(IEnumerable).IsAssignableFrom(typeof(T)))
            {
                ((IEnumerable)actual).Cast<object>().IsNot(((IEnumerable)notExpected).Cast<object>(), message);
                return;
            }

            Assert.AreNotEqual(notExpected, actual, message);
        }

18. Example

Project: yacq
Source File: ChainingAssertion.NUnit.cs
View license
public static void IsNot<T>(this T actual, T notExpected, string message = "")
        {
            if (typeof(T) != typeof(string) && typeof(IEnumerable).IsAssignableFrom(typeof(T)))
            {
                ((IEnumerable)actual).Cast<object>().IsNot(((IEnumerable)notExpected).Cast<object>(), message);
                return;
            }

            Assert.AreNotEqual(notExpected, actual, message);
        }

19. Example

Project: nhibernate-core
Source File: Fixture.cs
View license
[Test]
		public async Task When_using_DTC_HiLo_knows_to_create_isolated_DTC_transactionAsync()
		{
			if (!Dialect.SupportsConcurrentWritingConnections)
				Assert.Ignore(Dialect.GetType().Name + " does not support concurrent writing connections, can not isolate work.");

			object scalar1, scalar2;

			using (var session = Sfi.OpenSession())
			using (var command = session.Connection.CreateCommand())
			{
				command.CommandText = "select next_hi from hibernate_unique_key";
				scalar1 = await (command.ExecuteScalarAsync());
			}

			using (new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
			{
				var generator = Sfi.GetIdentifierGenerator(typeof(Person).FullName);
				Assert.That(generator, Is.InstanceOf<TableHiLoGenerator>());

				using (var session = OpenSession())
				{
					// Force connection acquisition for having it enlisted.
					Assert.That(session.Connection.State, Is.EqualTo(ConnectionState.Open));
					await (generator.GenerateAsync((ISessionImplementor)session, new Person(), CancellationToken.None));
				}

				// intentionally dispose without committing
			}

			using (var session = Sfi.OpenSession())
			using (var command = session.Connection.CreateCommand())
			{
				command.CommandText = "select next_hi from hibernate_unique_key";
				scalar2 = await (command.ExecuteScalarAsync());
			}

			Assert.AreNotEqual(scalar1, scalar2, "HiLo must run with in its own transaction");
		}

20. Example

Project: nhibernate-core
Source File: Fixture.cs
View license
[Test]
		public void When_using_DTC_HiLo_knows_to_create_isolated_DTC_transaction()
		{
			if (!Dialect.SupportsConcurrentWritingConnections)
				Assert.Ignore(Dialect.GetType().Name + " does not support concurrent writing connections, can not isolate work.");

			object scalar1, scalar2;

			using (var session = Sfi.OpenSession())
			using (var command = session.Connection.CreateCommand())
			{
				command.CommandText = "select next_hi from hibernate_unique_key";
				scalar1 = command.ExecuteScalar();
			}

			using (new TransactionScope())
			{
				var generator = Sfi.GetIdentifierGenerator(typeof(Person).FullName);
				Assert.That(generator, Is.InstanceOf<TableHiLoGenerator>());

				using (var session = OpenSession())
				{
					// Force connection acquisition for having it enlisted.
					Assert.That(session.Connection.State, Is.EqualTo(ConnectionState.Open));
					generator.Generate((ISessionImplementor)session, new Person());
				}

				// intentionally dispose without committing
			}

			using (var session = Sfi.OpenSession())
			using (var command = session.Connection.CreateCommand())
			{
				command.CommandText = "select next_hi from hibernate_unique_key";
				scalar2 = command.ExecuteScalar();
			}

			Assert.AreNotEqual(scalar1, scalar2, "HiLo must run with in its own transaction");
		}

21. Example

View license
[Test]
        public void DoesNotImplementFinalMethodThatDoesNotImplementInterface()
        {
            IProxyTypeBuilder builder = GetProxyBuilder();
            builder.TargetType = typeof(TargetObjectTest);
            Type proxy = builder.BuildProxyType();

            MethodInfo method = ReflectionUtils.GetMethod(proxy, "MethodWithArguments", new Type[] { typeof(string) });

            Assert.IsNotNull(method, "Should define this method.");
            Assert.AreNotEqual(proxy, method.DeclaringType, "Method can't be proxied.");

            // call base method
            object foo = Activator.CreateInstance(proxy);
            Assert.IsTrue(foo is TargetObjectTest);
            ((TargetObjectTest)foo).MethodWithArguments("code");
        }

22. Example

Project: Gorgon
Source File: TarTests.cs
View license
[Test]
        [Category("Tar")]
        public void CloningAndUniqueness()
		{
			// Partial test of cloning for TarHeader and TarEntry
			TarEntry e = TarEntry.CreateTarEntry("ohsogood");
			e.GroupId = 47;
			e.GroupName = "GroupName";
			e.ModTime = DateTime.Now;
			e.Size = 123234;

			TarHeader headerE = e.TarHeader;

			headerE.DevMajor = 99;
			headerE.DevMinor = 98;
			headerE.LinkName = "LanceLink";

			TarEntry d = (TarEntry)e.Clone();

			Assert.AreEqual(d.File, e.File);
			Assert.AreEqual(d.GroupId, e.GroupId);
			Assert.AreEqual(d.GroupName, e.GroupName);
			Assert.AreEqual(d.IsDirectory, e.IsDirectory);
			Assert.AreEqual(d.ModTime, e.ModTime);
			Assert.AreEqual(d.Size, e.Size);

			TarHeader headerD = d.TarHeader;

			Assert.AreEqual(headerE.Checksum, headerD.Checksum);
			Assert.AreEqual(headerE.LinkName, headerD.LinkName);

			Assert.AreEqual(99, headerD.DevMajor);
			Assert.AreEqual(98, headerD.DevMinor);

			Assert.AreEqual("LanceLink", headerD.LinkName);

			TarEntry entryf = new TarEntry(headerD);

			headerD.LinkName = "Something different";

			Assert.AreNotEqual(headerD.LinkName, entryf.TarHeader.LinkName, "Entry headers should be unique");
		}

23. Example

Project: ActivityManager
Source File: TarTests.cs
View license
[Test]
        [Category("Tar")]
        public void CloningAndUniqueness()
		{
			// Partial test of cloning for TarHeader and TarEntry
			TarEntry e = TarEntry.CreateTarEntry("ohsogood");
			e.GroupId = 47;
			e.GroupName = "GroupName";
			e.ModTime = DateTime.Now;
			e.Size = 123234;

			TarHeader headerE = e.TarHeader;

			headerE.DevMajor = 99;
			headerE.DevMinor = 98;
			headerE.LinkName = "LanceLink";

			TarEntry d = (TarEntry)e.Clone();

			Assert.AreEqual(d.File, e.File);
			Assert.AreEqual(d.GroupId, e.GroupId);
			Assert.AreEqual(d.GroupName, e.GroupName);
			Assert.AreEqual(d.IsDirectory, e.IsDirectory);
			Assert.AreEqual(d.ModTime, e.ModTime);
			Assert.AreEqual(d.Size, e.Size);

			TarHeader headerD = d.TarHeader;

			Assert.AreEqual(headerE.Checksum, headerD.Checksum);
			Assert.AreEqual(headerE.LinkName, headerD.LinkName);

			Assert.AreEqual(99, headerD.DevMajor);
			Assert.AreEqual(98, headerD.DevMinor);

			Assert.AreEqual("LanceLink", headerD.LinkName);

			TarEntry entryf = new TarEntry(headerD);

			headerD.LinkName = "Something different";

			Assert.AreNotEqual(headerD.LinkName, entryf.TarHeader.LinkName, "Entry headers should be unique");
		}

24. Example

Project: SharpZipLib
Source File: TarTests.cs
View license
[Test]
		[Category("Tar")]
		public void CloningAndUniqueness()
		{
			// Partial test of cloning for TarHeader and TarEntry
			TarEntry e = TarEntry.CreateTarEntry("ohsogood");
			e.GroupId = 47;
			e.GroupName = "GroupName";
			e.ModTime = DateTime.Now;
			e.Size = 123234;

			TarHeader headerE = e.TarHeader;

			headerE.DevMajor = 99;
			headerE.DevMinor = 98;
			headerE.LinkName = "LanceLink";

			var d = (TarEntry)e.Clone();

			Assert.AreEqual(d.File, e.File);
			Assert.AreEqual(d.GroupId, e.GroupId);
			Assert.AreEqual(d.GroupName, e.GroupName);
			Assert.AreEqual(d.IsDirectory, e.IsDirectory);
			Assert.AreEqual(d.ModTime, e.ModTime);
			Assert.AreEqual(d.Size, e.Size);

			TarHeader headerD = d.TarHeader;

			Assert.AreEqual(headerE.Checksum, headerD.Checksum);
			Assert.AreEqual(headerE.LinkName, headerD.LinkName);

			Assert.AreEqual(99, headerD.DevMajor);
			Assert.AreEqual(98, headerD.DevMinor);

			Assert.AreEqual("LanceLink", headerD.LinkName);

			var entryf = new TarEntry(headerD);

			headerD.LinkName = "Something different";

			Assert.AreNotEqual(headerD.LinkName, entryf.TarHeader.LinkName, "Entry headers should be unique");
		}

25. Example

View license
[Test]
        public void LocalSessionFactoryObjectWithDbProviderAndProperties()
        {
        /n ..... /n //View Source file for more details /n }

26. Example

View license
[Test]
		public void GenerateFilePath()
		{
			List<DictionaryConfigurationModel> conflictingConfigs;
			var configToRename = GenerateFilePath_Helper(out conflictingConfigs);

			// SUT
			DictionaryConfigurationManagerController.GenerateFilePath(_controller._projectConfigDir, _controller._configurations, configToRename);

			var newFilePath = configToRename.FilePath;
			StringAssert.StartsWith(_projectConfigPath, newFilePath);
			StringAssert.EndsWith(DictionaryConfigurationModel.FileExtension, newFilePath);
			Assert.AreEqual(DictionaryConfigurationManagerController.FormatFilePath(_controller._projectConfigDir, "configuration3_3"), configToRename.FilePath, "The file path should be based on the label");
			foreach (var config in conflictingConfigs)
			{
				Assert.AreNotEqual(Path.GetFileName(newFilePath), Path.GetFileName(config.FilePath), "File name should be unique");
			}
		}

27. Example

Project: FieldWorks
Source File: FwDataFixerTest.cs
View license
[Test]
		public void DuplicateNameCustomLists_OneIsRenamed()
		{
			var testPath = Path.Combine(base/n ..... /n //View Source file for more details /n }

28. Example

Project: Portable.Xaml
Source File: XamlMemberTest.cs
View license
[Test]
		public void EqualsTest ()
		{
			XamlMember m;
			var xt = XamlLanguage.Type;
			m = new XamlMember ("Type", xt, false);
			var type_type = xt.GetMember ("Type");
			Assert.AreNotEqual (m, xt.GetMember ("Type"), "#1"); // whoa!
			Assert.AreNotEqual (type_type, m, "#2"); // whoa!
			Assert.AreEqual (type_type, xt.GetMember ("Type"), "#3");
			Assert.AreEqual (type_type.ToString (), m.ToString (), "#4");

			Assert.AreEqual (xt.GetAllMembers ().FirstOrDefault (mm => mm.Name == "Type"), xt.GetAllMembers ().FirstOrDefault (mm => mm.Name == "Type"), "#5");
			Assert.AreEqual (xt.GetAllMembers ().FirstOrDefault (mm => mm.Name == "Type"), xt.GetMember ("Type"), "#6");

			// different XamlSchemaContext
			Assert.AreNotEqual (m, XamlLanguage.Type.GetMember ("Type"), "#7");
			Assert.AreNotEqual (XamlLanguage.Type.GetMember ("Type"), new XamlSchemaContext ().GetXamlType (typeof (Type)).GetMember ("Type"), "#7");
			Assert.AreEqual (XamlLanguage.Type.GetMember ("Type"), new XamlSchemaContext ().GetXamlType (typeof (TypeExtension)).GetMember ("Type"), "#8");
		}

29. Example

Project: FieldWorks
Source File: FwDataFixerTest.cs
View license
[Test]
		public void TestDanglingTextTagAndChartReferences()
		{
			var testPath = Path.Combine(base/n ..... /n //View Source file for more details /n }

30. Example

Project: msbuildtasks
Source File: XmlMassUpdateTests.cs
View license
[Test]
        public void UpdateKeyedElementsWithoutCopyingUpdateControlNamespaceDeclaration()
        {
            setupTask();
            task.ContentFile = new TaskItem("test.xml");
            task.ContentXml = contentXmlWithMultipleItems; 
            task.SubstitutionsFile = new TaskItem("test2.xml");
            task.SubstitutionsXml = substitutionsXmlWithUpdateControlNamespace;
            string originalB = getInitialValue("/configuration/appSettings/add[@key='B']/@value");

            bool executeSucceeded = task.Execute();
            Assert.IsTrue(executeSucceeded, "Task should have succeeded.");

            // Make sure update succeeded
            Assert.AreNotEqual("40", originalB, "Make sure the original value is different from the value it will be set to.");
            assertXml("40", "/configuration/appSettings/add[@key='B']/@value", "B should have changed");
            // Make sure namespace declaration was not copied

            XmlNode configurationNode = task.MergedXmlDocument.SelectSingleNode("/configuration");
            Assert.IsNotNull(configurationNode, "The configuration node should exist.");
            Assert.AreEqual(0, configurationNode.Attributes.Count, "The configuration node should not have any attributes.");
        }

31. Example

Project: gitextensions
Source File: ConfigFileTest.cs
View license
[TestMethod]
        public void CaseSensitive()
        {

            // create test data
        /n ..... /n //View Source file for more details /n }

32. Example

Project: Portable.Xaml
Source File: XamlReaderTestBase.cs
View license
protected void Read_Reference (XamlReader r)
		{
			Assert.IsTrue (r.Read (), "#11");
			Assert.AreE/n ..... /n //View Source file for more details /n }

33. Example

Project: msbuildtasks
Source File: ILMergeTest.cs
View license
private void AssertResults(ILMerge task, int publicTypeCount, string version)
		{
			MessageImportance imp = MessageImportance.Low;

			Assert.IsTrue(File.Exists(task.OutputFile.ItemSpec), @"No merged assembly");
			string pdbFile = Path.ChangeExtension(task.OutputFile.ItemSpec, "pdb");
			Assert.AreEqual(task.DebugInfo, File.Exists(pdbFile), @"No debug file");
			string xmlFile = Path.ChangeExtension(task.OutputFile.ItemSpec, @"xml");
			Assert.AreEqual(task.XmlDocumentation, File.Exists(xmlFile), @"No xml documentation file");

			Assembly merge = Assembly.LoadFile(task.OutputFile.ItemSpec);
			task.Log.LogMessage(imp, "Merged assembly: {0}", merge.FullName);

			Type[] types = merge.GetExportedTypes();
			foreach (Type type in types)
			{
				task.Log.LogMessage(imp, "Type: {0}", type.Name);
				task.Log.LogMessage(imp, " Attributes: {0}", type.Attributes.ToString());
			}

			Assert.AreEqual(publicTypeCount, types.Length, @"Wrong number of public types");

			AssemblyName assName = new AssemblyName(merge.FullName);
			task.Log.LogMessage(imp, "Version: {0}", assName.Version.ToString());
			Assert.AreEqual(version, assName.Version.ToString(), @"Wrong version");

			byte[] publicKeyToken = assName.GetPublicKeyToken();
			if (task.KeyFile == null)
			{
				Assert.AreEqual(0, publicKeyToken.Length, @"Merged assembly expected to be unsigned");
			}
			else
			{
				Assert.AreNotEqual(0, publicKeyToken, @"Merged assembly expected to be signed");
			}
		}