Skip to content

Commit

Permalink
Initial commit of System.Reflection.Emit.Lightweight
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnet-bot authored and Lakshmi Priya Sekar committed May 22, 2015
1 parent 360607a commit ce7a16e
Show file tree
Hide file tree
Showing 25 changed files with 2,625 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22609.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Emit.Lightweight.Tests", "tests\System.Reflection.Emit.Lightweight.Tests.csproj", "{C338DCF7-FB75-407B-A2ED-117FBF3AAA18}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C338DCF7-FB75-407B-A2ED-117FBF3AAA18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C338DCF7-FB75-407B-A2ED-117FBF3AAA18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C338DCF7-FB75-407B-A2ED-117FBF3AAA18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C338DCF7-FB75-407B-A2ED-117FBF3AAA18}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Xunit;

namespace System.Reflection.Emit.Lightweight.Tests
{
public class DynamicMethodAttributesTests
{
public const string c_DYNAMICMETHODNAME = "MethodName";

[Fact]
public void PosTest1()
{
DynamicMethod dynamicmethod = new DynamicMethod(c_DYNAMICMETHODNAME, MethodAttributes.Static | MethodAttributes.Public, CallingConventions.Standard, null, null, typeof(TestClass).GetTypeInfo().Module, true);
MethodAttributes methodattribute = dynamicmethod.Attributes;
Assert.False(methodattribute != (MethodAttributes.Public | MethodAttributes.Static));
}

[Fact]
public void PosTest2()
{
DynamicMethod dynamicmethod = new DynamicMethod(c_DYNAMICMETHODNAME, MethodAttributes.Static | MethodAttributes.Family | MethodAttributes.FamANDAssem, CallingConventions.Standard, null, null, typeof(TestClass).GetTypeInfo().Module, true);
MethodAttributes methodattribute = dynamicmethod.Attributes;
Assert.False(methodattribute != (MethodAttributes.Public | MethodAttributes.Static));
}
}

public class TestClass
{
}

public class GenClass1<T>
{
}

public class GenClass2<T, K>
{
}

public interface TestInter
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Reflection;
using System.Reflection.Emit;
using Xunit;

namespace System.Reflection.Emit.Lightweight.Tests
{
public class DynamicMethodCallingConventionTests
{
public const string c_DYNAMICMETHODNAME = "MethodName";

[Fact]
public void PosTest1()
{
DynamicMethod dynamicmethod = new DynamicMethod(c_DYNAMICMETHODNAME, MethodAttributes.Static | MethodAttributes.Public, CallingConventions.Standard, null, null, typeof(TestClass).GetTypeInfo().Module, true);
CallingConventions callingconvertion = dynamicmethod.CallingConvention;
Assert.False(callingconvertion != CallingConventions.Standard);
}
}
}
Loading

0 comments on commit ce7a16e

Please sign in to comment.