PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Ninject.Tests/Unit/PropertyInjectionDirectiveTests.cs

https://github.com/developingchris/ninject
C# | 33 lines | 28 code | 5 blank | 0 comment | 0 complexity | 14f644dcd5a420b9ec6328ca0bcb5e01 MD5 | raw file
  1. using System;
  2. using Ninject.Injection;
  3. using Ninject.Planning.Directives;
  4. using Xunit;
  5. using Xunit.Should;
  6. namespace Ninject.Tests.Unit.PropertyInjectionDirectiveTests
  7. {
  8. public class PropertyInjectionDirectiveContext
  9. {
  10. protected PropertyInjectionDirective directive;
  11. }
  12. public class WhenDirectiveIsCreated : PropertyInjectionDirectiveContext
  13. {
  14. [Fact]
  15. public void CreatesTargetForProperty()
  16. {
  17. var method = typeof(Dummy).GetProperty("Foo");
  18. PropertyInjector injector = delegate { };
  19. directive = new PropertyInjectionDirective(method, injector);
  20. directive.Target.Name.ShouldBe("Foo");
  21. directive.Target.Type.ShouldBe(typeof(int));
  22. }
  23. }
  24. public class Dummy
  25. {
  26. public int Foo { get; set; }
  27. }
  28. }