/// <summary> /// Gets the ETP content type for the specified data object type. /// </summary> /// <param name="type">The type.</param> /// <returns>An <see cref="EtpContentType"/> instance.</returns> public static EtpContentType GetContentType(Type type) { var uri = EtpUris.GetUriFamily(type); var objectType = ObjectTypes.GetObjectType(type); return(uri.ContentType.For(objectType)); }
public void EtpUris_GetUri_Can_Get_200_Uri_Family_From_Type() { var well = new Witsml200.Well { Uuid = _data.Uid() }; var uriFamily = EtpUris.GetUriFamily(well.GetType()); Assert.IsTrue("eml://witsml20".EqualsIgnoreCase(uriFamily.ToString())); Assert.AreEqual("witsml", uriFamily.Family); Assert.AreEqual("2.0", uriFamily.Version); }
public void EtpUris_GetUri_Can_Get_141_As_Default_Uri_Family_From_Invalid_Type() { var uriFamily = EtpUris.GetUriFamily(Type.GetType("")); Assert.IsTrue("eml://witsml14".EqualsIgnoreCase(uriFamily.ToString())); Assert.AreEqual("witsml", uriFamily.Family); Assert.AreEqual("1.4.1.1", uriFamily.Version); uriFamily = EtpUris.GetUriFamily(typeof(string)); Assert.IsTrue("eml://witsml14".EqualsIgnoreCase(uriFamily.ToString())); Assert.AreEqual("witsml", uriFamily.Family); Assert.AreEqual("1.4.1.1", uriFamily.Version); }