public void DefaultValuesCustomType() { var t = new MyXamlType("System.Int32", null, sctx); Assert.IsNotNull(t.Invoker, "#1"); Assert.IsFalse(t.IsNameValid, "#2"); Assert.IsTrue(t.IsUnknown, "#3"); Assert.AreEqual("System.Int32", t.Name, "#4"); Assert.AreEqual(String.Empty, t.PreferredXamlNamespace, "#5"); Assert.IsNull(t.TypeArguments, "#6"); Assert.IsNull(t.UnderlyingType, "#7"); Assert.IsFalse(t.ConstructionRequiresArguments, "#8"); Assert.IsFalse(t.IsArray, "#9"); Assert.IsFalse(t.IsCollection, "#10"); Assert.IsTrue(t.IsConstructible, "#11"); Assert.IsFalse(t.IsDictionary, "#12"); Assert.IsFalse(t.IsGeneric, "#13"); Assert.IsFalse(t.IsMarkupExtension, "#14"); Assert.IsFalse(t.IsNameScope, "#15"); Assert.IsTrue(t.IsNullable, "#16"); // different from int Assert.IsTrue(t.IsPublic, "#17"); Assert.IsFalse(t.IsUsableDuringInitialization, "#18"); Assert.IsTrue(t.IsWhitespaceSignificantCollection, "#19"); // somehow true ... Assert.IsFalse(t.IsXData, "#20"); Assert.IsFalse(t.TrimSurroundingWhitespace, "#21"); Assert.IsFalse(t.IsAmbient, "#22"); Assert.IsNull(t.AllowedContentTypes, "#23"); Assert.IsNull(t.ContentWrappers, "#24"); Assert.IsNull(t.TypeConverter, "#25"); Assert.IsNull(t.ValueSerializer, "#26"); Assert.IsNull(t.ContentProperty, "#27"); //Assert.IsNull (t.DeferringLoader, "#28"); Assert.IsNull(t.MarkupExtensionReturnType, "#29"); Assert.AreEqual(sctx, t.SchemaContext, "#30"); }
public void EmptyTypeArguments() { var t1 = new MyXamlType("System.Int32", null, sctx); var t2 = new MyXamlType("System.Int32", new XamlType [0], sctx); Assert.IsTrue(t1 == t2, "#1"); Assert.IsTrue(t1.Equals(t2), "#2"); }
public void NoSuchTypeByName() { var t = new MyXamlType("System.NoSuchType", null, sctx); Assert.AreEqual("System.NoSuchType", t.Name, "#1"); Assert.IsNull(t.UnderlyingType, "#2"); Assert.IsNotNull(t.BaseType, "#3-1"); // So, it is type aware. It's weird that t.Name still returns full name just as it is passed to the .ctor. Assert.AreEqual("Object", t.BaseType.Name, "#3-2"); Assert.AreEqual(XamlLanguage.Xaml2006Namespace, t.BaseType.PreferredXamlNamespace, "#3-3"); Assert.AreEqual(String.Empty, t.PreferredXamlNamespace, "#4"); }
public void ConstructorNameWithFullName() { // null typeArguments is allowed. var t = new MyXamlType("System.Int32", null, sctx); Assert.AreEqual("System.Int32", t.Name, "#1"); Assert.IsNull(t.UnderlyingType, "#2"); Assert.IsNotNull(t.BaseType, "#3-1"); // So, it is type aware. It's weird that t.Name still returns full name just as it is passed to the .ctor. Assert.AreEqual("Object", t.BaseType.Name, "#3-2"); Assert.AreEqual(XamlLanguage.Xaml2006Namespace, t.BaseType.PreferredXamlNamespace, "#3-3"); Assert.IsNull(t.BaseType.BaseType, "#3-4"); Assert.AreEqual(String.Empty, t.PreferredXamlNamespace, "#4"); Assert.IsFalse(t.IsArray, "#5"); Assert.IsFalse(t.IsGeneric, "#6"); Assert.IsTrue(t.IsPublic, "#7"); Assert.AreEqual(0, t.GetAllMembers().Count, "#8"); }