public void Test() { var dto = new AutoParkingDto { Filled = DateTime.Now, AutoName = "Nissan X-Trail", Type = Body.Кроссовер, AutoNumber = "В339КУ", ParkingNumber = 9, TimeOut = DateTime.Now, Price = 1499, }; var tempFileName = Path.GetTempFileName(); try { AutoParkingHelper.WriteToFile(tempFileName, dto); var readDto = AutoParkingHelper.LoadFromFile(tempFileName); Assert.AreEqual(dto.Filled, readDto.Filled); } finally { File.Delete(tempFileName); } }
private void button3_Click_1(object sender, EventArgs e) { var sfd = new SaveFileDialog() { Filter = "Файлы заказов|*.prkng" }; var result = sfd.ShowDialog(this); if (result == DialogResult.OK) { var dto = GetModelFromUI(); AutoParkingHelper.WriteToFile(sfd.FileName, dto); } }