Beispiel #1
0
        public override void TestInitialise()
        {
            // Execute base initialisation
            base.TestInitialise();

            // Override the dependency injection container to use Moq container
            NinjectSettings settings = new NinjectSettings
            {
                InjectAttribute = typeof(PebbleCode.Framework.IoC.InjectAttribute)
            };

            _mockContainer = new MoqMockingKernel(settings);

            // Load all modules defined in this test assembly
            List <Assembly> assemblies = new List <Assembly>();

            assemblies.Add(Assembly.GetExecutingAssembly()); // this one

            // Add in the assembly for each layer of the class hierarchy
            // (e.g for CT, we'll load CT.Tests and CT.Tests.Unit)
            Type type = this.GetType();

            while (type != null && type != typeof(BaseUnitTest <THelper>))
            {
                if (!assemblies.Contains(type.Assembly))
                {
                    assemblies.Add(type.Assembly);
                }
                type = type.BaseType;
            }

            // Load any that contain modules...
            foreach (Assembly ass in assemblies)
            {
                if (ass.GetTypes().Where(t => typeof(NinjectModule).IsAssignableFrom(t)).Count() > 0)
                {
                    _mockContainer.Load(ass);
                }
            }

            //assemblies.ForEach(ass => _mockContainer.Load(ass));
            _mockContainer.Reset();

            //Make this kernel available to all other libraries
            Kernel.Instance = _mockContainer;

            //Fake logger
            _loggerInstance       = new FakeLogManager();
            Logger.LoggerInstance = _loggerInstance;
        }
Beispiel #2
0
 public void SetUp()
 {
     _kernel.Reset();
 }
Beispiel #3
0
 public void SetUp()
 {
     kernel.Reset();
     //kernel.Inject(this);
 }
Beispiel #4
0
 public void Initialize()
 {
     _kernel.Reset();
 }
Beispiel #5
0
 public UnitTest1(ITestOutputHelper output)
 {
     this.output = output;
     _kernel     = new MoqMockingKernel();
     _kernel.Reset();
 }
Beispiel #6
0
 public void Setup()
 {
     Kernel.Reset();
 }
Beispiel #7
0
 /// <summary>
 /// Resets the auto mocking container.
 /// </summary>
 protected void ResetAutoMocker()
 {
     kernel.Reset();
 }
Beispiel #8
0
 public void TestInitializer()
 {
     _kernel.Reset();
 }
Beispiel #9
0
 public void SetupAutomock()
 {
     Kernel.Reset();
 }
Beispiel #10
0
 public void TearDown()
 {
     kernel.Reset();
 }