同步操作将从 郑州微厦/AI培训学习-题库-考试-视频-直播 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using Microsoft.VisualStudio.TestTools.UnitTesting;using System;using Song.ViewData;using Song.Entities;using Song.ServiceInterfaces;using WeiSha.Core;using System.Data;using System.Collections.Generic;using System.IO;using System.Web;using System.Text.RegularExpressions;namespace UnitTest{[TestClass]public class UnitTest1{[TestMethod]public void TestMethod1(){string uid = "ExamResults:{0}-{1}-{2}";if (uid.IndexOf(":") > -1) uid = uid.Substring(uid.IndexOf(":") + 1);if (uid.IndexOf("-") > -1) uid = uid.Substring(0,uid.IndexOf("-"));Assert.AreEqual(uid, "123456");}[TestMethod]public void generateCode(){int test = 456;int max = 1002;string res = _lenFormatstring(test,max);Assert.AreEqual(res, "0456");}/// <summary>/// 格式化数值/// </summary>/// <param name="number">要格式化的数值</param>/// <param name="max">字符最大宽度,例如1234,宽度为4</param>/// <returns></returns>private string _lenFormatstring(int number, object max){int len = max.ToString().Length;string format = string.Empty;while (len-- > 0) format += "0";return number.ToString(format);}[TestMethod]public void testList(){List<int> list = null;foreach(int i in list ?? new List<int>() ){//int t = i;}int j =0;string file = "aaa.txt";string ext = Path.GetExtension(file);string prefix = file.IndexOf(".") > -1 ? file.Substring(0, file.LastIndexOf(".")) : file;string ext1 = file.IndexOf(".") > -1 ? file.Substring(file.LastIndexOf(".")) : file;Assert.AreEqual(ext, ".txt");Assert.AreEqual(prefix, "aaa");}[TestMethod]public void SnowFlake(){List<long> list = new List<long>();for (int i = 0; i < 100000; i++){long id = WeiSha.Core.Request.SnowID();list.Add(id);}Assert.AreEqual(list, "0456");}[TestMethod]public void encodeURIComponent_test(){float f = 0;double d = 0;decimal de = 0;string ff = f.GetType().Name;string dd = d.GetType().Name;string ecc = de.GetType().Name;char c = 'a';string cccc = c.GetType().Name;}[TestMethod]public void testXXE(){string s1 = @"<?xml version=""1.0"" encoding=""UTF-8"" ?>< !DOCTYPE ANY [<!ENTITY % name SYSTEM ""http://localhost/tp5/test.xml"">%name;]>";string s2 = @"<?xml version=""1.0""?>< !DOCTYPE test[<!ENTITY writer ""Bill Gates"" >< !ENTITY copyright ""Copyright W3School.com.cn"" >] > ";string r1 = ClearDoctype(s1);string r2 = ClearDoctype(s2);Assert.AreEqual(r1, "0456");}public string ClearDoctype(string html){if (string.IsNullOrWhiteSpace(html)) return html;RegexOptions option = RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace;html = Regex.Replace(html, @"<(\s*)!DOCTYPE[^>]*>", "", option);html = Regex.Replace(html, @"<(\s*)!ENTITY[^>]*>", "", option);return html;}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。