Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ComUnregisterFunctionAttributeTests.cs « InteropServices « Runtime « System « tests « System.Runtime.InteropServices « src - github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3189d93e69f0a99d689a5a87855b570f4c271835 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Linq;
using System.Reflection;
using Xunit;

namespace System.Runtime.InteropServices.Tests
{
    public class ComUnregisterFunctionAttributeTests
    {
        [ComUnregisterFunction]
        private int Func(int a, int b)
        {
            return a + b;
        }

        [Fact]
        public void Exists()
        {
            var type = typeof(ComUnregisterFunctionAttributeTests);
            var method = type.GetTypeInfo().DeclaredMethods.Single(m => m.Name == "Func");
            var attr = method.GetCustomAttributes(typeof(ComUnregisterFunctionAttribute), false).OfType<ComUnregisterFunctionAttribute>().SingleOrDefault();
            Assert.NotNull(attr);
        }
    }
}