TestAttributeTestContextProvider

Namespace: ExtentReports
We found 8 examples in language CSharp for this search. You will see 33 fragments of code.

Other methods

using AventStack.ExtentReports.Model;
using AventStack.ExtentReports.Model.Context;

using System.Collections.Generic;

namespace AventStack.ExtentReports.Core
{
    public class ReportAggregates
    {
        public List<Test> TestList { get; internal set; }

        public List<string> TestRunnerLogs { get; internal set; }

        public ReportStatusStats ReportStatusStats { get; internal set; }

        public List<Status> StatusList { get; internal set; }

        public TestAttributeTestContextProvider<Author> AuthorContext { get; internal set; }

        public TestAttributeTestContextProvider<Category> CategoryContext { get; internal set; }

        public TestAttributeTestContextProvider<Device> DeviceContext { get; internal set; }

        public TestAttributeTestContextProvider<ExceptionInfo> ExceptionInfoContext { get; internal set; }
        
        public SystemAttributeContext SystemAttributeContext { get; internal set; }
    }
}


        protected void Attach(IExtentReporter reporter)
        {
            if (_reporterCollection == null)
                _reporterCollection = new List<IExtentReporter>();

            _reporterCollection.Add(reporter);
            reporter.Start();
        }

        protected void Detach(IExtentReporter reporter)
        {
            reporter.Stop();
            _reporterCollection.Remove(reporter);
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        protected void CreateTest(Test test)
        {
            if (_reporterCollection.IsNullOrEmpty())
                throw new InvalidOperationException("No reporters were started. Atleast 1 reporter must be started to create tests.");

            if (_testCollection == null)
                _testCollection = new List<Test>();

            _testCollection.Add(test);

            _reporterCollection.ForEach(x => x.OnTestStarted(test));
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        protected void RemoveTest(Test test)
        {
            foreach (var t in _testCollection)
            {
                if (t.TestId == test.TestId)
                {
                    _testCollection.Remove(t);
                    return;
                }

                if (t.HasChildren())
                {
                    foreach (var n in t.NodeContext().GetAllItems())
                    {
                        if (n.TestId == test.TestId)
                        {
                            t.NodeContext().Remove(n);
                            return;
                        }
                    }
                }
            }
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        internal void AddNode(Test node)
        {
            _reporterCollection.ForEach(x => x.OnNodeStarted(node));
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        internal void AddLog(Test test, Log log)
        {
            CollectRunInfo();
            _reporterCollection.ForEach(x => x.OnLogAdded(test, log));
        }

using AventStack.ExtentReports.Model;
using System.Collections.Generic;

namespace AventStack.ExtentReports
{
    public interface IReportAggregatesListener
    {
        List<Test> TestList { get; set; }
        TestAttributeTestContextProvider<Category> CategoryContext { get; set; }
        List<string> TestRunnerLogs { get; set; }
        SessionStatusStats SessionStatusStats { get; set; }
        SystemAttributeContext SystemAttributeContext { get; set; }
        ExceptionTestContextProvider ExceptionContext { get; set; }
    }
}

using System.Collections.Generic;

using AventStack.ExtentReports.Model;

namespace AventStack.ExtentReports
{
    public interface IReportAggregatesListener
    {
        List<Test> TestList { get; set; }
        TestAttributeTestContextProvider<Category> CategoryContext { get; set; }
        List<string> TestRunnerLogs { get; set; }
        SessionStatusStats SessionStatusStats { get; set; }
        SystemAttributeContext SystemAttributeContext { get; set; }
        ExceptionTestContextProvider ExceptionContext { get; set; }
    }
}

        public abstract void OnAuthorAssigned(Test test, Author author);
        public abstract void OnCategoryAssigned(Test test, Category category);
        public abstract void OnLogAdded(Test test, Log log);
        public abstract void OnNodeStarted(Test node);
        public abstract void OnScreenCaptureAdded(Test test, ScreenCapture screenCapture);
        public abstract void OnScreenCaptureAdded(Log log, ScreenCapture screenCapture);

        public abstract void OnAuthorAssigned(Test test, Author author);
        public abstract void OnCategoryAssigned(Test test, Category category);
        public abstract void OnLogAdded(Test test, Log log);
        public abstract void OnNodeStarted(Test node);
        public abstract void OnScreenCaptureAdded(Test test, ScreenCapture screenCapture);
        public abstract void OnScreenCaptureAdded(Log log, ScreenCapture screenCapture);


        public ExtentHtmlReporterConfiguration Configuration()
        {
            return _reporterConfig;
        }

        public override void LoadConfig(string filePath)
        {
            if (!File.Exists(filePath))
                throw new FileNotFoundException("The file " + filePath + " was not found.");

            var xdoc = XDocument.Load(filePath, LoadOptions.None);
            if (xdoc == null)
            {
                throw new FileLoadException("Unable to configure report with the supplied configuration. Please check the input file and try again.");
            }

            LoadConfigFileContents(xdoc);
        }

        private void LoadConfigFileContents(XDocument xdoc)
        {
            foreach (var xe in xdoc.Descendants("configuration").First().Elements())
            {
                var key = xe.Name.ToString();
                var value = xe.Value;

                var c = new Config(key, value);
                _configManager.AddConfig(c);
            }
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        public override void Flush()
        {
            LoadUserConfig();

            _extentSource = Engine.Razor.RunCompile("index", typeof(ExtentHtmlReporter), this);
            File.WriteAllText(_filePath, _extentSource);
        }

        private void LoadUserConfig()
        {
            foreach (var config in _configManager.Configuration)
            {
                var key = config.Key;
                var value = config.Value;

                if (!string.IsNullOrEmpty(value))
                    _reporterConfig.GetConfiguration()[key] = value;
            }
        }

        public override void Start()
        {
            InitializeRazor();
            AddTemplates();
        }


        public ExtentHtmlReporterConfiguration Configuration()
        {
            return _reporterConfig;
        }

        public override void LoadConfig(string filePath)
        {
            if (!File.Exists(filePath))
                throw new FileNotFoundException("The file " + filePath + " was not found.");

            var xdoc = XDocument.Load(filePath, LoadOptions.None);
            if (xdoc == null)
            {
                throw new FileLoadException("Unable to configure report with the supplied configuration. Please check the input file and try again.");
            }

            LoadConfigFileContents(xdoc);
        }

        private void LoadConfigFileContents(XDocument xdoc)
        {
            foreach (var xe in xdoc.Descendants("configuration").First().Elements())
            {
                var key = xe.Name.ToString();
                var value = xe.Value;

                var c = new Config(key, value);
                _configManager.AddConfig(c);
            }
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        public override void Flush()
        {
            LoadUserConfig();

            _extentSource = Engine.Razor.RunCompile("index", typeof(ExtentHtmlReporter), this);
            File.WriteAllText(_filePath, _extentSource);
        }

        private void LoadUserConfig()
        {
            foreach (var config in _configManager.Configuration)
            {
                var key = config.Key;
                var value = config.Value;

                if (!string.IsNullOrEmpty(value))
                    _reporterConfig.GetConfiguration()[key] = value;
            }
        }

        public override void Start()
        {
            InitializeRazor();
            AddTemplates();
        }

AventStack.ExtentReports.Model.Context.TestAttributeTestContextProvider<T> : Object

Constructors :

public TestAttributeTestContextProvider()

Methods :

public List<TestAttributeTestContext<T>> get_Context()
public Void AddAttributeContext(T attrib = , Test test = )
public Void RemoveTest(Test test = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()