示例#1
0
        public void Defensive()
        {
            var property = new CodeProperty {
                Name = "prop",
            };

            Assert.False(property.IsOfKind((CodePropertyKind[])null));
            Assert.False(property.IsOfKind(Array.Empty <CodePropertyKind>()));
        }
示例#2
0
        public void Defensive()
        {
            var root     = CodeNamespace.InitRootNamespace();
            var property = new CodeProperty(root)
            {
                Name = "prop",
            };

            Assert.False(property.IsOfKind((CodePropertyKind[])null));
            Assert.False(property.IsOfKind(new CodePropertyKind[] { }));
        }
示例#3
0
        public void IsOfKind()
        {
            var property = new CodeProperty {
                Name = "prop",
            };

            Assert.False(property.IsOfKind(CodePropertyKind.BackingStore));
            property.Kind = CodePropertyKind.RequestBuilder;
            Assert.True(property.IsOfKind(CodePropertyKind.RequestBuilder));
            Assert.True(property.IsOfKind(CodePropertyKind.RequestBuilder, CodePropertyKind.BackingStore));
            Assert.False(property.IsOfKind(CodePropertyKind.BackingStore));
        }
示例#4
0
        public void IsOfKind()
        {
            var root     = CodeNamespace.InitRootNamespace();
            var property = new CodeProperty(root)
            {
                Name = "prop",
            };

            Assert.False(property.IsOfKind(CodePropertyKind.BackingStore));
            property.PropertyKind = CodePropertyKind.RequestBuilder;
            Assert.True(property.IsOfKind(CodePropertyKind.RequestBuilder));
            Assert.True(property.IsOfKind(CodePropertyKind.RequestBuilder, CodePropertyKind.BackingStore));
            Assert.False(property.IsOfKind(CodePropertyKind.BackingStore));
        }
示例#5
0
 private string GetDocCommentReturnType(CodeMethod codeMethod, CodeProperty accessedProperty)
 {
     return(codeMethod.Kind switch
     {
         CodeMethodKind.Deserializer => "array<string, callable>",
         CodeMethodKind.Getter when accessedProperty.IsOfKind(CodePropertyKind.AdditionalData) => "array<string, mixed>",
         CodeMethodKind.Getter when accessedProperty.Type.IsArray || accessedProperty.Type.IsCollection => $"array<{conventions.TranslateType(accessedProperty.Type)}>",
         _ => conventions.GetTypeString(codeMethod.ReturnType, codeMethod)
     });