ninject /src/Ninject.Tests/Unit/CompiledModuleLoaderPluginTests.cs

Language C# Lines 40
MD5 Hash 37fe4317c0f7d8bb30e4889b25c1bdef
Repository https://github.com/developingchris/ninject.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Moq;
using Ninject.Modules;
using Xunit;
using Xunit.Should;

namespace Ninject.Tests.Unit.CompiledModuleLoaderPluginTests
{
	public class CompiledModuleLoaderPluginContext
	{
		protected readonly CompiledModuleLoaderPlugin loaderPlugin;
		protected readonly Mock<IKernel> kernelMock;
		protected readonly string assemblyFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"TestModules\Ninject.Tests.TestModule.dll");

		public CompiledModuleLoaderPluginContext()
		{
			kernelMock = new Mock<IKernel>();
			loaderPlugin = new CompiledModuleLoaderPlugin(kernelMock.Object);
		}
	}

	public class WhenLoadModulesIsCalled : CompiledModuleLoaderPluginContext
	{
		[Fact(Skip = "Need to bring TestModule assembly into git")]
		public void CallsLoadMethodOnKernelWithAssemblies()
		{
			Assembly expected = Assembly.Load("Ninject.Tests.TestModule");
			expected.ShouldNotBeNull();

			loaderPlugin.LoadModules(new[] { assemblyFilename });

			kernelMock.Verify(x => x.Load(It.Is<IEnumerable<Assembly>>(p => p.Contains(expected))));
		}
	}
}
Back to Top