65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using CarRentContracts.BusinessLogicContracts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CarRent
|
|
{
|
|
public partial class FormTests : Form
|
|
{
|
|
private readonly IRentalLogic _rentalLogic;
|
|
private readonly IClientLogic _clientLogic;
|
|
private readonly ICarLogic _carLogic;
|
|
|
|
public FormTests(IRentalLogic rentalLogic,
|
|
IClientLogic clientLogic,
|
|
ICarLogic carLogic)
|
|
{
|
|
InitializeComponent();
|
|
|
|
_rentalLogic = rentalLogic;
|
|
_clientLogic = clientLogic;
|
|
_carLogic = carLogic;
|
|
numericUpDownInsert.Minimum = 0;
|
|
numericUpDownInsert.Maximum = 1000000;
|
|
numericUpDownRead.Minimum = 0;
|
|
numericUpDownRead.Maximum = 1000000;
|
|
}
|
|
|
|
private void buttonInsertTest_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var result = _rentalLogic.TestInsertList(Convert.ToInt32(numericUpDownInsert.Value),
|
|
_clientLogic.ReadList(null) ?? new(),
|
|
_carLogic.ReadList(null) ?? new());
|
|
|
|
textBoxInsertTime.Text = result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void buttonReadTest_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var result = _rentalLogic.TestReadList(Convert.ToInt32(numericUpDownInsert.Value));
|
|
textBoxReadTime.Text = result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|
|
}
|