Пример #1
0
        public void WebFormatterDownloadErrorTest()
        {
            string actual;

            WebFormatter.GetJSONFromURL(null, out actual);
            WebFormatter.GetJSONFromURL("", out actual);
            WebFormatter.GetJSONFromURL(" ", out actual);
        }
Пример #2
0
        public void WebFormatterDownloadTest()
        {
            string expected;

            privReadDataFromFile("../../StudentData.txt", out expected);
            string actual;

            WebFormatter.GetJSONFromURL("http://apitest.sertifi.net/api/Students", out actual);

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void WebFormatterUploadTest()
        {
            string data;

            privReadDataFromFile("../../StudentAggregate.txt", out data);
            string actual;
            string expected = "";

            WebFormatter.UploadJSONToURL(data, "http://apitest.sertifi.net/api/StudentAggregate", out actual);

            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void WebFormatterUploadErrorTest()
        {
            string response;
            string nullData  = "";
            string nullData2 = " ";

            WebFormatter.UploadJSONToURL(null, null, out response);
            WebFormatter.UploadJSONToURL(null, "http://apitest.sertifi.net/api/StudentAggregate", out response);
            WebFormatter.UploadJSONToURL(nullData, "", out response);
            WebFormatter.UploadJSONToURL(nullData2, "", out response);
            WebFormatter.UploadJSONToURL(nullData, " ", out response);
            WebFormatter.UploadJSONToURL(nullData2, " ", out response);
        }
Пример #5
0
        public void Webformatter()
        {
            var stat = new Statistics()
            {
                CodeLines = 2399, DocumentationLines = 299
            };
            var res = new WebFormatter().CreateGithubShields(stat);

            Console.WriteLine(res);
            Assert.Equal(@"[![Stats](https://img.shields.io/badge/Code_lines-2,4_K-ff69b4.svg)]()
[![Stats](https://img.shields.io/badge/Test_lines-0-69ffb4.svg)]()
[![Stats](https://img.shields.io/badge/Doc_lines-299-ffb469.svg)]()", res);
        }
Пример #6
0
        public IOMiddleware(RequestDelegate next)
        {
            _next = next;

            logger = new Logger("SRPAGO-OXXO");
            var formatter = new WebFormatter();

            var handler = new StdoutHandler();

            handler.SetFormatter(formatter);

            logger.AddHandler(handler);
        }
Пример #7
0
        public void ReadJSONDataTest()
        {
            string jsonData;

            WebFormatter.GetJSONFromURL("http://apitest.sertifi.net/api/Students", out jsonData);

            ErrorCode retCode;

            List <StudentData> studentsActual;

            retCode = JSONParser.ReadJSONData(jsonData, out studentsActual);

            Assert.AreEqual(ErrorCode.SUCCESS, retCode);
        }
Пример #8
0
        public void MutateReadme()
        {
            var basePath = Path.Combine(Assembly.GetExecutingAssembly().Location, "..", "..", "..", "..", "..");

            var stats = new DirWalker().DoWork(new[] { Path.Combine(basePath, "Git.cs") });

            var shieldsRegEx  = new Regex("<!--start-->.*<!--end-->", RegexOptions.Singleline);
            var githubShields = new WebFormatter().CreateGithubShields(stats);

            var readmePath = Path.Combine(basePath, "README.md");
            var oldReadme  = File.ReadAllText(readmePath);
            var newReadMe  = shieldsRegEx.Replace(oldReadme, $"<!--start-->\r\n{githubShields}\r\n<!--end-->");

            if (oldReadme != newReadMe)
            {
                File.WriteAllText(readmePath, newReadMe);
            }
        }