Ejemplo n.º 1
0
		public void MatchSingle()
		{
			AspectDefinition def = new AspectDefinition(LexicalInfo.Empty, "Wilber");

			TypeReference typeRef = new TypeReference(LexicalInfo.Empty, "");
			typeRef.ResolvedType = typeof(Stack);

			def.TargetType = new TargetTypeDefinition( typeRef );

			Assert.IsFalse( SingleTypeMatcher.Instance.Match( typeof(Object), def ) );
			Assert.IsFalse( SingleTypeMatcher.Instance.Match( typeof(IList), def ) );
			Assert.IsFalse( SingleTypeMatcher.Instance.Match( typeof(ArrayList), def ) );
			Assert.IsTrue( SingleTypeMatcher.Instance.Match( typeof(Stack), def ) );
		}
Ejemplo n.º 2
0
		public void MatchNamespaceWithExcludes()
		{
			AspectDefinition def = new AspectDefinition(LexicalInfo.Empty, "Wilber");

			def.TargetType = new TargetTypeDefinition();
			def.TargetType.TargetStrategy = TargetStrategyEnum.Namespace;
			def.TargetType.NamespaceRoot = "System.Collections";

			TypeReference typeRef = new TypeReference(LexicalInfo.Empty, "");
			typeRef.ResolvedType = typeof(Stack);

			def.TargetType.Excludes.Add( typeRef );

			Assert.IsTrue( NamespaceMatcher.Instance.Match( typeof(IList), def ) );
			Assert.IsTrue( NamespaceMatcher.Instance.Match( typeof(ArrayList), def ) );
			Assert.IsFalse( NamespaceMatcher.Instance.Match( typeof(Stack), def ) );
		}
		public void MatchAssignable()
		{
			AspectDefinition def = new AspectDefinition(LexicalInfo.Empty, "Wilber");

			def.TargetType = new TargetTypeDefinition();
			def.TargetType.TargetStrategy = TargetStrategyEnum.Assignable;
			
			TypeReference typeRef = new TypeReference(LexicalInfo.Empty, "");
			typeRef.ResolvedType = typeof(IList);

			def.TargetType.AssignType = typeRef;

			Assert.IsFalse( AssignableMatcher.Instance.Match( typeof(Object), def ) );
			Assert.IsFalse( AssignableMatcher.Instance.Match( typeof(HybridDictionary), def ) );
			Assert.IsTrue( AssignableMatcher.Instance.Match( typeof(IList), def ) );
			Assert.IsTrue( AssignableMatcher.Instance.Match( typeof(ArrayList), def ) );
			Assert.IsFalse( AssignableMatcher.Instance.Match( typeof(Stack), def ) );
		}
Ejemplo n.º 4
0
		public override void OnTypeReferenceDefinition(TypeReference type)
		{
			if (type.TargetType == TargetTypeEnum.Type)
			{
				base.OnTypeReferenceDefinition (type);

				if (type.AssemblyReference == null)
				{
					type.ResolvedType = _typeManager.ResolveType( type.TypeName );
				}
				else
				{
					type.ResolvedType = LoadType( 
						type.TypeName, 
						type.AssemblyReference.ResolvedAssembly.FullName, 
						type.LexicalInfo );
				}
			}
		}
Ejemplo n.º 5
0
		public TargetTypeDefinition( TypeReference typeRef ) : this()
		{
			SingleType = typeRef;
		}
Ejemplo n.º 6
0
		public void Add(TypeReference type)
		{
			InnerList.Add(type);
		}