Пример #1
0
        public static DocumentedAssert New(MethodBase methodBase)
        {
            T GetAttrText <T>() where T : class
            {
                var classAttr = methodBase.DeclaringType
                                .GetCustomAttributes()
                                .First(x => x.GetType() == typeof(T));
                var c = classAttr as T;

                return(c);
            };
            var doctest = new DocumentedAssert();

            DocMe.Instance().Docs.Add(doctest);


            doctest.Class = GetAttrText <DocClassAttribute>().ClassType;

            var attr = (DocMethodAttribute)methodBase
                       .GetCustomAttributes(typeof(DocMethodAttribute), true)[0];

            doctest.Method = attr.Method;

            doctest.Fact = ((DocMeFactAttribute)methodBase
                            .GetCustomAttributes(typeof(DocMeFactAttribute), true).First()).Fact;
            doctest.Fact = doctest.Fact.Trim();
            return(doctest);
        }
Пример #2
0
 public void Init()
 {
     DocMe.Instance().OnOutput = (s) =>
     {
         File.AppendAllText("Markdown.md", s);
     };
     Add_Test();
     DocMe.Instance().Write();
 }
Пример #3
0
 public static DocMe Instance()
 {
     if (_instance != null)
     {
         return(_instance);
     }
     _instance = new DocMe();
     return(_instance);
 }
Пример #4
0
        public void Add_Test()
        {
            var doc = DocMe.New(MethodBase.GetCurrentMethod());

            var now = DateTime.Now.Date;
            var p   = new Person("Dennis", 28);

            doc.Call(1, 2, p, now);

            Calculator.Add(1, 2, p, now);

            doc.Insert("The targetPerson is passed as reference and its state will be modified.");
            doc.State(p);
        }