public void AddRoom_newRoom_ReturnRoomIsAdded() { var expected = new Pool("pool"); bool isAdded = room.Add(expected); Assert.IsTrue(isAdded); }
public void AddToken(bool paused) { // Arrange var place = new Place(); var dummy = new DummyToken(); IToken raised = null; place.TokenAdded += (sender, token) => raised = token; // Act if (paused) { place.Pause(); } place.Add(dummy); // Assert if (paused) { Assert.IsNull(raised); } else { Assert.AreEqual(dummy, raised); } }
private void gMap_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { double lat = gMap.FromLocalToLatLng(e.X, e.Y).Lat; double lng = gMap.FromLocalToLatLng(e.X, e.Y).Lng; gMap.Position = new PointLatLng(lat, lng); points.Add(new PointLatLng(lat, lng)); // seperatePoints.Add(new PointLatLng(lat,lng)); List <Placemark> plc = null; var st = GMapProviders.GoogleMap.GetPlacemarks(gMap.FromLocalToLatLng(e.X, e.Y), out plc); if (st == GeoCoderStatusCode.G_GEO_SUCCESS && plc != null) { foreach (var pl in plc) { if (!string.IsNullOrEmpty(pl.PostalCodeNumber)) { Place.Add(pl.Address); } } } var marker = new GMarkerGoogle(new PointLatLng(lat, lng), GMarkerGoogleType.arrow); routesOverlay.Markers.Add(marker); gMap.Overlays.Add(routesOverlay); } }
private async void Save(object sender, EventArgs e) { _this.Name = txtName.Text; _this.Number1 = txtNumber1.Text; _this.Number2 = txtNumber2.Text; _this.Description = txtDescription.Text; _this.Priority = txtPriority.Text; _this.IsArchived = cboxArchived.CheckState.CheckboxStateToNullableBool(); if (cmbArea.SelectedItem != null) { _this.AreaId = Convert.ToInt32(cmbArea.SelectedValue.ToString()); } if (cmbSet.SelectedItem != null) { _this.SetId = Convert.ToInt32(cmbSet.SelectedValue.ToString()); } string photoPath = null; if (img.Items.Any()) { if (img.Items[0].IsUploaded != true) { photoPath = img.Items[0].Link; } } try { Looper.Show(this); if (mode == 1) { _this.CreatedBy = RuntimeSettings.UserId; _this.CreatedOn = DateTime.Now; if (await _this.Add(photoPath)) { mode = 2; this.Text = "Szczegóły zasobu"; GenerateQrCode(_this.PlaceToken); } } else if (mode == 2) { _this.Edit(photoPath); } string res = await files.Save($"PlaceId={_this.PlaceId}"); if (res != "OK") { MessageBox.Show($"Wystąpiły problemy podczas zapisywania plików. Szczegóły: {res}", "Problemy", buttons: MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { } finally { Looper.Hide(); } }
private void AddRoom(string type, string r_name, string n_name) { Place room = MainRoom.GetRoom(r_name); switch (type) { case "Room": room.Add(new CommonRoom(n_name)); break; case "Forest": room.Add(new Forest(n_name)); break; case "Pool": room.Add(new Pool(n_name)); break; case "Field": room.Add(new Field(n_name)); break; } }