private void AddSessionButton_Click(object sender, EventArgs e) { try { bool isvalidated = validatefields(); if (isvalidated) { Location location = new Location(); location.room = SelectRoomtextBox.Text; location.day = SelectDaytextBox.Text; location.StartTime = StartTimeetextBox.Text; location.EndTime = EndTimetextBox.Text; string message = LocationController.AddLocation(location); MessageBox.Show(message); clear(); } else { MessageBox.Show("please fill in all fields!"); } } catch (NullReferenceException nre) { MessageBox.Show("please fill in all fields!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void AddLocationBlank() { LocationController controller = new LocationController(_mockRepository.Object); // Act var result = controller.AddLocation(null);; // Assert Assert.AreEqual(false, result.Data); }
public void AddLocationRecordAndFetchIt() { var locationRecord = new LocationRecord() { ID = Guid.NewGuid(), Altitude = 1200, Latitude = 54.12f, Longitude = 12.31f, MemberID = Guid.NewGuid(), Timestamp = GetUnixTimeStamp() }; controller.AddLocation(locationRecord.MemberID, locationRecord); var fetchedLocationRecord = controller.GetSpecificLocationForMember(locationRecord.MemberID, locationRecord.ID) as OkObjectResult; var fetchedResult = fetchedLocationRecord.Value as LocationRecord; Assert.Equal(locationRecord.ID, fetchedResult.ID); }
public void AddLocation() { // Arrange LocationController controller = new LocationController(_mockRepository.Object); // Act var result = controller.AddLocation("Rodrigues"); // Assert Assert.AreEqual(true, result.Data); }
protected void btnAddLocation_Click(object sender, EventArgs e) { ltC.AddLocation(new Location() { Latitude = Convert.ToSingle(mdm_hidden_lat.Value), Longitude = Convert.ToSingle(mdm_hidden_lon.Value), AddressOne = txtAddressOne.Text, AddressTwo = txtAddressTwo.Text, BuildingName = txtBuilding.Text, UserID = UserId, SPStatus = 0, ErrMsg = "" }); dataLocations.DataSource = ltC.GetLocations(); dataLocations.DataBind(); }
public void AddLocation() { LocationController parkcontroller = new LocationController(); parkcontroller.AddLocation(); }