public void TestFromName() { Assert.That(GType.FromName("void"), Is.EqualTo(GType.None)); Assert.That(GType.FromName("there-should-never-be-a-type-with-this-name"), Is.EqualTo(GType.Invalid)); Assert.That(() => GType.FromName("name has invalid characters"), Throws.TypeOf <InvalidGTypeNameException> ()); Assert.That(() => GType.FromName(null), Throws.TypeOf <ArgumentNullException> ()); Utility.AssertNoGLibLog(); }
/// <summary> /// Return the GType for a name. /// </summary> /// <param name="name">Type name to lookup.</param> /// <returns>Corresponding type ID or <see cref="IntPtr.Zero"/>.</returns> public static IntPtr TypeFromName(string name) { return(GType.FromName(name)); }