public void setup_base()
        {
            finder = MockRepository.GenerateMock<ISpecFinder>();

            typesForFinder = new List<Type>();

            finder.Stub(f => f.SpecClasses()).IgnoreArguments().Return(typesForFinder);

            DefaultConventions conventions = new DefaultConventions();

            conventions.Initialize();

            builder = new ContextBuilder(finder, conventions);
        }
        public NSpecResultModel Run(string specName)
        {
            var reflector = new Reflector(this._dllFile);
            var nspecInstance = new nspec();
            var conventions = new DefaultConventions();
            var finder = new SpecFinder(reflector);

            var builder = new ContextBuilder(finder,new Tags().Parse(_tags) , new DefaultConventions());
            var contexts = builder.Contexts().Build();

            var context = contexts.AllContexts().FirstOrDefault(t => t.Name == specName);
            var parentTypeInstance = contexts.AllContexts().FirstOrDefault(t => t is ClassContext);
            
            if (context != null && !context.HasAnyExecutedExample() && parentTypeInstance != null)
            {
                ILiveFormatter liveFormatter = new SilentLiveFormatter();

                if (_formatter is ILiveFormatter) liveFormatter = _formatter as ILiveFormatter;

                var instance = (parentTypeInstance as ClassContext).type.Instance<nspec>();
                context.Contexts.Where(t => t is MethodContext).Do(t => (t as MethodContext).Build(instance));
             
                context.Run(_formatter as ILiveFormatter, false, instance);
                context.AssignExceptions();

                if (builder.tagsFilter.HasTagFilters())
                {
                    context.TrimSkippedDescendants();
                }
            }

            var contextCollection = new ContextCollection { context };
            _formatter.Write(contextCollection);
            var serializableContextCollection = new SerializableContextCollection();
            BuildResponse(serializableContextCollection, contextCollection);
            return new NSpecResultModel { ContextCollection = serializableContextCollection, Output = _formatter.GetFormattedString };
        }
        public void setup()
        {
            var finder = MockRepository.GenerateMock<ISpecFinder>();

            DefaultConventions defaultConvention = new DefaultConventions();

            defaultConvention.Initialize();

            var builder = new ContextBuilder(finder, defaultConvention);

            classContext = new Context("class");

            builder.BuildMethodContexts(classContext, typeof(SpecClass));
        }
Beispiel #4
0
        public void setup()
        {
            conventions = new DefaultConventions();

            conventions.Initialize();

            parentContext = new ClassContext(typeof(parent_before), conventions);

            childContext = new ClassContext(typeof(child_before), conventions);

            parentContext.AddContext(childContext);
        }
Beispiel #5
0
        public void setup_base()
        {
            convention = new DefaultConventions();

            convention.Initialize();
        }