Exemple #1
0
        public override void Build(nspec unused = null)
        {
            BeforeAllChain.BuildMethodLevel(classHierarchy);

            BeforeChain.BuildMethodLevel(classHierarchy);

            ActChain.BuildMethodLevel(classHierarchy);

            AfterChain.BuildMethodLevel(classHierarchy);

            AfterAllChain.BuildMethodLevel(classHierarchy);

            try
            {
                var nspec = SpecType.CreateInstanceAs <nspec>();

                nspec.tagsFilter = tagsFilter ?? new Tags();

                base.Build(nspec);
            }
            catch (Exception ex)
            {
                cantCreateInstance = true;

                AddFailingExample(ex);
            }
        }
Exemple #2
0
        public override string ToString()
        {
            string levelText   = $"L{Level}";
            string exampleText = $"{Examples.Count} exm";
            string contextText = $"{Contexts.Count} ctx";

            var exception =
                BeforeAllChain.AnyException() ??
                BeforeChain.AnyException() ??
                ActChain.AnyException() ??
                AfterChain.AnyException() ??
                AfterAllChain.AnyException();

            string exceptionText = exception?.GetType().Name ?? String.Empty;

            return(String.Join(",", new []
            {
                Name, levelText, exampleText, contextText, exceptionText,
            }));
        }
Exemple #3
0
        public Context(string name = "", string tags = null, bool isPending = false, Conventions conventions = null)
        {
            Name           = name.Replace("_", " ");
            Tags           = Domain.Tags.ParseTags(tags);
            this.isPending = isPending;

            Examples = new List <ExampleBase>();
            Contexts = new ContextCollection();

            if (conventions == null)
            {
                conventions = new DefaultConventions().Initialize();
            }

            runnables = new List <RunnableExample>();

            BeforeAllChain = new BeforeAllChain(this, conventions);
            BeforeChain    = new BeforeChain(this, conventions);
            ActChain       = new ActChain(this, conventions);
            AfterChain     = new AfterChain(this, conventions);
            AfterAllChain  = new AfterAllChain(this, conventions);
        }