public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.SimpleAttribute" }
            };

            AssertPublicApi <StructWithSimpleAttribute>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public struct StructWithSimpleAttribute { }
}", options);
        }
示例#2
0
        public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.Attribute_ZZ" }
            };

            AssertPublicApi <DelegateWithMultipleAttributes>(
                @"namespace PublicApiGeneratorTests.Examples
{
    [PublicApiGeneratorTests.Examples.Attribute_AA]
    [PublicApiGeneratorTests.Examples.Attribute_MM]
    public delegate void DelegateWithMultipleAttributes();
}", options);
        }
        public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.SimpleAttribute" }
            };

            AssertPublicApi <IInterfaceWithEventWithAttribute>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public interface IInterfaceWithEventWithAttribute
    {
        event System.EventHandler OnClicked;
    }
}", options);
        }
示例#4
0
        public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.AttributeWithNamedParameterAttribute" }
            };

            AssertPublicApi <IMethodReturnValueWithAttributeWithMultipleNamedParameters>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public interface IMethodReturnValueWithAttributeWithMultipleNamedParameters
    {
        void Method();
    }
}", options);
        }
        public void Should_skip_excluded_attributes()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.SimpleAttribute" }
            };

            AssertPublicApi <PropertyWithSimpleAttributeOnGetterAndSetter>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public class PropertyWithSimpleAttributeOnGetterAndSetter
    {
        public PropertyWithSimpleAttributeOnGetterAndSetter() { }
        public string Value { get; set; }
    }
}", options);
        }
        public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.AttributeWithNamedParameterAttribute" }
            };

            AssertPublicApi <MethodWithAttributeWithMultipleNamedParameters>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public class MethodWithAttributeWithMultipleNamedParameters
    {
        public MethodWithAttributeWithMultipleNamedParameters() { }
        public void Method() { }
    }
}", options);
        }
示例#7
0
        public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.Attribute_MM" }
            };

            AssertPublicApi <ClassWithMultipleAttributes>(
                @"namespace PublicApiGeneratorTests.Examples
{
    [PublicApiGeneratorTests.Examples.Attribute_AA]
    [PublicApiGeneratorTests.Examples.Attribute_ZZ]
    public class ClassWithMultipleAttributes
    {
        public ClassWithMultipleAttributes() { }
    }
}", options);
        }
        public void Should_skip_excluded_attributes()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.Attribute_MM", "PublicApiGeneratorTests.Examples.Attribute_ZZ" }
            };

            AssertPublicApi <FieldWithMultipleAttributes>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public class FieldWithMultipleAttributes
    {
        [PublicApiGeneratorTests.Examples.Attribute_AA]
        public string Value;
        public FieldWithMultipleAttributes() { }
    }
}", options);
        }
示例#9
0
        public void Should_skip_excluded_attribute()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.AttributeWithPositionalParameters2Attribute" }
            };

            AssertPublicApi <MethodParameterWithAttributeWithPositionalParameters>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public class MethodParameterWithAttributeWithPositionalParameters
    {
        public MethodParameterWithAttributeWithPositionalParameters() { }
        public void Method1([PublicApiGeneratorTests.Examples.AttributeWithPositionalParameters1(""Hello"")] int value) { }
        public void Method2(int value) { }
        public void Method3([PublicApiGeneratorTests.Examples.AttributeWithMultiplePositionalParameters(42, ""Hello"")] int value) { }
    }
}", options);
        }
示例#10
0
        public void Should_allow_system_namespace_whitelisting()
        {
            var options = new DefaultApiGeneratorOptions
            {
                WhitelistedNamespacePrefixes = new[] { "System.Whitelisted" }
            };

            AssertPublicApi(new[] { typeof(System1), typeof(System2) },
                            @"namespace System.Whitelisted
{
    public class System1
    {
        public System1() { }
        public void System() { }
    }
    public class System2
    {
        public System2() { }
        public void System() { }
    }
}", options);
        }
示例#11
0
        public void Should_allow_microsoft_namespace_whitelisting()
        {
            var options = new DefaultApiGeneratorOptions
            {
                WhitelistedNamespacePrefixes = new[] { "Microsoft.Whitelisted" }
            };

            AssertPublicApi(new[] { typeof(Simple1), typeof(Simple2) },
                            @"namespace Microsoft.Whitelisted
{
    public class Simple1
    {
        public Simple1() { }
        public void Simple() { }
    }
    public class Simple2
    {
        public Simple2() { }
        public void Simple() { }
    }
}", options);
        }
示例#12
0
        public void Should_output_in_known_order_and_alphabetically()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "System.Runtime.CompilerServices.IsReadOnlyAttribute" }
            };

            // Fields, properties, events, methods, nested type (inc. delegates)
            AssertPublicApi <StructMemberOrder>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public struct StructMemberOrder
    {
        public int Field1;
        public int Field2;
        public int IField2;
        public int iField1;
        public int IProperty2 { get; set; }
        public int Property1 { get; set; }
        public int Property2 { get; set; }
        public int iProperty1 { get; set; }
        public event System.EventHandler Event1;
        public event System.EventHandler Event2;
        public event System.EventHandler IEvent2;
        public event System.EventHandler iEvent1;
        public void IMethod2() { }
        public void Method1() { }
        public void Method2() { }
        public void iMethod1() { }
        public delegate System.EventHandler Delegate1();
        public delegate System.EventHandler Delegate2();
        public delegate System.EventHandler IDelegate2();
        public delegate System.EventHandler iDelegate1();
    }
}", options);
        }
示例#13
0
        public void Should_output_in_known_order_with_nested_class()
        {
            var options = new DefaultApiGeneratorOptions
            {
                ExcludeAttributes = new[] { "System.Runtime.CompilerServices.IsReadOnlyAttribute" }
            };

            // Fields, properties, events, methods
            AssertPublicApi <StructMemberOrderAndNestedClass>(
                @"namespace PublicApiGeneratorTests.Examples
{
    public struct StructMemberOrderAndNestedClass
    {
        public int Field1;
        public int Field2;
        public int IField2;
        public int iField1;
        public int IProperty2 { get; set; }
        public int Property1 { get; set; }
        public int Property2 { get; set; }
        public int iProperty1 { get; set; }
        public event System.EventHandler Event1;
        public event System.EventHandler Event2;
        public event System.EventHandler IEvent2;
        public event System.EventHandler iEvent1;
        public void IMethod2() { }
        public void Method1() { }
        public void Method2() { }
        public void iMethod1() { }
        public struct AnotherNestedStruct
        {
            public int Field;
            public int IField;
            public int iField;
        }
        public class ClassMemberOrderAsNestedClass
        {
            public int Field1;
            public int Field2;
            public int IField2;
            public int iField1;
            public ClassMemberOrderAsNestedClass() { }
            public int IProperty2 { get; set; }
            public int Property1 { get; set; }
            public int Property2 { get; set; }
            public int iProperty1 { get; set; }
            public event System.EventHandler Event1;
            public event System.EventHandler Event2;
            public event System.EventHandler IEvent2;
            public event System.EventHandler iEvent1;
            public void IMethod2() { }
            public void Method1() { }
            public void Method2() { }
            public void iMethod1() { }
            public delegate System.EventHandler Delegate11();
            public delegate System.EventHandler Delegate21();
            public delegate System.EventHandler IDelegate21();
            public delegate System.EventHandler iDelegate11();
        }
        public delegate System.EventHandler Delegate1();
        public delegate System.EventHandler Delegate2();
        public delegate System.EventHandler IDelegate2();
        public delegate System.EventHandler iDelegate1();
    }
}", options);
        }