public void CreateService()
        {
            _serviceInterface = _serviceClass = new ExtensionService();

            // Rather than actually starting the service, which would result
            // in finding the extensions actually in use on the current system,
            // we simulate the start using this assemblies dummy extensions.
            _serviceClass.FindExtensionPoints(typeof(TestEngine).Assembly);
            _serviceClass.FindExtensionPoints(typeof(ITestEngine).Assembly);

            _serviceClass.FindExtensionsInAssembly(new ExtensionAssembly(GetType().Assembly.Location, false));
        }
Example #2
0
        public void SkipsGracefullyLoadingOtherFrameworkExtensionAssembly()
        {
            //May be null on mono
            Assume.That(Assembly.GetEntryAssembly(), Is.Not.Null, "Entry assembly is null, framework loading validation will be skipped.");

#if NETCOREAPP2_1
            var assemblyName = Path.Combine(GetNetFrameworkSiblingDirectory(), "testcentric.engine.tests.exe");
#elif NET40
            var assemblyName = Path.Combine(GetNetCoreSiblingDirectory(), "testcentric.engine.tests.dll");
#endif
            Assert.That(assemblyName, Does.Exist);

            var service = new ExtensionService();
            service.FindExtensionPoints(typeof(TestEngine).Assembly);
            service.FindExtensionPoints(typeof(ITestEngine).Assembly);
            var extensionAssembly = new ExtensionAssembly(assemblyName, false);

            Assert.That(() => service.FindExtensionsInAssembly(extensionAssembly), Throws.Nothing);
        }
        public void SkipsGracefullyLoadingOtherFrameworkExtensionAssembly()
        {
            //May be null on mono
            Assume.That(Assembly.GetEntryAssembly(), Is.Not.Null, "Entry assembly is null, framework loading validation will be skipped.");

#if NETCOREAPP2_1
            string other        = "net35"; // Attempt to load the .NET 3.5 version of the extensions from the .NET Core 2.0 tests
            var    assemblyName = Path.Combine(GetSiblingDirectory(other), "testcentric.engine.tests.exe");
#elif NET35
            string other        = "netcoreapp2.1"; // Attempt to load the .NET Core 2.1 version of the extensions from the .NET 3.5 tests
            var    assemblyName = Path.Combine(GetSiblingDirectory(other), "testcentric.engine.tests.dll");
#endif
            Assert.That(assemblyName, Does.Exist);

            var service = new ExtensionService();
            service.FindExtensionPoints(typeof(TestEngine).Assembly);
            service.FindExtensionPoints(typeof(ITestEngine).Assembly);
            var extensionAssembly = new ExtensionAssembly(assemblyName, false);

            Assert.That(() => service.FindExtensionsInAssembly(extensionAssembly), Throws.Nothing);
        }