76 lines
2.4 KiB
C#
76 lines
2.4 KiB
C#
using ForumContracts.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 Forum
|
|
{
|
|
public partial class FormTests : Form
|
|
{
|
|
private readonly IMessageLogic _messageLogic;
|
|
private readonly IUserLogic _userLogic;
|
|
private readonly ITopicLogic _topicLogic;
|
|
public FormTests(IUserLogic userLogic, ITopicLogic topicLogic, IMessageLogic messageLogic)
|
|
{
|
|
InitializeComponent();
|
|
_userLogic = userLogic;
|
|
_topicLogic = topicLogic;
|
|
_messageLogic = messageLogic;
|
|
numericUpDownInsert.Minimum = 0;
|
|
numericUpDownInsert.Maximum = 1000000;
|
|
numericUpDownRead.Minimum = 0;
|
|
numericUpDownRead.Maximum = 1000000;
|
|
numericUpDownJoin.Minimum = 0;
|
|
numericUpDownJoin.Maximum = 1000000;
|
|
}
|
|
|
|
private void buttonInsertTest_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var result = _messageLogic.TestInsertList(Convert.ToInt32(numericUpDownInsert.Value),
|
|
_userLogic.ReadList(null) ?? new(),
|
|
_topicLogic.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 = _messageLogic.TestReadList(Convert.ToInt32(numericUpDownInsert.Value));
|
|
textBoxReadTime.Text = result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void buttonJoinQuery_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var result = _messageLogic.TestJoinReadList(Convert.ToInt32(numericUpDownJoin.Value));
|
|
textBoxJoin.Text = result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|
|
}
|