public void PropertyTestHasSetterStringRep() { var propertySymbol = (IPropertySymbol)TestResource.GetTestMember("TestLibrary.PublicClass", "propertyBoth"); PropertyApiView property = new PropertyApiView(propertySymbol); Assert.Equal("public int propertyBoth { get; set; }", property.ToString()); }
public void NamedTypeTestImplementingHTMLRender() { var p = new PropertyApiView { Name = "TestProperty", Type = new TypeReferenceApiView(new TokenApiView[] { new TokenApiView("string", TypeReferenceApiView.TokenType.BuiltInType) }), Accessibility = "protected", IsAbstract = false, IsVirtual = false, HasSetMethod = true }; var nt = new NamedTypeApiView { Name = "ImplementingClass", TypeKind = "class", Accessibility = "public", Id = "ImplementingClass", Events = new EventApiView[] { }, Fields = new FieldApiView[] { }, Implementations = new TypeReferenceApiView[] { new TypeReferenceApiView(new TokenApiView[] { new TokenApiView("BaseClass", TypeReferenceApiView.TokenType.ClassType) }) }, Methods = new MethodApiView[] { }, NamedTypes = new NamedTypeApiView[] { }, Properties = new PropertyApiView[] { p }, TypeParameters = new TypeParameterApiView[] { } }; var renderer = new HTMLRendererApiView(); var list = new StringListApiView(); renderer.Render(nt, list); Assert.Equal("<span class=\"keyword\">public</span> <span class=\"keyword\">class</span> <a href=\"#\" id=\"ImplementingClass\" class=\"class commentable\">ImplementingClass</a> : " + "<a href=\"#\" class=\"class\">BaseClass</a> {" + Environment.NewLine + " <span class=\"keyword\">protected</span> <span class=\"keyword\">string</span> <a id=\"\" class" + "=\"name commentable\">TestProperty</a> { <span class=\"keyword\">get</span>; <span class=\"keyword\">set</span>; }" + Environment.NewLine + "}", list.ToString()); }
public void PropertyTestNoSetter() { var propertySymbol = (IPropertySymbol)TestResource.GetTestMember("TestLibrary.PublicClass", "propertyGet"); PropertyApiView property = new PropertyApiView(propertySymbol); Assert.Equal("propertyGet", property.Name); Assert.Equal("uint", property.Type.Tokens[0].DisplayString); Assert.False(property.HasSetMethod); }