string string1 = "Hello"; string string2 = "Hello"; Assert.AreNotSame(string1, string2);
Person person1 = new Person("John", 25); Person person2 = person1; Assert.AreNotSame(person1, person2);In this example, two objects of the class "Person" are created. The object "person2" is assigned the same value as "person1". Since the two objects reference the same memory location, the Assert.AreNotSame will fail. The Assert.AreNotSame method belongs to the NUnit package library, which is used for unit testing in .NET applications.