public void HakenAusTest() { // arrange Kran kran = new Kran(); Panel haken = new Panel(); haken.Size = new System.Drawing.Size(0, 0); // act kran.HakenAus(haken); // assert Assert.AreEqual(-10, haken.Size.Height); }
public void KranEinTest() { // arrange Kran kran = new Kran(); Panel haken = new Panel(); haken.Size = new System.Drawing.Size(0, 0); haken.Location = new System.Drawing.Point(20, 20); Panel arm = new Panel(); arm.Size = new System.Drawing.Size(50, 50); arm.Location = new System.Drawing.Point(10, 10); Panel basi = new Panel(); basi.Size = new System.Drawing.Size(50, 50); basi.Location = new System.Drawing.Point(50, 50); Panel high = new Panel(); high.Size = new System.Drawing.Size(100, 10); high.Location = new System.Drawing.Point(10, 10); // act kran.KranEin(basi, arm, haken, high); // assert Assert.AreEqual(20, haken.Location.X); Assert.AreEqual(30, haken.Location.Y); Assert.AreEqual(10, arm.Location.X); Assert.AreEqual(20, arm.Location.Y); Assert.AreEqual(50, basi.Location.X); Assert.AreEqual(50, basi.Location.Y); Assert.AreEqual(10, high.Location.X); Assert.AreEqual(20, high.Location.Y); Assert.AreEqual(0, high.Height); Assert.AreEqual(100, high.Width); }
public void ArmAusTest() { // arrange Kran kran = new Kran(); Panel haken = new Panel(); Panel arm = new Panel(); haken.Size = new System.Drawing.Size(0, 0); haken.Location = new System.Drawing.Point(20, 20); arm.Size = new System.Drawing.Size(50, 50); arm.Location = new System.Drawing.Point(10, 10); // act kran.ArmAus(arm, haken); // assert Assert.AreEqual(10, haken.Location.X); Assert.AreEqual(20, haken.Location.Y); Assert.AreEqual(60, arm.Size.Width); Assert.AreEqual(50, arm.Size.Height); Assert.AreEqual(0, arm.Location.X); Assert.AreEqual(10, arm.Location.Y); }
protected void Button_Kran_Speichern_Click(object sender, EventArgs e) { DatabaseDataContext d = new DatabaseDataContext(); if (kran_neu) { Kran k = new Kran() { Id = Convert.ToInt32(TextBox_Kran_Nr.Text) }; d.Kran.InsertOnSubmit(k); } else { Kran k = new Kran() { Id = Convert.ToInt32(TextBox_Kran_Nr.Text) }; d.Kran.InsertOnSubmit(k); var ber = from ka in d.Bereich where ka.Id_Kran == kran_nr select ka; foreach (var Bereich in ber) { Bereich.Id_Kran = Convert.ToInt32(TextBox_Kran_Nr.Text); } //kra.First().Id_Kran = Convert.ToInt32(TextBox_Kran_Nr.Text); var kra = from kr in d.Kran where kr.Id == kran_nr select kr; d.Kran.DeleteAllOnSubmit(kra); } try { d.SubmitChanges(); } catch (Exception) { //... } TextBox_Kran_Nr.Enabled = false; Button_Kran_Löschen.Enabled = true; Button_Bereich_Neu.Enabled = true; GridView_Kran_Refresh(); }