public void ObjectIDs_Can_Convert_To_And_From_Strings() { ObjectIdTypeConverter tc = new ObjectIdTypeConverter(); var obj = ObjectId.NewObjectId(); Assert.True(tc.CanConvertFrom(typeof(String))); var conv = tc.ConvertFrom(obj.ToString()); Assert.Equal(obj, conv); Assert.Throws<NotSupportedException>(()=>tc.ConvertFrom(Guid.NewGuid())); }
public void ObjectIDs_Can_Convert_To_And_From_Strings() { ObjectIdTypeConverter tc = new ObjectIdTypeConverter(); var obj = ObjectId.NewObjectId(); Assert.True(tc.CanConvertFrom(typeof(String))); var conv = tc.ConvertFrom(obj.ToString()); Assert.Equal(obj, conv); Assert.Throws <NotSupportedException>(() => tc.ConvertFrom(Guid.NewGuid())); }