Added container accessor to Castle.Core
[castle.git] / AspectSharp / AspectSharp.Lang.Tests / Types / PruneTypesStepTestCase.cs
blob0b5ba9e9e378a09f097175ae918aafe0eed0c66f
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace AspectSharp.Lang.Tests.Types
17 using System;
19 using NUnit.Framework;
21 using AspectSharp.Lang.AST;
22 using AspectSharp.Lang.Steps;
23 using AspectSharp.Lang.Steps.Types;
24 using AspectSharp.Lang.Steps.Semantic;
26 /// <summary>
27 /// Summary description for PruneTypesStepTestCase.
28 /// </summary>
29 [TestFixture]
30 public class PruneTypesStepTestCase : ParserTestCaseBase
32 [Test]
33 public void InvalidInterceptor()
35 String content = " " +
36 "interceptors \r\n" +
37 "[" +
38 "\"customer\" : System.Collections.Hashtable" +
39 "]";
41 EngineConfiguration conf = ProcessContent(content);
42 Assert.IsTrue(_context.HasErrors);
43 AssertOutput( "The specified type for an interceptor doesn't implement the interceptor interface;" );
46 [Test]
47 public void ValidInterceptor()
49 String content = " " +
50 "interceptors \r\n" +
51 "[" +
52 "\"customer\" : AspectSharp.Lang.Tests.Types.Interceptors.DummyInterceptor in AspectSharp.Lang.Tests" +
53 "]";
55 EngineConfiguration conf = ProcessContent(content);
56 Assert.IsFalse(_context.HasErrors);
59 [Test]
60 public void InvalidMixin()
62 String content = " " +
63 "mixins \r\n" +
64 "[" +
65 "\"customer\" : System.Collections.IList" +
66 "]";
68 EngineConfiguration conf = ProcessContent(content);
69 Assert.IsTrue(_context.HasErrors);
70 AssertOutput( "The specified type for a mixin is an interface which is invalid;" );
73 protected override void AddSteps(StepChainBuilder chain)
75 chain.AddStep(new SemanticAnalizerStep());
76 chain.AddStep(new ResolveTypesStep());
77 chain.AddStep(new PruneTypesStep());