public void DistinctValueTest() //Value中无重复的Dictionary { //Test1 Dictionary <int, int> dic1 = new Dictionary <int, int>(); dic1.Add(1, 1); dic1.Add(2, 2); dic1.Add(3, 1); var dicResult1 = GenericTool.DistinctValue(dic1); Assert.AreEqual(dicResult1.Count, 2); //Test2 Test t = new Test() { Id = "1" }; Test t1 = t; Test t2 = t; Dictionary <int, object> dic2 = new Dictionary <int, object>(); dic2.Add(1, t1); dic2.Add(2, new Test() { Id = "2" }); dic2.Add(3, t2); var dicResult2 = GenericTool.DistinctValue(dic2); Assert.AreEqual(dicResult2.Count, 2); }
public override Item getOne() { GenericTool genericTool = new GenericTool(base.BaseName, description, base.UpgradeLevel, base.InitialParentTileIndex, base.IndexOfMenuItemView); genericTool._GetOneFrom(this); return(genericTool); }
internal static GenericTool GetPaintBrushTool() { var paintBrush = new GenericTool(_helper.Translation.Get("tools.name.paint_brush"), _helper.Translation.Get("tools.description.paint_brush"), -1, 6, 6); paintBrush.modData[AlternativeTextures.PAINT_BRUSH_FLAG] = null; return(paintBrush); }
internal static GenericTool GetScissorsTool() { var scissors = new GenericTool(_helper.Translation.Get("tools.name.scissors"), _helper.Translation.Get("tools.description.scissors"), -1, 6, 6); scissors.modData[AlternativeTextures.SCISSORS_FLAG] = true.ToString(); return(scissors); }
internal static GenericTool GetPaintBucketTool() { var paintBucket = new GenericTool(_helper.Translation.Get("tools.name.paint_bucket"), _helper.Translation.Get("tools.description.paint_bucket"), -1, 6, 6); paintBucket.modData[AlternativeTextures.PAINT_BUCKET_FLAG] = true.ToString(); return(paintBucket); }
internal static GenericTool GetHandMirrorTool() { var handMirror = new GenericTool(_helper.Translation.Get("tools.name.hand_mirror"), _helper.Translation.Get("tools.description.hand_mirror"), -1, 6, 6); handMirror.modData[ModDataKeys.HAND_MIRROR_FLAG] = true.ToString(); return(handMirror); }
public void GetPartialTest() { List <string> list = new List <string>(); list.Add("111"); list.Add("123"); list.Add("222"); var resultList = GenericTool.GetPartial(list, new Func <string, bool>((x) => { return(x.Contains("1")); })); Assert.AreEqual(resultList.Count, 2); }
public void ToListTest() { List <string> list = new List <string>(); list.Add("123"); var resultList = GenericTool.ToList(list, new Func <string, int>((x) => { return(int.Parse(x)); })); Assert.AreEqual(resultList[0], 123); var resultList2 = GenericTool.ToList(null, new Func <string, int>((x) => { return(int.Parse(x)); })); Assert.AreEqual(resultList2, null); }
public void GetCellValuebyPartConlumeNameTest() { DataTable table = new DataTable("table"); table.Columns.Add("Name"); table.Columns.Add("Id"); table.Columns.Add("Year"); DataRow row = table.NewRow(); row[0] = "name1"; row[1] = "id1"; row[2] = "year1"; table.Rows.Add(row); var result = GenericTool.GetCellValuebyPartConlumeName(row, "Id"); Assert.AreEqual(result, "id1"); var result2 = GenericTool.GetCellValuebyPartConlumeName(row, "Id2"); Assert.AreEqual(result2, string.Empty); }