public void Last_Name_Generator() { ILastNameGenerator lnamegenerator = new LastNameGenerator(); string generatedlastname = lnamegenerator.Generate(random); Assert.IsNotNull(generatedlastname); }
public void LastNameGeneratorTest() { IGenerator <string> lng = new LastNameGenerator(); var lastname = (string)lng.Generate(); Assert.IsNotNull(lastname); }
public void LastNameGeneratorWithStringOverride() { ILastNameGenerator lnamegenerator = new LastNameGenerator(); string generatedlastname = lnamegenerator.Generate(random, "Smith"); Assert.IsNotNull(generatedlastname); Assert.AreEqual("Smith", generatedlastname); }
public void EmailAddressGenerator() { IEmailAddressGenerator emailaddressgenerator = new EmailAddressGenerator(); IFirstNameGenerator fname = new FirstNameGenerator(); ILastNameGenerator lname = new LastNameGenerator(); string emailaddress = emailaddressgenerator.Generate(random, fname, lname); Assert.IsNotNull(emailaddress); Assert.IsTrue(IsEmailAddressValid(emailaddress)); }
public void EmailAddressGeneratorStringOverride() { IEmailAddressGenerator emailaddressgenerator = new EmailAddressGenerator(); IFirstNameGenerator fname = new FirstNameGenerator(); ILastNameGenerator lname = new LastNameGenerator(); string emailaddress = emailaddressgenerator.Generate(random, fname, lname, "*****@*****.**"); Assert.IsNotNull(emailaddress); Assert.AreEqual("*****@*****.**", emailaddress); }
public void LastNameGeneratorAttributeMap() { ILastNameGenerator lnamegenerator = new LastNameGenerator(); AttributeMap attmap = new AttributeMap { GeneratorDefaultValue = "Smith" }; string generatedlastname = lnamegenerator.Generate(random, attmap); Assert.IsNotNull(generatedlastname); Assert.AreEqual("Smith", generatedlastname); }
public void EmailAddressGeneratorAttributeMap() { IEmailAddressGenerator emailaddressgenerator = new EmailAddressGenerator(); IFirstNameGenerator fname = new FirstNameGenerator(); ILastNameGenerator lname = new LastNameGenerator(); AttributeMap attmap = new AttributeMap { GeneratorDefaultValue = "*****@*****.**" }; string emailaddress = emailaddressgenerator.Generate(random, fname, lname, attmap); Assert.IsNotNull(emailaddress); Assert.IsTrue(IsEmailAddressValid(emailaddress)); }
protected override void Seed(IdentityContext context) { var roleMgr = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context)); var roleResult1 = roleMgr.Create(new IdentityRole("Admin")); var roleResult2 = roleMgr.Create(new IdentityRole("Employee")); var scottea = new ApplicationUser { UserName = "******", Email = "*****@*****.**" }; var scotte = new ApplicationUser { UserName = "******", Email = "*****@*****.**" }; var scottc = new ApplicationUser { UserName = "******", Email = "*****@*****.**" }; //scottc is a contractor, not in the employee directory, but has a login to access it var userMgr = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context)); var result1 = userMgr.CreateAsync(scottea, "scottea").Result; var result2 = userMgr.CreateAsync(scotte, "scotte").Result; var result3 = userMgr.CreateAsync(scottc, "scottc").Result; //attach users to roles userMgr.AddToRole <ApplicationUser, string>(scottea.Id, "Admin"); userMgr.AddToRole <ApplicationUser, string>(scottea.Id, "Employee"); userMgr.AddToRole <ApplicationUser, string>(scotte.Id, "Employee"); //add employees? Employee scotteaEmp = new Employee { FirstName = "Scott", LastName = "Employee-Admin", Email = "*****@*****.**", JobTitle = "Master Employee", Location = Location.Austin, Phone = "5121234567" }; Employee scotteEmp = new Employee { FirstName = "Scott", LastName = "Employee", Email = "*****@*****.**", JobTitle = "Software Engineer", Location = Location.Dallas, Phone = "4257654321" }; EmployeeContext employeeCtx = new EmployeeContext(); employeeCtx.Employees.Add(scotteaEmp); employeeCtx.Employees.Add(scotteEmp); employeeCtx.SaveChanges(); Random random = new Random(); string[] titles = new string[] { "Software Engineer", "DevOps Engineer", "Business Analyst", "Scrum Master", "QA", "SDET", "Controller", "BI Developer", null, null }; if (_count > 0) { for (int i = 1; i <= _count; i++) { string firstName = new FirstNameGenerator().Generate(); string lastName = new LastNameGenerator().Generate(); string email = firstName + lastName + i.ToString() + "@acme.com"; ApplicationUser user = new ApplicationUser { UserName = email, Email = email }; var result = userMgr.CreateAsync(user, firstName + "_pass").Result; userMgr.AddToRole <ApplicationUser, string>(user.Id, "Employee"); //everyone is going to be employee except scott contractor above if (i % 5 == 0) { userMgr.AddToRole <ApplicationUser, string>(user.Id, "Admin"); } Employee emp = new Employee(); emp.FirstName = firstName; emp.MiddleInitial = (i % 2 == 0) ? "M" : null; emp.LastName = lastName; emp.JobTitle = titles[random.Next(0, 9)]; emp.Email = email; if ((i % 2 == 0) || (i % 3 == 0)) { emp.Phone = new AmericanPhoneGenerator().Generate().Replace("(", "").Replace(")", "").Replace("-", ""); } if (i % 3 == 0) { emp.Location = Location.Austin; } else if (i % 2 == 0) { emp.Location = Location.Dallas; } else if (i % 5 == 0) { emp.Location = Location.Houston; } employeeCtx.Employees.Add(emp); } employeeCtx.SaveChanges(); } base.Seed(context); }
private void loadAllRoom() { //flowLayoutPanel1.SuspendLayout(); LastNameGenerator genName = new LastNameGenerator(); // DataTable RoomTbl = new DataTable(); //sxbillingDataSet.roomDataTable RoomTbl = new sxbillingDataSet.roomDataTable(); //DataLayer.BusinessLogic DataStore = new DataLayer.BusinessLogic(); //DataStore.Connect(); //sxbillingDataSetTableAdapters.roomTableAdapter RoomTableAdapter = new sxbillingDataSetTableAdapters.roomTableAdapter(); //int art4 = RoomTbl.Count; //sxbillingDataSet.roomDataTable RoomTbl = new sxbillingDataSet.roomDataTable(); //RoomTableAdapter.Fill(RoomTbl); DataTable RoomTbl = BusinessLogicBridge.DataStore.getDataDashBoard(); PanelControl art = new PanelControl(); flowLayoutPanel1.SuspendLayout(); this.DoubleBuffered = true; for (int i = 0; i < RoomTbl.Rows.Count; i++) { //roomType.Adapter. //roomType.GetData(); //DevExpress.XtraEditors.PanelControl Roombox = new DevExpress.XtraEditors.PanelControl(); RoomItemRev2 Roombox = new RoomItemRev2(); Roombox.SuspendLayout(); Roombox.Width = 145; Roombox.Height = 110; Random icox = new Random(); int rdx = icox.Next(0, 6); //Roombox.BackgroundImageLayout = ImageLayout.Center; //Roombox.BackgroundImage = imageCollection2.Images[rdx]; Color CustomGreen = Color.FromArgb(164, 246, 92); Color CustomRed = Color.FromArgb(255, 108, 88); Color CustomWhite = Color.FromArgb(240, 240, 240); Color CustomYellow = Color.FromArgb(254, 248, 91); Color StatusColor = CustomWhite; Roombox.labelControl2.Text = "ว่าง"; //if (rdx == 0) { // StatusColor = CustomWhite; // // Roombox.labelControl2.Text = "ว่าง"; // Roombox.pictureEdit4.Image = imageCollection2.Images[3]; //} //if (rdx == 2) //{ // StatusColor = CustomGreen; // // Roombox.labelControl2.Text = "เช่า"; // Roombox.pictureEdit4.Image = imageCollection2.Images[0]; //} //if (rdx == 3) //{ // StatusColor = CustomRed; // //Roombox.labelControl2.Text = "แจ้งย้ายออก"; // Roombox.pictureEdit4.Image = imageCollection2.Images[1]; //} //if (rdx == 4) //{ // StatusColor = CustomYellow; // // Roombox.labelControl2.Text = "จอง"; // Roombox.pictureEdit1.Image = imageCollection3.Images[1]; // Roombox.pictureEdit4.Image = imageCollection2.Images[2]; //} //if (rdx > 4) //{ // StatusColor = CustomGreen; // //Roombox.labelControl2.Text = "เช่า"; // Roombox.pictureEdit4.Image = imageCollection2.Images[0]; //} Roombox.labelControl2.Text = ""; Roombox.labelControl6.Text = (string)Convert.ToString(20.01 * rdx); //Roombox.label1.Autosize = false; int roomStutus = 1; roomStutus = Convert.ToInt32(RoomTbl.Rows[i]["room_status"]); if (roomStutus == 1) { Roombox.panel1.BackColor = CustomWhite; Roombox.pictureBox1.Image = imageCollection2.Images[0]; } else if (roomStutus == 2) { Roombox.panel1.BackColor = CustomGreen; Roombox.pictureBox1.Image = imageCollection2.Images[1]; } else if (roomStutus == 3) { Roombox.panel1.BackColor = CustomYellow; Roombox.pictureBox1.Image = imageCollection2.Images[2]; } else if (roomStutus == 4) { Roombox.panel1.BackColor = CustomRed; Roombox.pictureBox1.Image = imageCollection2.Images[3]; } int meterStatus = 1; meterStatus = Convert.ToInt32(RoomTbl.Rows[i]["meter_status"]); if (meterStatus == 0) { Roombox.pictureBox2.Image = imageCollection4.Images[1]; } int cutoffStatus = 1; cutoffStatus = Convert.ToInt32(RoomTbl.Rows[i]["meter_cut"]); if (cutoffStatus == 0) { Roombox.pictureBox3.Image = imageCollection3.Images[1]; } Roombox.labelControl1.Text = (string)Convert.ToString(RoomTbl.Rows[i]["room_label"]); //Roombox.CaptionImage = imageCollection1.Images[rdx]; //Roombox.CaptionImagePadding = new System.Windows.Forms.Padding(-10, 0, 0, 0); //Roombox.BackColor = Color.Aqua; // Roombox.BackColor = Color.DarkBlue; // Roombox.Location = new System.Drawing.Point(4, 4); //Roombox.Name = "groupControl1"; //Roombox.Size = new System.Drawing.Size(200, 100); Roombox.TabIndex = 0; // Roombox.Appearance.ForeColor = Color.DarkKhaki; ; //Roombox.Text = "groupControl1"; //Roombox.Text = 30; // Roombox.AppearanceCaption.ForeColor = Color.Red; // Roombox.AppearanceCaption.BackColor2 = Color.Plum; ; //Roombox.Text = "ห้องหมายเลข: R40" + i+ " สถานะ: ไม่ว่าง"; RoomItem item = new RoomItem(genName.GetLastName() + " " + genName.GetLastName(), "แอร์", "ไม่ว่าง", "20.0", "500.0", "400.0"); Roombox.Controls.Add(item); // xtraScrollableControl1.Controls.Add(RoomBox); Roombox.ResumeLayout(); //groupControl1.Name = "Room" + i; //groupControl1.Text = "Room" + i; flowLayoutPanel1.Controls.Add(Roombox); //art.Controls.Add(Roombox); } //flowLayoutPanel1.Visible = true; //flowLayoutPanel1.Controls.AddRange(new Control[] { art }); flowLayoutPanel1.ResumeLayout(); }
public void EmailAddressGenerator() { IEmailAddressGenerator emailaddressgenerator = new EmailAddressGenerator(); IFirstNameGenerator fname=new FirstNameGenerator(); ILastNameGenerator lname=new LastNameGenerator(); string emailaddress=emailaddressgenerator.Generate(random,fname,lname); Assert.IsNotNull(emailaddress); Assert.IsTrue(IsEmailAddressValid(emailaddress)); }
public void LastNameGeneratorTest() { IGenerator<string> lng = new LastNameGenerator(); var lastname = (string) lng.Generate(); Assert.IsNotNull(lastname); }