public void TestObjectEquals() { Object id0 = new ImageId(); Object id1 = new ImageId(Guid.Parse("83b8710937a84b818c829162c1b405b6")); Object id2 = new ImageId(Guid.Parse("83B8710937A84B818C829162C1B405B6")); Object id3 = new ImageId(Guid.Parse("5A1DF7E2450B4BE7B4F970A95D391316")); Object id4 = null; Check.That(id0.Equals(id0)).IsTrue(); Check.That(id0.Equals(id1)).IsFalse(); Check.That(id0.Equals(id2)).IsFalse(); Check.That(id0.Equals(id3)).IsFalse(); Check.That(id0.Equals(id4)).IsFalse(); Check.That(id1.Equals(id1)).IsTrue(); Check.That(id1.Equals(id2)).IsTrue(); Check.That(id1.Equals(id3)).IsFalse(); Check.That(id1.Equals(id4)).IsFalse(); Check.That(id2.Equals(id2)).IsTrue(); Check.That(id2.Equals(id3)).IsFalse(); Check.That(id2.Equals(id4)).IsFalse(); Check.That(id3.Equals(id3)).IsTrue(); Check.That(id3.Equals(id4)).IsFalse(); }
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()); }
public void TestOperatorUnequal() { 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")); #pragma warning disable 1718 Check.That(id0 != id0).Not.IsTrue(); Check.That(id0 != id1).Not.IsFalse(); Check.That(id0 != id2).Not.IsFalse(); Check.That(id0 != id3).Not.IsFalse(); Check.That(id1 != id1).Not.IsTrue(); Check.That(id1 != id2).Not.IsTrue(); Check.That(id1 != id3).Not.IsFalse(); Check.That(id2 != id2).Not.IsTrue(); Check.That(id2 != id3).Not.IsFalse(); Check.That(id3 != id3).Not.IsTrue(); #pragma warning restore 1718 }
/// <summary> /// Sets the Id of the Image of the Drink. /// </summary> /// /// <param name="image"> /// The image of the drink.</param> public Drink SetImage(ImageId image) { ImageId = image; return(this); }
public void ReturnsFormatted_For_CustomGuid() { var id = new ImageId(Guid.Parse("83b8710937a84b818c829162c1b405b6")); Check.That(id.DebuggerDisplay).IsEqualTo("{83B87109-37A8-4B81-8C82-9162C1B405B6}"); }
public void ReturnsZeros_For_DefaultConstructor() { var id = new ImageId(); Check.That(id.DebuggerDisplay).IsEqualTo("{00000000-0000-0000-0000-000000000000}"); }
public void ReturnsZeros_For_DefaultConstructor() { var id = new ImageId(); Check.That(id.ToString()).IsEqualTo("{00000000-0000-0000-0000-000000000000}"); }
public void ReturnsEmptyGuid_For_DefaultConstructor() { var id = new ImageId(); Check.That(id.Guid).IsEqualTo(Guid.Empty); }