public void SignalboxClassCopyMethodReturnsObjectWithCorrectIdProperty()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

            Assert.AreEqual(sourceObject.Id, testObject.Id);
        }
        public void SignalboxClassCopyMethodReturnsObjectWithCorrectExportDisplayNameProperty()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

            Assert.AreEqual(sourceObject.ExportDisplayName, testObject.ExportDisplayName);
        }
        public void SignalboxClassCopyMethodReturnsDifferentObject()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

            Assert.AreNotSame(sourceObject, testObject);
        }
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView.SelectedCells.Count == 0)
            {
                return;
            }
            Signalbox box = Model.FirstOrDefault(b => b.Id == (dataGridView.SelectedCells[0].OwningRow.Cells[_idColIdx].Value as string));

            if (box == null)
            {
                return;
            }
            using (SignalboxEditForm form = new SignalboxEditForm {
                Model = box.Copy()
            })
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                form.Model.CopyTo(box);
            }
        }