PageRenderTime 22ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/UnitTests/AOP/BootStrappingTests.cs

http://github.com/philiplaureano/LinFu
C# | 24 lines | 22 code | 2 blank | 0 comment | 1 complexity | 94a2779eb01184d6aa3d2819cc06af18 MD5 | raw file
 1using System.Linq;
 2using LinFu.AOP.Interfaces;
 3using Xunit;
 4using SampleLibrary.AOP;
 5
 6namespace LinFu.UnitTests.AOP
 7{
 8    public class BootStrappingTests : BaseTestFixture
 9    {
10        [Fact]
11        public void ShouldCallTypeThatImplementsBootstrapInterface()
12        {
13            var registry = BootStrapRegistry.Instance;
14            var bootStrappedComponents = registry.GetComponents();
15            var targetComponent = (from c in bootStrappedComponents
16                let type = c.GetType()
17                where type == typeof(SampleBootstrapComponent)
18                select c).First();
19
20            var component = (SampleBootstrapComponent) targetComponent;
21            Assert.True(component.Called);
22        }
23    }
24}