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)); }
public void RewriteQualification() { var result = _allTheTypes.Apply(DummyRewriter.Instance, x => Replace(x, "Culture", "AnotherCulture")); const string ExpectedDiffs = @"~ByRef: ~ Pointer: ~ SZArrayType: ~ ArrayType: ~ Generic: ~ NamedType: ""Nested"" ~ NamedType: ""TypeName"" ~ Assembly: ""Foo"" ~ Qualification: - ""Culture"" + ""AnotherCulture"" ""neutral"" NamedType: ""TArg"" 1 "; Assert.That(TreeRenderer.Diff(_allTheTypes, result), Is.EqualTo(ExpectedDiffs)); }
public void Type_Unqualified() { var expected = @"NamedType: ""Foo.Bar"" "; Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar")), Is.EqualTo(expected)); }
public void Type_ByRef() { var expected = @"ByRef: NamedType: ""Foo.Bar"" Assembly: ""FooBar"" "; Assert.That(TreeRenderer.Format(InsTypeFactory.ParseTypeName("Foo.Bar&, FooBar")), Is.EqualTo(expected)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }