/// <summary> /// Determines whether the specified <see cref="EtpContentType" />, is equal to this instance. /// </summary> /// <param name="other">The <see cref="EtpContentType" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="EtpContentType" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public bool Equals(EtpContentType other) { if (other == null) { return(false); } var contentType = ToString() ?? string.Empty; var otherContentType = other.ToString() ?? string.Empty; return(string.Equals(contentType, otherContentType, StringComparison.OrdinalIgnoreCase)); }
public void EtpContentType_Can_Be_Converted_From_Json_To_Xml_Format() { var expected = "application/x-witsml+json;version=1.4.1.1;type=well"; var contentType = new EtpContentType(expected); Assert.IsTrue(contentType.IsValid); Assert.AreEqual("well", contentType.ObjectType); Assert.AreEqual("1.4.1.1", contentType.Version); Assert.AreEqual("json", contentType.Format); var converted = "application/x-witsml+xml;version=1.4.1.1;type=well"; contentType = contentType.AsXml(); Assert.IsTrue(contentType.IsValid); Assert.AreEqual("well", contentType.ObjectType); Assert.AreEqual("1.4.1.1", contentType.Version); Assert.AreEqual(Formats.Xml, contentType.Format); Assert.AreEqual(converted, contentType.ToString()); }