public void Test1() { const string expected = "blue is sky the"; string result = Reverser.ReverseWords("the sky is blue"); Assert.AreEqual(expected, result); }
public void Test5() { const string expected = "bob like even not does Alice"; string result = Reverser.ReverseWords("Alice does not even like bob"); Assert.AreEqual(expected, result); }
public void Test3() { const string expected = "example good a"; string result = Reverser.ReverseWords("a good example"); Assert.AreEqual(expected, result); }
public void Test4() { const string expected = "Alice Loves Bob"; string result = Reverser.ReverseWords(" Bob Loves Alice "); Assert.AreEqual(expected, result); }
public void Test2() { const string expected = "world hello"; string result = Reverser.ReverseWords(" hello world "); Assert.AreEqual(expected, result); }
public void SutIsAddIn(Reverser sut) { // Fixture setup // Exercise system // Verify outcome Assert.IsAssignableFrom <IAddIn>(sut); // Teardown }
[InlineData("eye", "eye")] // This is a palindrome! public void ShouldReverseWordSuccessfully(string input, string expected) { // Arrange | Act var result = Reverser.Reverse(input); // Assert Equal(expected, result); }
/// <summary> /// 获取分页 /// </summary> /// <param name="number">总数</param> /// <param name="pagesize">页大小</param> /// <returns></returns> public static List <ProModel> GetProListPageNoByLang(int lang, int number, int pagesize) { List <ProModel> list = EispProDAL.GetProListPageNoByLang(lang, number, pagesize); ProModel p = new ProModel(); Reverser <ProModel> reverser = new Reverser <ProModel>(p.GetType(), "F_Sort", ReverserInfo.Direction.DESC); list.Sort(reverser); return(list); }
static void Main(string[] args) { Console.Write("Enter sentence: "); var sentence = Console.ReadLine(); var reverser = new Reverser(); var reversedSentence = reverser.ReverseSentence(sentence); Console.WriteLine(reversedSentence); }
public static void Main() { MyProxyClass myProxy = new MyProxyClass(typeof(Reverser)); // The real proxy dynamically creates a transparent proxy. Reverser myReverser = (Reverser)myProxy.GetTransparentProxy(); myReverser.SetString("Hello World!"); Console.WriteLine("The out result is : {0}", myReverser.GetReversedString()); }
private static void Main(string[] args) { var reverser = new Reverser(); while (true) { Console.Write("Enter a word to reverse: "); Console.WriteLine(reverser.Reverse(Console.ReadLine())); } }
public void Reverse_ValidString_ReturnsReversedString() { //Arrange - initialize objects Reverser reverser = new Reverser(); //Act var result = reverser.Reverse("abcdef"); //Assert Assert.AreEqual("fedcba", result); }
public void Reverse_InvalidString_ReturnsNull() { //Arrange - initialize objects Reverser reverser = new Reverser(); //Act var result = reverser.Reverse(null); //Assert Assert.AreEqual(null, result); }
public void TestStringReverse() { var input = "Test this."; var expectedOutput = ".siht tseT"; var reverse = new Reverser(); var output = reverse.ReverseLine(input); Assert.AreEqual(expectedOutput, output); }
public void TestLineOrderReverse() { var path = @"c:\temp\test.txt"; var expectedOutput = File.ReadAllLines(path); var reverse = new Reverser(); var output = reverse.ReverseLineOrder(path); Assert.AreEqual(expectedOutput[0], output[2]); }
public void ReverseAndNot_MaxInt32_ReturnsReversedAndOriginal() { //Arrange - initialize objects Reverser reverser = new Reverser(); //Act var result = reverser.ReverseAndNot(Int32.MaxValue); //Assert Assert.AreEqual("74638474122147483647", result); }
public void ReverseAndNot_ValidInt_ReturnsReversedAndOriginal() { //Arrange - initialize objects Reverser reverser = new Reverser(); //Act var result = reverser.ReverseAndNot(1234); //Assert Assert.That("43211234" == result); }
public void ShouldReverseWordToExpected(string input, string expected) { // Arrange var reverser = new Reverser(input); // Act var result = reverser.Reverse(); // Assert AreEqual(expected, result); }
public void DoStuffWillReverseMessage(Reverser sut, SomeValue value) { // Fixture setup var expectedResult = new string(value.Message.Reverse().ToArray()); // Exercise system var result = sut.DoStuff(value, null); // Verify outcome Assert.Equal(expectedResult, result); // Teardown }
public IActionResult Resultado(Datos data) { //Se crea una instancia de Datos y luego se le manda por parametros el numero a la clase Reverser. //Recordar!! Es una variable var, debido a que da error si se pone como INT, no se puede transformar. var numInverted = new Datos { Numero = Reverser.invertirNum(data.Numero) }; return(View(numInverted)); }
/// <summary> /// 根据产品类别获取产品分页功能 /// </summary> /// <param name="number"></param> /// <param name="pagesize"></param> /// <param name="classid"></param> /// <returns></returns> public static List <ProModel> GetListPageNoByClassID(int number, int pagesize, int classid, int provider) { string strid = ""; GetClassSubAllByClass(classid, ref strid); List <ProModel> list = EispProDAL.GetListPageNoByClassID(number, pagesize, strid, provider, classid); ProModel p = new ProModel(); Reverser <ProModel> reverser = new Reverser <ProModel>(p.GetType(), "F_Sort", ReverserInfo.Direction.DESC); list.Sort(reverser); return(list); }
public void NineMemosBackwords() { //Arrange var word = "Some men interpret nine memos"; var expectedResult = true; var reverserTests = new Reverser(); // Act bool actualResult = reverserTests.ReverserTester(word); // Assert Assert.Equal(expectedResult, actualResult); }
public void Anna() { //Arrange var word = "Anna"; var expectedResult = true; var reverserTests = new Reverser(); // Act bool actualResult = reverserTests.ReverserTester(word); // Assert Assert.Equal(expectedResult, actualResult); }
public void FunnyThings() { //Arrange var word = "I write funny things that make people sad"; var expectedResult = false; var reverserTests = new Reverser(); // Act bool actualResult = reverserTests.ReverserTester(word); // Assert Assert.Equal(expectedResult, actualResult); }
public void StarsBackwords() { //Arrange var word = "Stars"; var expectedResult = false; var reverserTests = new Reverser(); // Act bool actualResult = reverserTests.ReverserTester(word); // Assert Assert.Equal(expectedResult, actualResult); }
public void GiberishBackwords() { //Arrange var word = "O, a kak Uwakov lil vo kawu kakao!"; var expectedResult = true; var reverserTests = new Reverser(); // Act bool actualResult = reverserTests.ReverserTester(word); // Assert Assert.Equal(expectedResult, actualResult); }
IEnumerator Reverse(Word w, int data) { int len = w.bits.Count; List <Bit.BitValue> values = new List <Bit.BitValue>(); for (int k = 0; k < len; k++) { values.Add(((data >> k) & 1) > 0 ? Bit.BitValue.ONE : Bit.BitValue.ZERO); } Reverser reverser = new Reverser(); yield return(reverser.Go(w.bits, values)); }
public ActionResult List(DataTable_Model param) { var list = Session["ScanValid"] != null ? (List <Product_Model>)Session["ScanValid"] : new List <Product_Model>(); var count = list.Count(); if (param.sSearch != null && param.sSearch.Length > 0) { list = list.FindAll(m => (m.ProductNumber + m.Color + m.Size).Contains(param.sSearch)); } Reverser <Product_Model> reverser; var columns = param.sColumns.Split(','); if (columns.Length > 0) { var sortColumn = columns[param.iSortCol_0]; if (sortColumn != null) { var sortDirection = param.sSortDir_0; if (sortDirection == "asc") { reverser = new Reverser <Product_Model>((new Product_Model()).GetType(), sortColumn, ReverserInfo.Direction.ASC); } else { reverser = new Reverser <Product_Model>((new Product_Model()).GetType(), sortColumn, ReverserInfo.Direction.DESC); } list.Sort(reverser); } } var data = param.iDisplayLength > 0 ? list.Skip(param.iDisplayStart).Take(param.iDisplayLength) : list.Skip(param.iDisplayStart); return(Json(new { sEcho = param.sEcho, iDisplayStart = param.iDisplayStart, iTotalRecords = count, iTotalDisplayRecords = count, aaData = data }, JsonRequestBehavior.AllowGet)); }
private static void Sort(ref string[] students, ref int[] marks) { bool flag = true; IComparer myComparer = new Reverser(); while (flag) { int choose = GetInt("\nOperation:\n" + "1. Print by name (ascending)\n" + "2. Print by name (descending)\n" + "3. Print by mark (ascending)\n" + "4. Print by mark (descending)\n" + "\nEnter number operation: "); switch (choose) { case 1: Array.Sort(students, marks); flag = false; break; case 2: Array.Sort(students, marks, myComparer); flag = false; break; case 3: Array.Sort(marks, students); flag = false; break; case 4: Array.Sort(marks, students, myComparer); flag = false; break; default: Console.WriteLine("\n" + MSG_ERROR_CORRECT_OPERATION); break; } } }
static void Main(string[] args) { Reverser reverser = new Reverser(); char s = 's'; Console.WriteLine(s); Char.ToUpper(s); // Console.WriteLine(s); Console.WriteLine(reverser.StringReverser("HEllo")); //string[] stringArray= reverser.StringReverser("hej test"); DateTime d = new DateTime(2017, 12, 31); int weekNr = WeekOfYearISO8601(d); int WeekOfYearISO8601(DateTime date) { var day = (int)CultureInfo.CurrentCulture.Calendar.GetDayOfWeek(date); return(CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date.AddDays(4 - (day == 0 ? 7 : day)), CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday)); } var currentCulture = CultureInfo.CurrentCulture; int weekNo = currentCulture.Calendar.GetWeekOfYear( d, currentCulture.DateTimeFormat.CalendarWeekRule, currentCulture.DateTimeFormat.FirstDayOfWeek); Console.WriteLine(weekNr); Console.WriteLine(weekNo); Console.ReadLine(); //foreach (var substring in stringArray) //{ // Console.WriteLine(substring); //} //Console.ReadLine(); }
public List<SearchRecord> ExecuteFastSearch(QueryInfo info, out Query query, out Dictionary<string,List<int>> statistics, bool highlight) { List<SearchRecord> recordList; Utils.SearchUtil.SetSearchSettings(sourceList, indexList,fileSet, dictSet, searchd); Utils.SearchUtil.SetQueryInfo(info); if (highlight) { recordList = Utils.SearchUtil.HighLightSearch(out query); if (string.IsNullOrEmpty(info.IndexNames)) { recordList.AddRange(Utils.SearchUtil.HighLightSearchFile()); } } else { recordList = Utils.SearchUtil.SearchEx(out query); if (string.IsNullOrEmpty(info.IndexNames)) { recordList.AddRange(Utils.SearchUtil.SearchFile()); } } Reverser<SearchRecord> reverser = new Reverser<SearchRecord>("ISUtils.Common.SearchRecord", "Score", ReverserInfo.Direction.DESC); recordList.Sort(reverser); SearchRecord.Direction = ReverserInfo.Direction.DESC; statistics = new Dictionary<string, List<int>>(); for (int i=0; i<recordList.Count; i++) { if (statistics.ContainsKey(recordList[i].Caption)) { statistics[recordList[i].Caption].Add(i); } else { List<int> posList=new List<int>(); posList.Add(i); statistics.Add(recordList[i].Caption, posList); } } return recordList; }
public void SetUp() { _reverser = new Reverser(); }
public void UpdateLayout(Panel panel_user) { List<FriendControl> listFriend1 = new List<FriendControl>(); FriendControl item = null; for (int i = 0; i < panel_user.Controls.Count; i++) { //panel_user.Controls[i].Location = new Point(1, 56 * i); item = (FriendControl)panel_user.Controls[i]; item.FCType = this.FCType; item.Height = ItemHeight + 1; listFriend1.Add(item); } if (panel_user.Controls.Count > 0) { Reverser<FriendControl> reverser1 = new Reverser<FriendControl>(item.GetType(), "OnLine", ReverserInfo.Direction.DESC); listFriend1.Sort(reverser1); if (isRefSort) { reverser1 = new Reverser<FriendControl>(item.GetType(), "OnLine", ReverserInfo.Direction.DESC); listFriend1.Sort(reverser1); } } isRefSort = true; panel_user.Controls.Clear(); for (int i = 0; i < listFriend1.Count; i++) { listFriend1[i].Location = new Point(1, (ItemHeight+1) * i); panel_user.Controls.Add(listFriend1[i]); } panel_user.Height = (ItemHeight + 1) * panel_user.Controls.Count; System.GC.Collect(); }
private void CreateSubMenu(List<tsysmenuconfig> lstAllMenu, ToolStripMenuItem parentMenu, MES_MenuType menuType, EventHandler handler) { List<tsysmenuconfig> menus = GetSubMenuList(lstAllMenu, parentMenu.Name, menuType.ToString()).ToList(); Reverser<tsysmenuconfig> reverser = new Reverser<tsysmenuconfig>(typeof(tsysmenuconfig), "sortno", ReverserInfo.Direction.ASC); menus.Sort(reverser); bool separatorFlag = false; foreach (tsysmenuconfig menuconfig in menus) { if (menuconfig.menuitemname.Trim().Equals("-")) { if (!separatorFlag) { ToolStripSeparator toolStripSeparator = new ToolStripSeparator(); toolStripSeparator.Name = menuconfig.menuitemid; parentMenu.DropDownItems.Add(toolStripSeparator); separatorFlag = true; } } else { if (CheckFunctionPrivilege(menuconfig.funcid, Parameter.USER_FUNCTIONS)) { ToolStripMenuItem menu = new ToolStripMenuItem(); menu.Name = menuconfig.menuitemid; if (menuconfig.resourceid != null && !menuconfig.resourceid.Trim().Equals("")) { menu.Text = UtilCulture.GetString(menuconfig.resourceid); } else { menu.Text = menuconfig.menuitemname; } if (menuconfig.menuicon != null && !menuconfig.menuicon.Trim().Equals("")) { menu.Image = (System.Drawing.Image)global::GENLSYS.MES.WinPAD.Properties.Resources.ResourceManager.GetObject(menuconfig.menuicon); } if (menuconfig.menuitemurl != null && !menuconfig.menuitemurl.Trim().Equals("")) { menu.Tag = menuconfig.menuitemurl; menu.Click += handler; } //menu.Enabled = CheckFunctionPrivilege(menuconfig.funcid, Parameter.USER_FUNCTIONS); //if (menu.Enabled == true) //{ // CreateSubMenu(lstAllMenu, menu, menuType, handler); //} CreateSubMenu(lstAllMenu, menu, menuType, handler); parentMenu.DropDownItems.Add(menu); separatorFlag = false; } } } }
public void CreateMenu(MenuStrip menuStrip, MES_MenuType menuType, EventHandler handler) { List<tsysmenuconfig> lstAllMenu = GetAllMenu(); List<tsysmenuconfig> menus = GetTopMenuList(lstAllMenu, menuType.ToString()).ToList(); Reverser<tsysmenuconfig> reverser = new Reverser<tsysmenuconfig>(typeof(tsysmenuconfig), "sortno", ReverserInfo.Direction.DESC); menus.Sort(reverser); foreach (tsysmenuconfig menuconfig in menus) { ToolStripMenuItem topMenu = new ToolStripMenuItem(); topMenu.Name = menuconfig.menuitemid; if (menuconfig.resourceid != null && !menuconfig.resourceid.Trim().Equals("")) { topMenu.Text = UtilCulture.GetString(menuconfig.resourceid); } else { topMenu.Text = menuconfig.menuitemname; } if (menuconfig.menuicon != null && !menuconfig.menuicon.Trim().Equals("")) { topMenu.Image = (System.Drawing.Image)global::GENLSYS.MES.WinPAD.Properties.Resources.ResourceManager.GetObject(menuconfig.menuicon); } topMenu.Enabled = CheckFunctionPrivilege(menuconfig.funcid, Parameter.USER_FUNCTIONS); if (topMenu.Enabled == true) { CreateSubMenu(lstAllMenu, topMenu, menuType, handler); } menuStrip.Items.Insert(0, topMenu); } }