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

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

5 Examples 7

1. Example

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

2. Example

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

3. Example

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

4. Example

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

5. Example

Project: libpalaso
Source File: CloneableTests.cs
View license
[Test]
		public void CloneCopiesAllNeededMembers()
		{
			T clonable = CreateNewCloneable();
			IEnumerable<FieldInfo> fieldInfos = GetAllFields(clonable);

			foreach (FieldInfo fieldInfo in fieldInfos)
			{
				string fieldName = fieldInfo.Name;
				if (fieldInfo.Name.Contains("<"))
				{
					var splitResult = fieldInfo.Name.Split(new[] { '<', '>' });
					fieldName = splitResult[1];
				}
				if (ExceptionList.Contains("|" + fieldName + "|"))
				{
					continue;
				}
				object defaultValue = null;
				try
				{
					defaultValue = DefaultValuesForTypes.Single(dv => dv.TypeOfValueToSet == fieldInfo.FieldType).ValueToSet;
				}
				catch (InvalidOperationException)
				{
					Assert.Fail("Unhandled field type - please update the test to handle type \"{0}\". The field that uses this type is \"{1}\".", fieldInfo.FieldType.Name, fieldName);
				}

				fieldInfo.SetValue(clonable, defaultValue);

				var theClone = Convert.ChangeType(clonable.Clone(), clonable.GetType());
				if (fieldInfo.GetValue(clonable).GetType() != typeof(string))  //strings are special in .net so we won't worry about checking them here.
				{
					Assert.AreNotSame(fieldInfo.GetValue(clonable), fieldInfo.GetValue(theClone),
									  "The field \"{0}\" refers to the same object, it was not copied.", fieldName);
				}
				Assert.AreEqual(defaultValue, fieldInfo.GetValue(theClone), "Field \"{0}\" not copied on Clone()", fieldName);
			}
		}