/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

  1. using System.Linq;
  2. using LinFu.AOP.Interfaces;
  3. using Xunit;
  4. using SampleLibrary.AOP;
  5. namespace LinFu.UnitTests.AOP
  6. {
  7. public class BootStrappingTests : BaseTestFixture
  8. {
  9. [Fact]
  10. public void ShouldCallTypeThatImplementsBootstrapInterface()
  11. {
  12. var registry = BootStrapRegistry.Instance;
  13. var bootStrappedComponents = registry.GetComponents();
  14. var targetComponent = (from c in bootStrappedComponents
  15. let type = c.GetType()
  16. where type == typeof(SampleBootstrapComponent)
  17. select c).First();
  18. var component = (SampleBootstrapComponent) targetComponent;
  19. Assert.True(component.Called);
  20. }
  21. }
  22. }