public void SetModelToUI(PizzaRequestDto dto) { PizzaBox.Items.Clear(); foreach (var e in dto.Pizza) { PizzaBox.Items.Add(e); } textBox2.Text = dto.FullName; textBox3.Text = dto.Address; PriceNum.Value = dto.Price; dateTimePicker1.Value = dto.DeliveryTime; switch (dto.PaymentMethod) { case PaymentMethod.Cash: radioButton4.Checked = true; break; case PaymentMethod.CreditCardOnline: radioButton5.Checked = true; break; case PaymentMethod.CreditCardOffline: radioButton6.Checked = true; break; } }
public void FirstTest() { var dto = new PizzaRequestDto { //Filled = DateTime.Now, FullName = "Batman", Address = "Batcave", Price = 700, PaymentMethod = PaymentMethod.CreditCardOnline, DeliveryTime = new DateTime(2018, 4, 22, 23, 15, 0), Pizza = new List <PizzaMaker>() { new PizzaMaker { pizza = Pizza.Margherita, size = PizzaSize.large, Dough = DoughType.TraditionalDough, AddMushrooms = false } } }; var tempFileName = Path.GetTempFileName(); try { PizzaDtoHelper.WriteToFile(tempFileName, dto); var readDto = PizzaDtoHelper.LoadFromFile(tempFileName); // Assert.AreEqual(dto.Filled, readDto.Filled); Assert.AreEqual(dto.Address, readDto.Address); } finally { File.Delete(tempFileName); } }