private void TestDeepEquals(MediaUrl objectA, MediaUrl objectB, bool expect, bool expectDeep) { Assert.AreEqual(expectDeep, objectA.DeepEquals(objectB)); Assert.AreEqual(expectDeep, objectB.DeepEquals(objectA)); Assert.AreEqual(expect, objectA.Equals(objectB)); Assert.AreEqual(expect, objectB.Equals(objectA)); }
public void TestMediaUrlConstructor_01() { MediaUrl mediaUrl = new MediaUrl(); mediaUrl.Url = "url 1"; MediaUrl mediaUrl2 = new MediaUrl( "url 1"); Assert.IsTrue(mediaUrl.DeepEquals(mediaUrl2)); mediaUrl = new MediaUrl(); mediaUrl.Url = "url 1"; mediaUrl.Width = "width 1"; mediaUrl.Height = "height 1"; mediaUrl.Duration = "duration 1"; mediaUrl.MimeType = "mimeType 1"; mediaUrl.Type = "type 1"; mediaUrl2 = new MediaUrl("url 1", "width 1", "height 1", "duration 1", "mimeType 1", "type 1"); Assert.IsTrue(mediaUrl.DeepEquals(mediaUrl2)); }
/// <summary> /// Determins if this equals that by performing a deep equals /// looking at all elements of all member listsand objects. /// </summary> /// <param name="that">The object to compare for equality.</param> /// <returns>True if this is equal to that, false otherwise.</returns> public bool DeepEquals(MediaUrl that) { if (this == that) return true; else if (that == null) return false; return (string.Equals(this.Url, that.Url) && string.Equals(this.Height, that.Height) && string.Equals(this.Width, that.Width) && string.Equals(this.Duration, that.Duration) && string.Equals(this.MimeType, that.MimeType) && string.Equals(this.Type, that.Type)); }
public void TestMediaUrlSerialize_01() { MediaUrl mediaUrl = new MediaUrl("url 1", "width 1", "height 1", "duration 1", "mimeType 1", "type 1"); string str = XmlHelper.Instance.ToXmlString<MediaUrl>(mediaUrl); Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<mediaURL xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" height=\"height 1\" width=\"width 1\" duration=\"duration 1\" mimeType=\"mimeType 1\" type=\"type 1\">url 1</mediaURL>", str); }
public void TestMediaUrlDeserialize_01() { MediaUrl mediaUrl = new MediaUrl("url 1", "width 1", "height 1", "duration 1", "mimeType 1", "type 1"); string str = XmlHelper.Instance.ToXmlString<MediaUrl>(mediaUrl); MediaUrl des = XmlHelper.Instance.FromXmlString<MediaUrl>(str); Assert.IsTrue(mediaUrl.DeepEquals(des)); }