Exemple #1
0
        public void Type_ComplexAssemblyLocation()
        {
            var expected =
                @"Generic:
  NamedType:
    ""Baz""
    Assembly:
      ""Quux""
  ArrayType:
    NamedType:
      ""Foo.Bar""
      Assembly:
        ""FooBar""
        Qualification:
          ""Culture""
          ""neu""tr]al""
        Qualification:
          ""Frob""
          ""bar]x""
        Qualification:
          ""Version""
          ""3.14""
    2
";

            // Ensure we can correctly locate the start of the assembly dispite complex syntax along the way.
            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Baz[[Foo.Bar[,], FooBar, Culture=\"neu\\\"tr]al\", Frob=bar\\]x, Version=3.14]], Quux")), Is.EqualTo(expected));
        }
Exemple #2
0
        public void Type_Unqualified()
        {
            var expected =
                @"NamedType:
  ""Foo.Bar""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar")), Is.EqualTo(expected));
        }
Exemple #3
0
        public void Type_ByRef()
        {
            var expected =
                @"ByRef:
  NamedType:
    ""Foo.Bar""
    Assembly:
      ""FooBar""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar&, FooBar")), Is.EqualTo(expected));
        }
Exemple #4
0
 public string?Type_Invalid(string typeName)
 {
     try
     {
         InsTypeFactory.ParseTypeName(typeName);
         Assert.Fail("Expected to throw an InvalidTypeNameException.");
         return(null);
     }
     catch (InvalidTypeNameException ex)
     {
         return(ex.Message);
     }
 }
Exemple #5
0
        public void Type_PointerPointer()
        {
            var expected =
                @"Pointer:
  Pointer:
    NamedType:
      ""Foo.Bar""
      Assembly:
        ""FooBar""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar**, FooBar")), Is.EqualTo(expected));
        }
Exemple #6
0
        public void Type_Array2()
        {
            var expected =
                @"ArrayType:
  NamedType:
    ""Foo.Bar""
    Assembly:
      ""FooBar""
  2
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar[,], FooBar")), Is.EqualTo(expected));
        }
Exemple #7
0
        public void Type_Nested()
        {
            var expected =
                @"NamedType:
  ""Baz""
  NamedType:
    ""Foo.Bar""
    Assembly:
      ""FooBar""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar+Baz, FooBar")), Is.EqualTo(expected));
        }
Exemple #8
0
        public void Type_GenericWithUnquolifiedArg1()
        {
            var expected =
                @"Generic:
  NamedType:
    ""Foo.Bar`1""
    Assembly:
      ""FooBar""
  NamedType:
    ""Baz""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar`1[Baz], FooBar")), Is.EqualTo(expected));
        }
Exemple #9
0
        public void Type_ArrayOfGeneric()
        {
            var expected =
                @"SZArrayType:
  Generic:
    NamedType:
      ""Foo.Bar`1""
      Assembly:
        ""FooBar""
    NamedType:
      ""Baz""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar`1[Baz][], FooBar")), Is.EqualTo(expected));
        }
Exemple #10
0
        public void Type_FullyQualified()
        {
            var expected =
                @"NamedType:
  ""Foo.Bar.Baz""
  Assembly:
    ""FooBar""
    Qualification:
      ""Culture""
      ""neutral""
    Qualification:
      ""Version""
      ""3.14""
";

            Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar.Baz, FooBar, Culture=neutral, Version=3.14")), Is.EqualTo(expected));
        }