public async Task Should_load_extension_in_directory()
        {
            var directory = DirectoryUtility.CreateDirectory();

            const string nugetPackageName      = "myNugetPackage";
            var          nugetPackageDirectory = new DirectoryInfo(
                Path.Combine(
                    directory.FullName,
                    nugetPackageName,
                    "2.0.0"));

            var extensionsDir =
                new DirectoryInfo(
                    Path.Combine(
                        nugetPackageDirectory.FullName,
                        "interactive-extensions", "dotnet", "cs"));

            var extensionDll = await KernelExtensionTestHelper.CreateExtensionInDirectory(
                directory,
                @"await kernel.SendAsync(new SubmitCode(""using System.Reflection;""));",
                extensionsDir);

            var kernel = CreateKernel();

            await kernel.SendAsync(new LoadExtensionsInDirectory(nugetPackageDirectory, kernel.Name));

            KernelEvents.Should()
            .ContainSingle <DisplayedValueUpdated>(e =>
                                                   e.Value.ToString() == $"Loaded kernel extension TestKernelExtension from assembly {extensionDll.FullName}");
        }
        public async Task Gives_kernel_extension_load_exception_event_when_extension_throws_exception_during_load(string extensionPath)
        {
            var extensionDir = DirectoryUtility.CreateDirectory();
            await KernelExtensionTestHelper.CreateExtensionInDirectory(
                extensionDir,
                @"throw new Exception();",
                extensionDir.CreateSubdirectory(extensionPath)
                );

            var kernel = CreateKernel();

            using var events = kernel.KernelEvents.ToSubscribedList();

            await kernel.SendAsync(new LoadExtensionsInDirectory(extensionDir, kernel.Name));

            events.Should()
            .ContainSingle <CommandFailed>(cf => cf.Exception is KernelExtensionLoadException);
        }
        public async Task can_load_kernel_extensions(string extensionPath, string code)
        {
            var extensionDir  = DirectoryUtility.CreateDirectory();
            var extensionFile = await KernelExtensionTestHelper.CreateExtensionInDirectory(extensionDir,
                                                                                           code,
                                                                                           extensionDir.CreateSubdirectory(extensionPath)
                                                                                           );

            var kernel = CreateKernel();

            using var events = kernel.KernelEvents.ToSubscribedList();
            await kernel.SendAsync(new LoadExtensionsInDirectory(extensionDir, kernel.Name));

            events.Should()
            .NotContain(e => e is CommandFailed)
            .And
            .ContainSingle <DisplayedValueUpdated>(dv => dv.Value.ToString().Contains(extensionFile.FullName));
        }