public void Succeed_With_Name() { var id = new ImageId(Guid.Parse("83b8710937a84b818c829162c1b405b6")); Check.That(id.Guid).IsEqualTo(Guid.Parse("83b8710937a84b818c829162c1b405b6")); Check.That(id.ToString()).IsEqualTo("{83B87109-37A8-4B81-8C82-9162C1B405B6}"); Check.That(id.GetHashCode()).Not.IsEqualTo(0); Check.That(id.DebuggerDisplay).IsEqualTo("{83B87109-37A8-4B81-8C82-9162C1B405B6}"); }
public void Succeed_With_DefaultConstructor() { var id = new ImageId(); Check.That(id.Guid).IsEqualTo(Guid.Empty); Check.That(id.ToString()).IsEqualTo("{00000000-0000-0000-0000-000000000000}"); Check.That(id.GetHashCode()).IsEqualTo(0); Check.That(id.DebuggerDisplay).IsEqualTo("{00000000-0000-0000-0000-000000000000}"); }
public void TestGetHashCode() { var id0 = new ImageId(); var id1 = new ImageId(Guid.Parse("83b8710937a84b818c829162c1b405b6")); var id2 = new ImageId(Guid.Parse("83B8710937A84B818C829162C1B405B6")); var id3 = new ImageId(Guid.Parse("5A1DF7E2450B4BE7B4F970A95D391316")); Check.That(id0.GetHashCode()).IsEqualTo(0); Check.That(id0.GetHashCode()).IsEqualTo(id0.GetHashCode()); Check.That(id0.GetHashCode()).IsNotEqualTo(id1.GetHashCode()); Check.That(id0.GetHashCode()).IsNotEqualTo(id2.GetHashCode()); Check.That(id0.GetHashCode()).IsNotEqualTo(id3.GetHashCode()); Check.That(id1.GetHashCode()).IsEqualTo(id1.GetHashCode()); Check.That(id1.GetHashCode()).IsEqualTo(id2.GetHashCode()); Check.That(id1.GetHashCode()).IsNotEqualTo(id3.GetHashCode()); Check.That(id2.GetHashCode()).IsEqualTo(id2.GetHashCode()); Check.That(id2.GetHashCode()).IsNotEqualTo(id3.GetHashCode()); Check.That(id3.GetHashCode()).IsEqualTo(id3.GetHashCode()); }