public void TestFishingBoatCatchPhrase() { FishingBoat fishingBoat = new FishingBoat(); string phrase = fishingBoat.CatchPhrase(); Assert.Equal("A day of fishing is better than a day at work", phrase); }
private void OnLVMouseDown(object sender, MouseEventArgs e) { txtBoatName.Text = ""; txtOwnerName.Text = ""; txtLandingSite.Text = ""; txtHeight.Text = ""; txtLength.Text = ""; txtWidth.Text = ""; txtEngineName.Text = ""; txtHp.Text = ""; var item = lvBoats.HitTest(e.X, e.Y).Item; if (item != null) { FishingBoat fb = _fishingBoats[item.Name]; txtBoatName.Text = fb.BoatName; txtOwnerName.Text = fb.OwnerName; txtLandingSite.Text = fb.LandingSite.LandingSiteName; txtLength.Text = fb.BoatLength != null?fb.BoatLength.ToString() : ""; txtWidth.Text = fb.BoatWidth != null?fb.BoatWidth.ToString() : ""; txtHeight.Text = fb.BoatHeight != null?fb.BoatHeight.ToString() : ""; txtEngineName.Text = fb.Engine != null ? fb.Engine : ""; txtHp.Text = fb.EngineHp != null?fb.EngineHp.ToString() : ""; } }
static void FishingBoatMessage() { FishingBoat fishingBoat = new FishingBoat(); string phrase = fishingBoat.Description(); Console.WriteLine(phrase); phrase = fishingBoat.UsedFor(); Console.WriteLine(phrase); phrase = fishingBoat.CatchPhrase(); Console.WriteLine(phrase); Console.WriteLine(" "); }
static void Main() { var car1 = new HondaCivic(); var car2 = new BMW(true); var car3 = new NissanLeaf(true); var Cars = new List <Car>(); Cars.Add(car1); Cars.Add(car2); Cars.Add(car3); foreach (var car in Cars) { car.Driving(); } var plane1 = new WrightFlyer(); var plane2 = new SupermarineSpitfire(); var plane3 = new BlériotXI(); var planes = new List <Aircraft>(); planes.Add(plane1); planes.Add(plane2); planes.Add(plane3); foreach (var plane in planes) { plane.Flying(); } var boat1 = new FishingBoat(); var boat2 = new Canoe(); var boat3 = new HouseBoat(); var boats = new List <Watercraft>(); boats.Add(boat1); boats.Add(boat2); boats.Add(boat3); foreach (var boat in boats) { boat.Driving(); } }
private void OnButtonClick(object sender, EventArgs e) { switch (((Button)sender).Name) { case "btnClose": Close(); break; case "btnAdd": if (txtBoatName.Text.Length > 0 && TreeLevel == "landing_site") { Guid guid = Guid.NewGuid(); FishingBoat fb = new FishingBoat(guid, LandingSite, txtBoatName.Text, txtOwnerName.Text); if (txtHeight.Text.Length > 0 && txtWidth.Text.Length > 0 && txtLength.Text.Length > 0) { fb.Dimension(double.Parse(txtWidth.Text), Double.Parse(txtHeight.Text), double.Parse(txtLength.Text)); } fb.Engine = txtEngineName.Text; if (txtHp.Text.Length > 0) { fb.EngineHp = double.Parse(txtHp.Text); } if (_fishingBoats.Add(fb)) { lvBoats.Items.Add(fb.BoatGuid.ToString(), fb.BoatName, null); } } else { MessageBox.Show("Name of boat must be provided", "Validation error", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case "btnRemove": break; } }