PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/Extensions/src/Ncqrs.Config.Ninject.Tests/NinjectConfigurationTests.cs

http://github.com/ncqrs/ncqrs
C# | 41 lines | 33 code | 8 blank | 0 comment | 0 complexity | 48adda95f29748d29337954d8544716b MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0
  1. using Ninject;
  2. using FluentAssertions;
  3. using Xunit;
  4. namespace Ncqrs.Config.Ninject.Tests
  5. {
  6. public class NinjectConfigurationTests
  7. {
  8. [Fact]
  9. public void When_component_is_registered_it_should_be_retrievable()
  10. {
  11. var kernel = new StandardKernel();
  12. kernel.Bind<IReplicant>().To<Nexus6>();
  13. var configuration = new NinjectConfiguration(kernel);
  14. IReplicant component;
  15. var success = configuration.TryGet(out component);
  16. success.Should().BeTrue();
  17. component.Should().NotBeNull();
  18. component.Should().BeAssignableTo<IReplicant>();
  19. }
  20. [Fact]
  21. public void When_component_is_not_registered_it_should_not_be_retrievable()
  22. {
  23. var kernel = new StandardKernel();
  24. var configuration = new NinjectConfiguration(kernel);
  25. IReplicant component;
  26. var success = configuration.TryGet(out component);
  27. success.Should().BeFalse();
  28. component.Should().BeNull();
  29. }
  30. }
  31. public interface IReplicant { }
  32. public class Nexus6 : IReplicant { }
  33. }