⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reflectionpropertytests.cs

📁 全功能c#编译器
💻 CS
字号:
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version value="$version"/>
// </file>

using System;
using System.Text;
using System.Reflection;

using ICSharpCode.SharpUnit;
using SharpDevelop.Internal.Parser;

namespace SharpDevelopTests
{ 
	[TestSuiteAttribute()]
	public class ReflectionPropertyTests
	{
		public             int publicProperty {get {return 0;} set {} }
		private            int privateProperty {set {} }
		protected          int protectedProperty {get {return 0;} }
		internal           int internalProperty {get {return 0;} set {} }
		internal protected int internalProtectedProperty {get {return 0;} set {} }
		static             int staticPrivateProperty { set {} }
		
		BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Public;
		
		[TestMethodAttribute()]
		public void ReflectionPropertyTest1()
		{
			IProperty property = new ReflectionProperty(this.GetType().GetProperty("publicProperty", flags), null);
			Assertion.AssertEquals(ModifierEnum.Public, property.Modifiers);
		}
		
		[TestMethodAttribute()]
		public void ReflectionPropertyTest2()
		{
			IProperty property = new ReflectionProperty(this.GetType().GetProperty("privateProperty", flags), null);
			Assertion.AssertEquals(ModifierEnum.Private, property.Modifiers);
		}
		
		[TestMethodAttribute()]
		public void ReflectionPropertyTest3()
		{
			IProperty property = new ReflectionProperty(this.GetType().GetProperty("protectedProperty", flags), null);
			Assertion.AssertEquals(ModifierEnum.Protected, property.Modifiers);
		}
	
		[TestMethodAttribute()]
		public void ReflectionPropertyTest4()
		{
			IProperty property = new ReflectionProperty(this.GetType().GetProperty("internalProperty", flags), null);
			Assertion.AssertEquals(ModifierEnum.Internal, property.Modifiers);
		}
	
		[TestMethodAttribute()]
		public void ReflectionPropertyTest5()
		{
			IProperty property = new ReflectionProperty(this.GetType().GetProperty("internalProtectedProperty", flags), null);
			Assertion.AssertEquals(ModifierEnum.ProtectedOrInternal, property.Modifiers);
		}
	
		[TestMethodAttribute()]
		public void ReflectionPropertyTest6()
		{
			IProperty property = new ReflectionProperty(this.GetType().GetProperty("staticPrivateProperty", flags), null);
			Assertion.AssertEquals(ModifierEnum.Static | ModifierEnum.Private, property.Modifiers);
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -