Beispiel #1
0
        public virtual IRemoteStoryHandler GetHandler(IEnumerable <Story> stories, IEventBus bus)
        {
            var spec = new AssemblyGenerationSpec {
                Assemblies = _assemblyRegistry.GetAssemblyLocations()
            };

            foreach (var story in stories)
            {
                spec.AddStory(story, story.Scenarios);
            }

            var assemblyLocation = _assemblyGenerator.GenerateAssembly(spec);

            return(new RemoteStoryHandler(assemblyLocation, _filesystem, bus, _assemblyRegistry.GetAssemblyLocations()));
        }
Beispiel #2
0
        public virtual IRemoteStoryHandler GetHandler(IEnumerable <Story> stories, IEventBus bus)
        {
            var spec = new AssemblyGenerationSpec {
                Assemblies = _assemblyRegistry.GetAssemblyLocations()
            };

            foreach (var story in stories)
            {
                spec.AddStory(story, story.Scenarios);
            }

            var assemblyLocation = _assemblyGenerator.GenerateAssembly(spec);
            var assembly         = Assembly.LoadFrom(assemblyLocation);

            return(new LocalHandler(Activator.CreateInstance(assembly.GetType("StorEvilTestAssembly.StorEvilDriver"), new object[] { bus }) as IStoryHandler));
            // return new RemoteStoryHandler(assemblyLocation, _filesystem, bus, _assemblyRegistry.GetAssemblyLocations());
        }
Beispiel #3
0
        public void SetupContext()
        {
            Generator  = new AssemblyGenerator();
            _scenarios = new IScenario[]
            {
                TestHelper.BuildScenario("foo", "When I do seomthing",
                                         "something else should happen")
            };

            var spec = new AssemblyGenerationSpec {
                Assemblies = new[] { this.GetType().Assembly.Location }
            };

            spec.AddStory(new Story("foo", "bar", _scenarios), _scenarios);

            GeneratedAssemblyPath = Generator.GenerateAssembly(spec);
        }
Beispiel #4
0
        public Assembly GenerateAssemblyInMemory(AssemblyGenerationSpec spec)
        {
            var sourceCode = _handlerGenerator.GetSourceCode(spec);

            return(_compiler.CompileInMemory(sourceCode, spec.Assemblies));
        }
Beispiel #5
0
        public string GenerateAssembly(AssemblyGenerationSpec spec)
        {
            var sourceCode = _handlerGenerator.GetSourceCode(spec);

            return(_compiler.CompileToFile(sourceCode, spec.Assemblies, GetAssemblyLocation()));
        }