public void TestEquality2() { ManagedObjectName name1 = new ManagedObjectName("domain.net:name=SomeService,type=aware"); ManagedObjectName name2 = new ManagedObjectName("domain.net:name=SomeService,type=aware"); Assert( name1.GetHashCode() == name2.GetHashCode() ); Assert( name1.Equals( name2 ) ); ManagedObjectName name3 = new ManagedObjectName("domain.net:name=SomeService,type=unaware"); Assert( name1.GetHashCode() != name3.GetHashCode() ); Assert( !name1.Equals( name3 ) ); }
public void TestEquality1() { ManagedObjectName name1 = new ManagedObjectName("domain.net"); ManagedObjectName name2 = new ManagedObjectName("domain.net"); Assert( name1.GetHashCode() == name2.GetHashCode() ); Assert( name1.Equals( name2 ) ); ManagedObjectName name3 = new ManagedObjectName("domain.org"); Assert( name1.GetHashCode() != name3.GetHashCode() ); Assert( !name1.Equals( name3 ) ); }
public void TestSerialization() { MemoryStream stream = new MemoryStream(); ManagedObjectName name1 = new ManagedObjectName("domain.net:name=SomeService,type=aware"); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, name1); stream.Position = 0; ManagedObjectName name2 = (ManagedObjectName) formatter.Deserialize(stream); Assert( name1.GetHashCode() == name2.GetHashCode() ); Assert( name1.Equals( name2 ) ); }