тесты добавляю потихонечьку
This commit is contained in:
parent
fd475481ef
commit
2d2cd016c7
@ -76,6 +76,16 @@ namespace BusinessLogic.BusinessLogic
|
||||
return list;
|
||||
}
|
||||
|
||||
public string TestInsertList(int num)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string TestReadList(int num)
|
||||
{
|
||||
return _routeStorage.TestReadList(num);
|
||||
}
|
||||
|
||||
public bool Update(RouteBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
12
TransportGuide/FormMain.Designer.cs
generated
12
TransportGuide/FormMain.Designer.cs
generated
@ -32,6 +32,7 @@
|
||||
this.transportTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.routeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.testsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -41,7 +42,8 @@
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.transportTypeToolStripMenuItem,
|
||||
this.stopToolStripMenuItem,
|
||||
this.routeToolStripMenuItem});
|
||||
this.routeToolStripMenuItem,
|
||||
this.testsToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(800, 33);
|
||||
@ -69,6 +71,13 @@
|
||||
this.routeToolStripMenuItem.Text = "Route";
|
||||
this.routeToolStripMenuItem.Click += new System.EventHandler(this.routeToolStripMenuItem_Click);
|
||||
//
|
||||
// testsToolStripMenuItem
|
||||
//
|
||||
this.testsToolStripMenuItem.Name = "testsToolStripMenuItem";
|
||||
this.testsToolStripMenuItem.Size = new System.Drawing.Size(66, 29);
|
||||
this.testsToolStripMenuItem.Text = "Tests";
|
||||
this.testsToolStripMenuItem.Click += new System.EventHandler(this.testsToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
@ -92,5 +101,6 @@
|
||||
private ToolStripMenuItem transportTypeToolStripMenuItem;
|
||||
private ToolStripMenuItem stopToolStripMenuItem;
|
||||
private ToolStripMenuItem routeToolStripMenuItem;
|
||||
private ToolStripMenuItem testsToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -53,5 +53,15 @@ namespace TransportGuide
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void testsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormTests));
|
||||
|
||||
if (service is FormTests form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
228
TransportGuide/FormTests.Designer.cs
generated
Normal file
228
TransportGuide/FormTests.Designer.cs
generated
Normal file
@ -0,0 +1,228 @@
|
||||
namespace TransportGuide
|
||||
{
|
||||
partial class FormTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.buttonInsertTest = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.textBoxInsertTime = new System.Windows.Forms.TextBox();
|
||||
this.buttonReadTest = new System.Windows.Forms.Button();
|
||||
this.textBoxReadTime = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.numericUpDownInsert = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDownRead = new System.Windows.Forms.NumericUpDown();
|
||||
this.buttonJoinQuery = new System.Windows.Forms.Button();
|
||||
this.numericUpDownJoin = new System.Windows.Forms.NumericUpDown();
|
||||
this.textBoxJoin = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownInsert)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRead)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownJoin)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonInsertTest
|
||||
//
|
||||
this.buttonInsertTest.Location = new System.Drawing.Point(12, 12);
|
||||
this.buttonInsertTest.Name = "buttonInsertTest";
|
||||
this.buttonInsertTest.Size = new System.Drawing.Size(86, 61);
|
||||
this.buttonInsertTest.TabIndex = 0;
|
||||
this.buttonInsertTest.Text = "Тест вставки сообщений";
|
||||
this.buttonInsertTest.UseVisualStyleBackColor = true;
|
||||
this.buttonInsertTest.Click += new System.EventHandler(this.buttonInsertTest_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(104, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(156, 15);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Введите кол-во элементов:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(104, 53);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(146, 15);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Итоговое время запроса:";
|
||||
//
|
||||
// textBoxInsertTime
|
||||
//
|
||||
this.textBoxInsertTime.Location = new System.Drawing.Point(266, 50);
|
||||
this.textBoxInsertTime.Name = "textBoxInsertTime";
|
||||
this.textBoxInsertTime.ReadOnly = true;
|
||||
this.textBoxInsertTime.Size = new System.Drawing.Size(100, 23);
|
||||
this.textBoxInsertTime.TabIndex = 4;
|
||||
//
|
||||
// buttonReadTest
|
||||
//
|
||||
this.buttonReadTest.Location = new System.Drawing.Point(12, 106);
|
||||
this.buttonReadTest.Name = "buttonReadTest";
|
||||
this.buttonReadTest.Size = new System.Drawing.Size(86, 56);
|
||||
this.buttonReadTest.TabIndex = 5;
|
||||
this.buttonReadTest.Text = "Тест чтения сообщений";
|
||||
this.buttonReadTest.UseVisualStyleBackColor = true;
|
||||
this.buttonReadTest.Click += new System.EventHandler(this.buttonReadTest_Click);
|
||||
//
|
||||
// textBoxReadTime
|
||||
//
|
||||
this.textBoxReadTime.Location = new System.Drawing.Point(266, 144);
|
||||
this.textBoxReadTime.Name = "textBoxReadTime";
|
||||
this.textBoxReadTime.ReadOnly = true;
|
||||
this.textBoxReadTime.Size = new System.Drawing.Size(100, 23);
|
||||
this.textBoxReadTime.TabIndex = 9;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(104, 147);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(146, 15);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "Итоговое время запроса:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(104, 106);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(156, 15);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Введите кол-во элементов:";
|
||||
//
|
||||
// numericUpDownInsert
|
||||
//
|
||||
this.numericUpDownInsert.Location = new System.Drawing.Point(266, 10);
|
||||
this.numericUpDownInsert.Name = "numericUpDownInsert";
|
||||
this.numericUpDownInsert.Size = new System.Drawing.Size(100, 23);
|
||||
this.numericUpDownInsert.TabIndex = 10;
|
||||
//
|
||||
// numericUpDownRead
|
||||
//
|
||||
this.numericUpDownRead.Location = new System.Drawing.Point(266, 104);
|
||||
this.numericUpDownRead.Name = "numericUpDownRead";
|
||||
this.numericUpDownRead.Size = new System.Drawing.Size(100, 23);
|
||||
this.numericUpDownRead.TabIndex = 11;
|
||||
//
|
||||
// buttonJoinQuery
|
||||
//
|
||||
this.buttonJoinQuery.Location = new System.Drawing.Point(12, 197);
|
||||
this.buttonJoinQuery.Name = "buttonJoinQuery";
|
||||
this.buttonJoinQuery.Size = new System.Drawing.Size(86, 74);
|
||||
this.buttonJoinQuery.TabIndex = 12;
|
||||
this.buttonJoinQuery.Text = "Тест сложного чтения (Join)";
|
||||
this.buttonJoinQuery.UseVisualStyleBackColor = true;
|
||||
this.buttonJoinQuery.Click += new System.EventHandler(this.buttonJoinQuery_Click);
|
||||
//
|
||||
// numericUpDownJoin
|
||||
//
|
||||
this.numericUpDownJoin.Location = new System.Drawing.Point(266, 195);
|
||||
this.numericUpDownJoin.Name = "numericUpDownJoin";
|
||||
this.numericUpDownJoin.Size = new System.Drawing.Size(100, 23);
|
||||
this.numericUpDownJoin.TabIndex = 16;
|
||||
//
|
||||
// textBoxJoin
|
||||
//
|
||||
this.textBoxJoin.Location = new System.Drawing.Point(266, 235);
|
||||
this.textBoxJoin.Name = "textBoxJoin";
|
||||
this.textBoxJoin.ReadOnly = true;
|
||||
this.textBoxJoin.Size = new System.Drawing.Size(100, 23);
|
||||
this.textBoxJoin.TabIndex = 15;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(104, 238);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(146, 15);
|
||||
this.label5.TabIndex = 14;
|
||||
this.label5.Text = "Итоговое время запроса:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(104, 197);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(156, 15);
|
||||
this.label6.TabIndex = 13;
|
||||
this.label6.Text = "Введите кол-во элементов:";
|
||||
//
|
||||
// FormTests
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(383, 286);
|
||||
this.Controls.Add(this.numericUpDownJoin);
|
||||
this.Controls.Add(this.textBoxJoin);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.buttonJoinQuery);
|
||||
this.Controls.Add(this.numericUpDownRead);
|
||||
this.Controls.Add(this.numericUpDownInsert);
|
||||
this.Controls.Add(this.textBoxReadTime);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.buttonReadTest);
|
||||
this.Controls.Add(this.textBoxInsertTime);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.buttonInsertTest);
|
||||
this.Name = "FormTests";
|
||||
this.Text = "Тесты запросов к бд";
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownInsert)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRead)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownJoin)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonInsertTest;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private TextBox textBoxInsertTime;
|
||||
private Button buttonReadTest;
|
||||
private TextBox textBoxReadTime;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private NumericUpDown numericUpDownInsert;
|
||||
private NumericUpDown numericUpDownRead;
|
||||
private Button buttonJoinQuery;
|
||||
private NumericUpDown numericUpDownJoin;
|
||||
private TextBox textBoxJoin;
|
||||
private Label label5;
|
||||
private Label label6;
|
||||
}
|
||||
}
|
75
TransportGuide/FormTests.cs
Normal file
75
TransportGuide/FormTests.cs
Normal file
@ -0,0 +1,75 @@
|
||||
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;
|
||||
using TransportGuideContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace TransportGuide
|
||||
{
|
||||
public partial class FormTests : Form
|
||||
{
|
||||
private readonly IRouteLogic _routeLogic;
|
||||
//private readonly IUserLogic _userLogic;
|
||||
//private readonly ITopicLogic _topicLogic;
|
||||
public FormTests(IRouteLogic routeLogic)//IUserLogic userLogic, ITopicLogic topicLogic, IMessageLogic messageLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
//_userLogic = userLogic;
|
||||
//_topicLogic = topicLogic;
|
||||
_routeLogic= routeLogic;
|
||||
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 = _routeLogic.TestReadList(Convert.ToInt32(numericUpDownRead.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);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
120
TransportGuide/FormTests.resx
Normal file
120
TransportGuide/FormTests.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -49,6 +49,8 @@ namespace TransportGuide
|
||||
services.AddTransient<FormRoutes>();
|
||||
services.AddTransient<FormRoute>();
|
||||
services.AddTransient<FormStopRoute>();
|
||||
services.AddTransient<FormTests>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -16,5 +16,7 @@ namespace TransportGuideContracts.BusinessLogicsContracts
|
||||
bool Create(RouteBindingModel model);
|
||||
bool Update(RouteBindingModel model);
|
||||
bool Delete(RouteBindingModel model);
|
||||
string TestInsertList(int num);
|
||||
string TestReadList(int num);
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,7 @@ namespace TransportGuideContracts.StoragesContracts
|
||||
RouteViewModel? Insert(RouteBindingModel model);
|
||||
RouteViewModel? Update(RouteBindingModel model);
|
||||
RouteViewModel? Delete(RouteBindingModel model);
|
||||
string TestInsertList(int num);
|
||||
string TestReadList(int num);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -78,6 +80,36 @@ namespace TransportGuideDatabaseImplements.Implements
|
||||
return newRoute.GetViewModel;
|
||||
}
|
||||
|
||||
public string TestInsertList(int num)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string TestReadList(int num)
|
||||
{
|
||||
var context = new TransportGuideDB();
|
||||
Stopwatch stopwatch = new();
|
||||
|
||||
long[] res = new long[num];
|
||||
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
|
||||
stopwatch.Start();
|
||||
List<RouteViewModel> list = context.Routes.Include(x => x.TransportType).Include(x => x.Stops).ThenInclude(x => x.Stop).ToList().Select(x => x.GetViewModel).ToList();
|
||||
stopwatch.Stop();
|
||||
res[i] = stopwatch.ElapsedMilliseconds;
|
||||
}
|
||||
|
||||
long sum = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
sum += res[i];
|
||||
}
|
||||
int result = Convert.ToInt32(sum / num);
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
public RouteViewModel? Update(RouteBindingModel model)
|
||||
{
|
||||
using var context = new TransportGuideDB();
|
||||
|
Loading…
Reference in New Issue
Block a user