public void Corrupt(Be.Windows.Forms.IByteProvider prov, long start, long end) { for (long i = start; i < end; ++i) { prov.WriteByte(i, CorruptSectionFixedValue.ApplyOperationToByte(prov.ReadByte(i), (byte)_rand.Next(_low_byte, _high_byte), _op)); } }
public void Corrupt(Be.Windows.Forms.IByteProvider prov, long start, long end) { if (_data.Length > 0) { int data_pos = 0; for (long i = start; i < end; ++i) { prov.WriteByte(i, ApplyOperationToByte(prov.ReadByte(i), _data[data_pos], _op)); data_pos = (data_pos + 1) % _data.Length; } } }
public void ShouldFindMaxToRevision() { ((GitRevisionId)_comparer.FindMaxToRevision(_revisionRanges)).Time.Should( Be.EqualTo(((GitRevisionId)_revisionRanges[2].ToChangeset).Time)); }
public void ShouldDefiniteNames() { var txtString = "Hello! How are you?Are going to another place, Nikitos? Ok...Good buy.No..."; var text = new Termins.Text(txtString, _analyzerManager); var result = text.Sentenses.ToList(); result.SelectMany(c => c.Words.Where(x => x.IsName())).First().Value.Should(Be.EqualTo("Nikitos")); }
public void ShouldFindMinFromRevision() { ((GitRevisionId)_comparer.FindMinFromRevision(_revisionRanges)).Time.Should( Be.EqualTo(((GitRevisionId)_revisionRanges[3].FromChangeset).Time)); }
public static void One <T>(this Be <T> be) { be.Equals(1); }
protected void CheckMappingsItemsCountBase() { var mappingContainer = Context.CommandResponse.ResponseData.Deserialize <Mappings>(); Source.ThirdPartyItems.Count.Should(Be.EqualTo(GetFromMappings(mappingContainer).Count)); }
protected void Page_Load(object sender, EventArgs e) { var Ten = Request["Ten"]; var Ho = Request["Ho"]; var Alias = Request["Alias"]; var GioiTinh = Request["GioiTinh"]; var NgaySinh = Request["NgaySinh"]; var NgayDuSinh = Request["NgayDuSinh"]; var MangThai = Request["MangThai"]; var CanNangKhiSinh = Request["CanNang"]; var Nick = Request["Nick"]; var ID = Request["ID"]; var Css = Request["css"]; var KhongChiaSe = Request["KhongChiaSe"]; Be Item; switch (subAct) { case "add": #region add Item = new Be(); Item.Alias = Alias; Item.MangThai = MangThai == "1"; Item.ID = Guid.NewGuid(); if(Item.MangThai) { if (!string.IsNullOrEmpty(NgayDuSinh)) { Item.NgayDuSinh = Convert.ToDateTime(NgayDuSinh, new CultureInfo("vi-Vn")); } } else { if (!string.IsNullOrEmpty(NgaySinh)) { Item.NgaySinh = Convert.ToDateTime(NgaySinh, new CultureInfo("vi-Vn")); } Item.GioiTinh = Convert.ToBoolean(GioiTinh); if (!string.IsNullOrEmpty(CanNangKhiSinh)) { Item.CanNangKhiSinh = Convert.ToInt32(CanNangKhiSinh); } Item.Ten = Ten; Item.Ho = Ho; Item.Alias = Alias; } Item.NgayTao = DateTime.Now; Item.Username = Security.Username; Item.Khoa = false; Item.KhongChiaSe = false; Item = BeDal.Insert(Item); rendertext(Item.ID.ToString()); break; #endregion case "save": #region save Item = BeDal.SelectById(new Guid(ID)); Item.Alias = Alias; Item.MangThai = MangThai == "1"; if (Item.MangThai) { if (!string.IsNullOrEmpty(NgayDuSinh)) { Item.NgayDuSinh = Convert.ToDateTime(NgayDuSinh, new CultureInfo("vi-Vn")); } } else { if (!string.IsNullOrEmpty(NgaySinh)) { Item.NgaySinh = Convert.ToDateTime(NgaySinh, new CultureInfo("vi-Vn")); } Item.GioiTinh = Convert.ToBoolean(GioiTinh); if (!string.IsNullOrEmpty(CanNangKhiSinh)) { Item.CanNangKhiSinh = Convert.ToInt32(CanNangKhiSinh); } Item.Ten = Ten; Item.Ho = Ho; Item.Alias = Alias; } Item = BeDal.Update(Item); rendertext(Item.ID.ToString()); break; #endregion case "doiAnh": #region Doi anh if(Security.IsAuthenticated()) { var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(Request.Files[0].InputStream, key); if(img.Width < 930) rendertext("930"); img.Resize(930); img.Save(Server.MapPath("~/lib/up/avatar/") + key + img.Ext); Item = BeDal.SelectById(new Guid(ID)); Item.Cover = key + img.Ext; BeDal.Update(Item); rendertext(key + img.Ext); } break; #endregion case "SuaNick": #region SuaNick if (Security.IsAuthenticated()) { var be = BeDal.SelectByNick(DAL.con(), Nick, Security.Username); var beId = BeDal.SelectById(new Guid(ID)); if(be.ID != Guid.Empty && be.ID!=beId.ID) { rendertext("0"); } else { beId.Nick = Nick.ToLower(); BeDal.Update(beId); rendertext("1"); } } break; #endregion case "moveCover": #region moveCover if (Security.IsAuthenticated()) { Item = BeDal.SelectById(new Guid(ID)); if (Item.Username == Security.Username) { Item.CoverCss = Css; BeDal.Update(Item); } rendertext(Css); } break; #endregion case "UpdateChiaSe": #region moveCover if (Security.IsAuthenticated()) { Item = BeDal.SelectById(new Guid(ID)); if (Item.Username==Security.Username) { Item.KhongChiaSe = Convert.ToBoolean(KhongChiaSe); BeDal.Update(Item); } } break; #endregion case "doiAvatar": #region Doi Avatar if (Security.IsAuthenticated()) { var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(Request.Files[0].InputStream, key); img.Resize(400); img.Save(Server.MapPath("~/lib/up/avatar/") + key + img.Ext); Item = BeDal.SelectById(new Guid(ID)); Item.Anh = key + img.Ext; BeDal.Update(Item); rendertext(key + img.Ext); } break; #endregion default: break; } }
public void UsersShouldBeMapped(int mappedUsersAmount) { var userMapping = _response.ResponseData.Deserialize <AutomapVcsToTpUsersCommandResponse>().UserLookups; userMapping.Count.Should(Be.EqualTo(mappedUsersAmount)); }
public void AssertUserMapping(string svnuser, string tpuser) { var userMapping = _response.ResponseData.Deserialize <AutomapVcsToTpUsersCommandResponse>().UserLookups; userMapping[svnuser].Name.Should(Be.EqualTo(tpuser)); }