5 тестов доделать
This commit is contained in:
@@ -12,5 +12,5 @@ public class PostBindingModel
|
||||
public string? PostId => Id;
|
||||
public string? PostName { get; set; }
|
||||
public string? PostType { get; set; }
|
||||
public double Salary { get; set; }
|
||||
public double? Salary { get; set; }
|
||||
}
|
||||
|
||||
@@ -124,25 +124,34 @@ namespace SmallSoftwareContracts.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Компонент.
|
||||
/// Ищет локализованную строку, похожую на Дата.
|
||||
/// </summary>
|
||||
internal static string DocumentDocCaptionComponent {
|
||||
internal static string DocumentDocCaptionData {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentDocCaptionComponent", resourceCulture);
|
||||
return ResourceManager.GetString("DocumentDocCaptionData", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Производитель.
|
||||
/// Ищет локализованную строку, похожую на Старая цена.
|
||||
/// </summary>
|
||||
internal static string DocumentDocCaptionManufacturer {
|
||||
internal static string DocumentDocCaptionOldPrice {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentDocCaptionManufacturer", resourceCulture);
|
||||
return ResourceManager.GetString("DocumentDocCaptionOldPrice", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Компоненты по производителям.
|
||||
/// Ищет локализованную строку, похожую на Название ПО.
|
||||
/// </summary>
|
||||
internal static string DocumentDocCaptionSoftware {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentDocCaptionSoftware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на ПО по истории.
|
||||
/// </summary>
|
||||
internal static string DocumentDocHeader {
|
||||
get {
|
||||
@@ -178,20 +187,11 @@ namespace SmallSoftwareContracts.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Скидка.
|
||||
/// Ищет локализованную строку, похожую на ПО.
|
||||
/// </summary>
|
||||
internal static string DocumentExcelCaptionDiscount {
|
||||
internal static string DocumentExcelCaptionSoftware {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentExcelCaptionDiscount", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Товар.
|
||||
/// </summary>
|
||||
internal static string DocumentExcelCaptionProduct {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentExcelCaptionProduct", resourceCulture);
|
||||
return ResourceManager.GetString("DocumentExcelCaptionSoftware", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace SmallSoftwareContracts.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Продажи за период.
|
||||
/// Ищет локализованную строку, похожую на Заявки за период.
|
||||
/// </summary>
|
||||
internal static string DocumentExcelHeader {
|
||||
get {
|
||||
@@ -330,6 +330,15 @@ namespace SmallSoftwareContracts.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Значение в поле Email не является Email.
|
||||
/// </summary>
|
||||
internal static string ValidationExceptionMessageIncorrectEmail {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidationExceptionMessageIncorrectEmail", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Значение в поле ФИО не является ФИО.
|
||||
/// </summary>
|
||||
@@ -339,15 +348,6 @@ namespace SmallSoftwareContracts.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Значение в поле Телефонный номер не является телефонным номером.
|
||||
/// </summary>
|
||||
internal static string ValidationExceptionMessageIncorrectPhoneNumber {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidationExceptionMessageIncorrectPhoneNumber", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на Значение в поле {0} меньше или равно 0.
|
||||
/// </summary>
|
||||
@@ -376,11 +376,11 @@ namespace SmallSoftwareContracts.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на В продаже должен быть хотя бы один товар.
|
||||
/// Ищет локализованную строку, похожую на В запросе должно быть хотя бы одно ПО.
|
||||
/// </summary>
|
||||
internal static string ValidationExceptionMessageNoProductsInSale {
|
||||
internal static string ValidationExceptionMessageNoSoftwaresCount {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidationExceptionMessageNoProductsInSale", resourceCulture);
|
||||
return ResourceManager.GetString("ValidationExceptionMessageNoSoftwaresCount", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
<?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>
|
||||
<data name="AdapterMessageElementDeletedException" xml:space="preserve">
|
||||
<value>Element mit Daten: {0} </value>
|
||||
</data>
|
||||
<data name="AdapterMessageElementNotFoundException" xml:space="preserve">
|
||||
<value>Element mit Daten: {0} nicht gefunden</value>
|
||||
</data>
|
||||
<data name="AdapterMessageEmptyDate" xml:space="preserve">
|
||||
<value>Daten sind leer</value>
|
||||
</data>
|
||||
<data name="AdapterMessageIncorrectDatesException" xml:space="preserve">
|
||||
<value>Ungültige Datumsangaben: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageInvalidOperationException" xml:space="preserve">
|
||||
<value>Fehler bei der Datenverarbeitung: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageStorageException" xml:space="preserve">
|
||||
<value>Fehler beim Zugriff auf den Datenspeicher: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageValidationException" xml:space="preserve">
|
||||
<value>Falsche Daten wurden übergeben: {0}</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionData" xml:space="preserve">
|
||||
<value>Datum</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionOldPrice" xml:space="preserve">
|
||||
<value>Alter Preis</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionSoftware" xml:space="preserve">
|
||||
<value>Softwarename</value>
|
||||
</data>
|
||||
<data name="DocumentDocHeader" xml:space="preserve">
|
||||
<value>Software nach Geschichte</value>
|
||||
</data>
|
||||
<data name="DocumentDocSubHeader" xml:space="preserve">
|
||||
<value>Erstellt am {0}</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionCount" xml:space="preserve">
|
||||
<value>Anzahl</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionDate" xml:space="preserve">
|
||||
<value>Datum</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionSoftware" xml:space="preserve">
|
||||
<value>Software</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionSum" xml:space="preserve">
|
||||
<value>Summe</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionTotal" xml:space="preserve">
|
||||
<value>Gesamtbetrag</value>
|
||||
</data>
|
||||
<data name="DocumentExcelHeader" xml:space="preserve">
|
||||
<value>Anfragen im Zeitraum</value>
|
||||
</data>
|
||||
<data name="DocumentExcelSubHeader" xml:space="preserve">
|
||||
<value>von {0} bis {1}</value>
|
||||
</data>
|
||||
<data name="DocumentPdfDiagramCaption" xml:space="preserve">
|
||||
<value>Abrechnungen</value>
|
||||
</data>
|
||||
<data name="DocumentPdfHeader" xml:space="preserve">
|
||||
<value>Gehaltsabrechnung</value>
|
||||
</data>
|
||||
<data name="DocumentPdfSubHeader" xml:space="preserve">
|
||||
<value> für den Zeitraum von {0} bis {1}</value>
|
||||
</data>
|
||||
<data name="ElementDeletedExceptionMessage" xml:space="preserve">
|
||||
<value>Ein gelöschtes Element (ID: {0}) kann nicht bearbeitet werden</value>
|
||||
</data>
|
||||
<data name="ElementExistsExceptionMessage" xml:space="preserve">
|
||||
<value>Es existiert bereits ein Element mit Wert {0} für Parameter {1}</value>
|
||||
</data>
|
||||
<data name="ElementNotFoundExceptionMessage" xml:space="preserve">
|
||||
<value>Element mit Wert = {0} nicht gefunden</value>
|
||||
</data>
|
||||
<data name="IncorrectDatesExceptionMessage" xml:space="preserve">
|
||||
<value>Das Enddatum muss nach dem Startdatum liegen. Startdatum: {0}. Enddatum: {1}</value>
|
||||
</data>
|
||||
<data name="NotEnoughDataToProcessExceptionMessage" xml:space="preserve">
|
||||
<value>Unzureichende Daten zur Verarbeitung: {0}</value>
|
||||
</data>
|
||||
<data name="NotFoundDataMessage" xml:space="preserve">
|
||||
<value>Keine Daten gefunden</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageEmploymentDateAndBirthDate" xml:space="preserve">
|
||||
<value>Das Einstellungsdatum kann nicht vor dem Geburtsdatum liegen ({0}, {1})</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageEmptyField" xml:space="preserve">
|
||||
<value>Das Feld {0} ist leer</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectEmail" xml:space="preserve">
|
||||
<value>Der Wert im Feld Email ist kein vollständiger Email.</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectFIO" xml:space="preserve">
|
||||
<value>Der Wert im Feld NAME ist kein vollständiger Name.</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageLessOrEqualZero" xml:space="preserve">
|
||||
<value>Der Wert im Feld {0} ist kleiner oder gleich 0</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageMinorsBirthDate" xml:space="preserve">
|
||||
<value>Minderjährige können nicht eingestellt werden (Geburtsdatum = {0})</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageMinorsEmploymentDate" xml:space="preserve">
|
||||
<value>Minderjährige können nicht eingestellt werden (Einstellungsdatum: {0}, Geburtsdatum: {1})</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageNoSoftwaresCount" xml:space="preserve">
|
||||
<value>Es muss mindestens ein Artikel zum Verkauf stehen</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageNotAId" xml:space="preserve">
|
||||
<value>Der Wert im Feld {0} ist kein eindeutiger Identifikator.</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageNotInitialized" xml:space="preserve">
|
||||
<value>Das Feld {0} ist nicht initialisiert</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,234 @@
|
||||
<?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>
|
||||
<data name="AdapterMessageElementDeletedException" xml:space="preserve">
|
||||
<value>Element by data: {0} was deleted</value>
|
||||
</data>
|
||||
<data name="AdapterMessageElementNotFoundException" xml:space="preserve">
|
||||
<value>Not found element by data: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageEmptyDate" xml:space="preserve">
|
||||
<value>Data is empty</value>
|
||||
</data>
|
||||
<data name="AdapterMessageIncorrectDatesException" xml:space="preserve">
|
||||
<value>Incorrect dates: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageInvalidOperationException" xml:space="preserve">
|
||||
<value>Error processing data: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageStorageException" xml:space="preserve">
|
||||
<value>Error while working with data storage: {0}</value>
|
||||
</data>
|
||||
<data name="AdapterMessageValidationException" xml:space="preserve">
|
||||
<value>Incorrect data transmitted: {0}</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionData" xml:space="preserve">
|
||||
<value>Data</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionOldPrice" xml:space="preserve">
|
||||
<value>Old price</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionSoftware" xml:space="preserve">
|
||||
<value>Software Name</value>
|
||||
</data>
|
||||
<data name="DocumentDocHeader" xml:space="preserve">
|
||||
<value>Software by History</value>
|
||||
</data>
|
||||
<data name="DocumentDocSubHeader" xml:space="preserve">
|
||||
<value>Generated on date {0}</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionCount" xml:space="preserve">
|
||||
<value>Count</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionDate" xml:space="preserve">
|
||||
<value>Data</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionSoftware" xml:space="preserve">
|
||||
<value>Software</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionSum" xml:space="preserve">
|
||||
<value>Summ</value>
|
||||
</data>
|
||||
<data name="DocumentExcelCaptionTotal" xml:space="preserve">
|
||||
<value>Overall</value>
|
||||
</data>
|
||||
<data name="DocumentExcelHeader" xml:space="preserve">
|
||||
<value>Requests in period</value>
|
||||
</data>
|
||||
<data name="DocumentExcelSubHeader" xml:space="preserve">
|
||||
<value>from {0} to {1}</value>
|
||||
</data>
|
||||
<data name="DocumentPdfDiagramCaption" xml:space="preserve">
|
||||
<value>Arrivals</value>
|
||||
</data>
|
||||
<data name="DocumentPdfHeader" xml:space="preserve">
|
||||
<value>Payroll</value>
|
||||
</data>
|
||||
<data name="DocumentPdfSubHeader" xml:space="preserve">
|
||||
<value>for the period from {0} to {1}</value>
|
||||
</data>
|
||||
<data name="ElementDeletedExceptionMessage" xml:space="preserve">
|
||||
<value>Cannot modify a deleted item (id: {0})</value>
|
||||
</data>
|
||||
<data name="ElementExistsExceptionMessage" xml:space="preserve">
|
||||
<value>There is already an element with value {0} of parameter {1}</value>
|
||||
</data>
|
||||
<data name="ElementNotFoundExceptionMessage" xml:space="preserve">
|
||||
<value>Element not found at value = {0}</value>
|
||||
</data>
|
||||
<data name="IncorrectDatesExceptionMessage" xml:space="preserve">
|
||||
<value>The end date must be later than the start date.. StartDate: {0}. EndDate: {1}</value>
|
||||
</data>
|
||||
<data name="NotEnoughDataToProcessExceptionMessage" xml:space="preserve">
|
||||
<value>Not enough data to process: {0}</value>
|
||||
</data>
|
||||
<data name="NotFoundDataMessage" xml:space="preserve">
|
||||
<value>No data found</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageEmploymentDateAndBirthDate" xml:space="preserve">
|
||||
<value>Date of employment cannot be earlier than date of birth ({0}, {1})</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageEmptyField" xml:space="preserve">
|
||||
<value>The value in field {0} is empty</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectEmail" xml:space="preserve">
|
||||
<value>The value in the Email field is not a Email</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectFIO" xml:space="preserve">
|
||||
<value>The value in the FULL NAME field is not a full name.</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageLessOrEqualZero" xml:space="preserve">
|
||||
<value>The value in field {0} is less than or equal to 0</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageMinorsBirthDate" xml:space="preserve">
|
||||
<value>Minors cannot be hired (BirthDate = {0})</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageMinorsEmploymentDate" xml:space="preserve">
|
||||
<value>Minors cannot be hired (EmploymentDate: {0}, BirthDate {1})</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageNoSoftwaresCount" xml:space="preserve">
|
||||
<value>There must be at least one item on request</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageNotAId" xml:space="preserve">
|
||||
<value>The value in the {0} field is not a unique identifier type.</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageNotInitialized" xml:space="preserve">
|
||||
<value>The value in field {0} is not initialized</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -138,6 +138,12 @@
|
||||
<data name="AdapterMessageValidationException" xml:space="preserve">
|
||||
<value>Переданы неверные данные: {0}</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionData" xml:space="preserve">
|
||||
<value>Дата</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionOldPrice" xml:space="preserve">
|
||||
<value>Старая цена</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionSoftware" xml:space="preserve">
|
||||
<value>Название ПО</value>
|
||||
</data>
|
||||
@@ -201,12 +207,12 @@
|
||||
<data name="ValidationExceptionMessageEmptyField" xml:space="preserve">
|
||||
<value>Значение в поле {0} пусто</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectFIO" xml:space="preserve">
|
||||
<value>Значение в поле ФИО не является ФИО</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectEmail" xml:space="preserve">
|
||||
<value>Значение в поле Email не является Email</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageIncorrectFIO" xml:space="preserve">
|
||||
<value>Значение в поле ФИО не является ФИО</value>
|
||||
</data>
|
||||
<data name="ValidationExceptionMessageLessOrEqualZero" xml:space="preserve">
|
||||
<value>Значение в поле {0} меньше или равно 0</value>
|
||||
</data>
|
||||
@@ -225,10 +231,4 @@
|
||||
<data name="ValidationExceptionMessageNotInitialized" xml:space="preserve">
|
||||
<value>Значение в поле {0} не проиницализировано</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionOldPrice" xml:space="preserve">
|
||||
<value>Старая цена</value>
|
||||
</data>
|
||||
<data name="DocumentDocCaptionData" xml:space="preserve">
|
||||
<value>Дата</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -19,8 +19,18 @@
|
||||
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Resources\Messages.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Messages.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Messages.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,460 @@
|
||||
using SmallSoftwareDatabase;
|
||||
using SmallSoftwareTests.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.AspNetCore.TestHost;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using System.Text.Json;
|
||||
using SmallSoftwareContracts.DataModels;
|
||||
using SmallSoftwareContracts.Enums;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SmallSoftwareContracts.BindingModels;
|
||||
using Castle.Core.Configuration;
|
||||
using SmallSoftwareContracts.Infrastructure.PostConfigurations;
|
||||
using static NUnit.Framework.Internal.OSPlatform;
|
||||
|
||||
namespace SmallSoftwareTests.LocalizationTests;
|
||||
|
||||
internal abstract class BaseLocalizationControllerTests
|
||||
{
|
||||
protected abstract string GetLocale();
|
||||
|
||||
|
||||
private WebApplicationFactory<Program> _webApplication;
|
||||
|
||||
protected HttpClient HttpClient { get; private set; }
|
||||
|
||||
protected static SmallSoftwareDbContext SmallSoftwareDbContext { get; private set; }
|
||||
|
||||
protected static readonly JsonSerializerOptions JsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
|
||||
|
||||
private static string _manufacturerId;
|
||||
private static string _workerId;
|
||||
private static string _softwareId;
|
||||
private static string _postId;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OneTimeSetUp()
|
||||
{
|
||||
_webApplication = new CustomWebApplicationFactory<Program>();
|
||||
HttpClient = _webApplication
|
||||
.WithWebHostBuilder(builder =>
|
||||
{
|
||||
builder.ConfigureTestServices(services =>
|
||||
{
|
||||
using var loggerFactory = new LoggerFactory();
|
||||
loggerFactory.AddSerilog(new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build())
|
||||
.CreateLogger());
|
||||
services.AddSingleton(loggerFactory);
|
||||
});
|
||||
})
|
||||
.CreateClient();
|
||||
|
||||
var request = HttpClient.GetAsync("/login/user").GetAwaiter().GetResult();
|
||||
var data = request.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
||||
HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {data}");
|
||||
HttpClient.DefaultRequestHeaders.Add("Accept-Language", GetLocale());
|
||||
|
||||
SmallSoftwareDbContext = _webApplication.Services.GetRequiredService<SmallSoftwareDbContext>();
|
||||
SmallSoftwareDbContext.Database.EnsureDeleted();
|
||||
SmallSoftwareDbContext.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_workerId = SmallSoftwareDbContext.InsertWorkerToDatabaseAndReturn(fio: "Worker").Id;
|
||||
_manufacturerId = SmallSoftwareDbContext.InsertManufacturerToDatabaseAndReturn(manufacturerName: "Manufacturer").Id;
|
||||
_softwareId = SmallSoftwareDbContext.InsertSoftwareToDatabaseAndReturn(_manufacturerId).Id;
|
||||
_postId = SmallSoftwareDbContext.InsertPostToDatabaseAndReturn(postName: "Post").PostId;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
|
||||
SmallSoftwareDbContext.RemoveManufacturersFromDatabase();
|
||||
SmallSoftwareDbContext.RemoveSalariesFromDatabase();
|
||||
SmallSoftwareDbContext.RemoveRequestsFromDatabase();
|
||||
SmallSoftwareDbContext.RemoveWorkersFromDatabase();
|
||||
SmallSoftwareDbContext.RemovePostsFromDatabase();
|
||||
SmallSoftwareDbContext.RemoveSoftwaresFromDatabase();
|
||||
SmallSoftwareDbContext.RemoveManufacturersFromDatabase();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void OneTimeTearDown()
|
||||
{
|
||||
SmallSoftwareDbContext?.Database.EnsureDeleted();
|
||||
SmallSoftwareDbContext?.Dispose();
|
||||
HttpClient?.Dispose();
|
||||
_webApplication?.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task LoadSoftwares_WhenHaveRecords_ShouldSuccess_Test()
|
||||
{
|
||||
//Arrange
|
||||
var manufacturer1 = new ManufacturerDataModel(Guid.NewGuid().ToString(), "name1");
|
||||
var manufacturer2 = new ManufacturerDataModel(Guid.NewGuid().ToString(), "name2");
|
||||
SmallSoftwareDbContext.InsertManufacturerToDatabaseAndReturn(manufacturer1.Id, manufacturerName: manufacturer1.ManufacturerName);
|
||||
SmallSoftwareDbContext.InsertManufacturerToDatabaseAndReturn(manufacturer2.Id, manufacturerName: manufacturer2.ManufacturerName);
|
||||
|
||||
var softwareId1 = Guid.NewGuid().ToString();
|
||||
var softwareId2 = Guid.NewGuid().ToString();
|
||||
|
||||
var software1 = SmallSoftwareDbContext.InsertSoftwareToDatabaseAndReturn(manufacturer1.Id, softwareId1, "name1", SoftwareType.Windows, 10, false);
|
||||
var software2 = SmallSoftwareDbContext.InsertSoftwareToDatabaseAndReturn(manufacturer2.Id, softwareId2, "name2", SoftwareType.Windows, 10, false);
|
||||
|
||||
SmallSoftwareDbContext.InsertSoftwareHistoryToDatabaseAndReturn(softwareId1, 22, DateTime.UtcNow);
|
||||
SmallSoftwareDbContext.InsertSoftwareHistoryToDatabaseAndReturn(softwareId2, 21, DateTime.UtcNow);
|
||||
SmallSoftwareDbContext.InsertSoftwareHistoryToDatabaseAndReturn(softwareId1, 33, DateTime.UtcNow);
|
||||
SmallSoftwareDbContext.InsertSoftwareHistoryToDatabaseAndReturn(softwareId1, 32, DateTime.UtcNow);
|
||||
SmallSoftwareDbContext.InsertSoftwareHistoryToDatabaseAndReturn(softwareId2, 65, DateTime.UtcNow);
|
||||
|
||||
//Act
|
||||
var response = await HttpClient.GetAsync("/api/report/LoadSoftwares");
|
||||
|
||||
//Assert
|
||||
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
|
||||
using var data = await response.Content.ReadAsStreamAsync();
|
||||
Assert.That(data, Is.Not.Null);
|
||||
Assert.That(data.Length, Is.GreaterThan(0));
|
||||
await AssertStreamAsync(response, $"file-{GetLocale()}.docx");
|
||||
}
|
||||
[Test]
|
||||
public async Task LoadRequests_WhenHaveRecords_ShouldSuccess_Test()
|
||||
{
|
||||
// Arrange
|
||||
var manufacturer1 = SmallSoftwareDbContext.InsertManufacturerToDatabaseAndReturn(manufacturerName: "name 1");
|
||||
var manufacturer2 = SmallSoftwareDbContext.InsertManufacturerToDatabaseAndReturn(manufacturerName: "name 2");
|
||||
|
||||
var worker1 = SmallSoftwareDbContext.InsertWorkerToDatabaseAndReturn();
|
||||
var worker2 = SmallSoftwareDbContext.InsertWorkerToDatabaseAndReturn();
|
||||
|
||||
var software1 = SmallSoftwareDbContext.InsertSoftwareToDatabaseAndReturn(manufacturer1.Id,
|
||||
softwareName: "name 1");
|
||||
var software2 = SmallSoftwareDbContext.InsertSoftwareToDatabaseAndReturn(manufacturer2.Id,
|
||||
softwareName: "name 2");
|
||||
|
||||
SmallSoftwareDbContext.InsertRequestToDatabaseAndReturn(
|
||||
worker1.Id,
|
||||
sum: 100,
|
||||
email: "cdsfs@dd.ru",
|
||||
softwares: [(software1.Id, 10, 1.1), (software2.Id, 10, 1.1)]);
|
||||
|
||||
SmallSoftwareDbContext.InsertRequestToDatabaseAndReturn(
|
||||
worker2.Id,
|
||||
sum: 200,
|
||||
email: "cdswws@dd.ru",
|
||||
softwares: [(software1.Id, 10, 1.1)]);
|
||||
|
||||
// Act
|
||||
var response = await HttpClient.GetAsync(
|
||||
$"/api/report/loadrequests?" +
|
||||
$"fromDate={DateTime.Now.AddDays(-1):MM/dd/yyyy HH:mm:ss}&" + $"toDate={DateTime.Now.AddDays(1):MM/dd/yyyy HH:mm:ss}");
|
||||
|
||||
// Assert
|
||||
await AssertStreamAsync(response, $"file-{GetLocale()}.xlsx");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task LoadSalary_WhenHaveRecords_ShouldSuccess_Test()
|
||||
{
|
||||
// Arrange
|
||||
var post = SmallSoftwareDbContext.InsertPostToDatabaseAndReturn(postName: "Post for salary test");
|
||||
|
||||
var worker1 = SmallSoftwareDbContext.InsertWorkerToDatabaseAndReturn(
|
||||
fio: "fio 1",
|
||||
postId: post.PostId).AddPost(post);
|
||||
|
||||
var worker2 = SmallSoftwareDbContext.InsertWorkerToDatabaseAndReturn(
|
||||
fio: "fio 2",
|
||||
postId: post.PostId).AddPost(post);
|
||||
|
||||
SmallSoftwareDbContext.InsertSalaryToDatabaseAndReturn(
|
||||
worker1.Id,
|
||||
workerSalary: 100,
|
||||
salaryDate: DateTime.UtcNow.AddDays(-10));
|
||||
|
||||
SmallSoftwareDbContext.InsertSalaryToDatabaseAndReturn(
|
||||
worker1.Id,
|
||||
workerSalary: 1000,
|
||||
salaryDate: DateTime.UtcNow.AddDays(-5));
|
||||
|
||||
SmallSoftwareDbContext.InsertSalaryToDatabaseAndReturn(
|
||||
worker1.Id,
|
||||
workerSalary: 200,
|
||||
salaryDate: DateTime.UtcNow.AddDays(5));
|
||||
|
||||
SmallSoftwareDbContext.InsertSalaryToDatabaseAndReturn(
|
||||
worker2.Id,
|
||||
workerSalary: 500,
|
||||
salaryDate: DateTime.UtcNow.AddDays(-5));
|
||||
|
||||
SmallSoftwareDbContext.InsertSalaryToDatabaseAndReturn(
|
||||
worker2.Id,
|
||||
workerSalary: 300,
|
||||
salaryDate: DateTime.UtcNow.AddDays(-3));
|
||||
|
||||
// Act
|
||||
var response = await HttpClient.GetAsync(
|
||||
$"/api/report/loadsalary?" +
|
||||
$"fromDate={DateTime.Now.AddDays(-7):MM/dd/yyyy HH:mm:ss}&" + $"toDate={DateTime.Now.AddDays(-1):MM/dd/yyyy HH:mm:ss}");
|
||||
|
||||
// Assert
|
||||
await AssertStreamAsync(response, $"file-{GetLocale()}.pdf");
|
||||
}
|
||||
|
||||
private static async Task AssertStreamAsync(HttpResponseMessage response, string fileNameForSave = "")
|
||||
{
|
||||
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
|
||||
using var data = await response.Content.ReadAsStreamAsync();
|
||||
Assert.That(data, Is.Not.Null);
|
||||
Assert.That(data.Length, Is.GreaterThan(0));
|
||||
await SaveStreamAsync(data, fileNameForSave);
|
||||
}
|
||||
private static async Task SaveStreamAsync(Stream stream, string fileName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var path = Path.Combine(Directory.GetCurrentDirectory(), fileName);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
stream.Position = 0;
|
||||
using var fileStream = new FileStream(path, FileMode.OpenOrCreate);
|
||||
await stream.CopyToAsync(fileStream);
|
||||
}
|
||||
|
||||
protected abstract string MessageElementNotFound();
|
||||
[TestCase("manufacturers")]
|
||||
[TestCase("posts")]
|
||||
[TestCase("softwares/getrecord")]
|
||||
[TestCase("requests/getrecord")]
|
||||
[TestCase("workers/getrecord")]
|
||||
public async Task Api_GetElement_NotFound_Test(string path)
|
||||
{
|
||||
//Act
|
||||
var response = await
|
||||
HttpClient.GetAsync($"/api/{path}/{Guid.NewGuid()}");
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await
|
||||
response.Content.ReadAsStringAsync()).ToString(),
|
||||
Does.StartWith(MessageElementNotFound()));
|
||||
}
|
||||
|
||||
protected abstract string MessageElementExists();
|
||||
private static IEnumerable<TestCaseData> TestDataElementExists()
|
||||
{
|
||||
yield return new TestCaseData(() => {
|
||||
var model = CreateManufacturerModel();
|
||||
SmallSoftwareDbContext.InsertManufacturerToDatabaseAndReturn(model.Id);
|
||||
return model;
|
||||
}, "manufacturers");
|
||||
yield return new TestCaseData(() => {
|
||||
var model = CreatePostModel();
|
||||
SmallSoftwareDbContext.InsertPostToDatabaseAndReturn(model.Id);
|
||||
return model;
|
||||
}, "posts");
|
||||
yield return new TestCaseData(() =>
|
||||
{
|
||||
var model = CreateWorkerModel(_postId);
|
||||
SmallSoftwareDbContext.InsertWorkerToDatabaseAndReturn(model.Id, postId: _postId);
|
||||
return model;
|
||||
}, "workers/register");
|
||||
}
|
||||
[TestCaseSource(nameof(TestDataElementExists))]
|
||||
public async Task Api_Post_WhenHaveRecordWithSameId_ShouldBadRequest_Test(Func<object> createModel, string path)
|
||||
{
|
||||
//Arrange
|
||||
var model = createModel();
|
||||
//Act
|
||||
var response = await HttpClient.PostAsync($"/api/{path}",
|
||||
MakeContent(model));
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine($"Response: {response.StatusCode}, Content: {responseContent}");
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await
|
||||
response.Content.ReadAsStringAsync()).ToString(),
|
||||
Does.StartWith(MessageElementExists()));
|
||||
}
|
||||
|
||||
private static IEnumerable<TestCaseData> TestDataIdIncorrect()
|
||||
{
|
||||
yield return new TestCaseData(() => {
|
||||
var model = CreateManufacturerModel();
|
||||
model.Id = "Id";
|
||||
return model;
|
||||
}, "manufacturers");
|
||||
yield return new TestCaseData(() => {
|
||||
var model = CreateWorkerModel(_manufacturerId);
|
||||
model.Id = "Id";
|
||||
return model;
|
||||
}, "workers/register");
|
||||
}
|
||||
|
||||
protected abstract string MessageElementIdIncorrect();
|
||||
|
||||
[TestCaseSource(nameof(TestDataIdIncorrect))]
|
||||
public async Task Api_Post_WhenDataIsIncorrect_ShouldBadRequest_Test(Func<object> createModel, string path)
|
||||
{
|
||||
//Arrange
|
||||
var model = createModel();
|
||||
//Act
|
||||
var responseWithIdIncorrect = await HttpClient.PostAsync($"/api/{path}", MakeContent(model));
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await responseWithIdIncorrect.Content.ReadAsStringAsync()).ToString(), Does.StartWith(MessageElementIdIncorrect()));
|
||||
}
|
||||
|
||||
[TestCase("posts")]
|
||||
[TestCase("workers/delete")]
|
||||
public async Task Api_DelElement_NotFound_Test(string path)
|
||||
{
|
||||
//Act
|
||||
var response = await HttpClient.DeleteAsync($"/api/{path}/{Guid.NewGuid()}");
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await response.Content.ReadAsStringAsync()).ToString(), Does.StartWith(MessageElementNotFound()));
|
||||
}
|
||||
|
||||
protected abstract string MessageValidationErrorIDIsEmpty();
|
||||
|
||||
private static IEnumerable<TestCaseData> TestDataValidationErrorIdIsEmpty()
|
||||
{
|
||||
yield return new TestCaseData(() =>
|
||||
{
|
||||
var model = CreatePostModel();
|
||||
model.Id = "";
|
||||
return model;
|
||||
}, "posts");
|
||||
yield return new TestCaseData(() => {
|
||||
var model = CreateWorkerModel(_postId);
|
||||
model.Id = "";
|
||||
return model;
|
||||
}, "workers/changeinfo/");
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(TestDataValidationErrorIdIsEmpty))]
|
||||
public async Task Api_Put_ValidationError_IdIsEmpty_ShouldBadRequest_Test(Func<object> createModel, string path)
|
||||
{
|
||||
//Arrange
|
||||
var model = createModel();
|
||||
//Act
|
||||
var responseWithIdIncorrect = await HttpClient.PutAsync($"/api/{path}", MakeContent(model));
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await responseWithIdIncorrect.Content.ReadAsStringAsync()).ToString(), Does.StartWith(MessageValidationErrorIDIsEmpty()));
|
||||
}
|
||||
|
||||
protected abstract string MessageValidationErrorIDIsNotGuid();
|
||||
|
||||
private static IEnumerable<TestCaseData> TestDataValidationErrorIdIsNotGuid()
|
||||
{
|
||||
yield return new TestCaseData(() =>
|
||||
{
|
||||
var model = CreatePostModel();
|
||||
model.Id = "id";
|
||||
return model;
|
||||
}, "posts");
|
||||
yield return new TestCaseData(() => {
|
||||
var model = CreateWorkerModel(_postId);
|
||||
model.Id = "id";
|
||||
return model;
|
||||
}, "workers/changeinfo/");
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(TestDataValidationErrorIdIsNotGuid))]
|
||||
public async Task Api_Put_ValidationError_IIsNotGuid_ShouldBadRequest_Test(Func<object> createModel, string path)
|
||||
{
|
||||
//Arrange
|
||||
var model = createModel();
|
||||
//Act
|
||||
var responseWithIdIncorrect = await HttpClient.PutAsync($"/api/{path}", MakeContent(model));
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await responseWithIdIncorrect.Content.ReadAsStringAsync()).ToString(), Does.StartWith(MessageValidationErrorIDIsNotGuid()));
|
||||
}
|
||||
|
||||
protected abstract string MessageElemenValidationErrorPostNameEmpty();
|
||||
|
||||
[TestCase("posts")]
|
||||
public async Task Api_Put_ValidationError_PostNameIsEmpty_ShouldBadRequest_Test(string path)
|
||||
{
|
||||
//Arrange
|
||||
var model = CreatePostModel();
|
||||
model.PostName = "";
|
||||
//Act
|
||||
var responseWithIdIncorrect = await HttpClient.PutAsync($"/api/{path}", MakeContent(model));
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await responseWithIdIncorrect.Content.ReadAsStringAsync()).ToString(), Does.StartWith(MessageElemenValidationErrorPostNameEmpty()));
|
||||
}
|
||||
|
||||
protected abstract string MessageElemenValidationErrorFioISEmpty();
|
||||
|
||||
[TestCase("workers/changeinfo/")]
|
||||
public async Task Api_Put_ValidationError_FioIsEmpty_ShouldBadRequest_Test(string path)
|
||||
{
|
||||
//Arrange
|
||||
var model = CreateWorkerModel(_postId);
|
||||
model.FIO = "";
|
||||
//Act
|
||||
var responseWithIdIncorrect = await HttpClient.PutAsync($"/api/{path}", MakeContent(model));
|
||||
//Assert
|
||||
Assert.That(JToken.Parse(await responseWithIdIncorrect.Content.ReadAsStringAsync()).ToString(), Does.StartWith(MessageElemenValidationErrorFioISEmpty()));
|
||||
}
|
||||
|
||||
private static async Task<T?> GetModelFromResponseAsync<T>(HttpResponseMessage response) =>
|
||||
JsonSerializer.Deserialize<T>(await response.Content.ReadAsStringAsync(), JsonSerializerOptions);
|
||||
|
||||
private static StringContent MakeContent(object model) =>
|
||||
new(JsonSerializer.Serialize(model), Encoding.UTF8, "application/json");
|
||||
|
||||
private static ManufacturerBindingModel CreateManufacturerModel(string? id = null, string? manufacturerName = null)
|
||||
=> new()
|
||||
{
|
||||
Id = id ?? Guid.NewGuid().ToString(),
|
||||
ManufacturerName = manufacturerName ?? $"name_{Guid.NewGuid()}"
|
||||
};
|
||||
|
||||
private static PostBindingModel CreatePostModel(string? postId = null, string postName = "name", PostType postType = PostType.SoftInstaller, double salary = 10)
|
||||
=> new()
|
||||
{
|
||||
Id = postId ?? Guid.NewGuid().ToString(),
|
||||
PostName = postName,
|
||||
PostType = postType.ToString(),
|
||||
Salary = salary
|
||||
};
|
||||
|
||||
private static SoftwareBindingModel CreateSoftwareModel(string manufacturerId, string? id = null, string softwareName = "name", SoftwareType softwareType = SoftwareType.Windows, double price = 1)
|
||||
=> new()
|
||||
{
|
||||
Id = id ?? Guid.NewGuid().ToString(),
|
||||
ManufacturerId = manufacturerId,
|
||||
SoftwareName = softwareName,
|
||||
SoftwareType = softwareType.ToString(),
|
||||
Price = price
|
||||
};
|
||||
|
||||
private static WorkerBindingModel CreateWorkerModel(string postId, string? id = null, string fio = "fio", DateTime? birthDate = null, DateTime? employmentDate = null, string? configuration = null)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Id = id ?? Guid.NewGuid().ToString(),
|
||||
FIO = fio,
|
||||
PostId = postId,
|
||||
BirthDate = birthDate ?? DateTime.UtcNow.AddYears(-22),
|
||||
EmploymentDate = employmentDate ?? DateTime.UtcNow.AddDays(-5),
|
||||
ConfigurationJson = configuration ?? JsonSerializer.Serialize(new PostConfiguration() { Rate = 10 })
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace SmallSoftwareTests.LocalizationTests;
|
||||
|
||||
[TestFixture]
|
||||
internal class DeDETests : BaseLocalizationControllerTests
|
||||
{
|
||||
protected override string GetLocale() => "de-DE";
|
||||
protected override string MessageElementExists() => "Fehler beim Zugriff auf den Datenspeicher";
|
||||
protected override string MessageElementIdIncorrect() => "Falsche Daten wurden übergeben: Der Wert im Feld Id ist kein eindeutiger Identifikator.";
|
||||
protected override string MessageElementNotFound() => "Element mit Daten";
|
||||
protected override string MessageValidationErrorIDIsEmpty() => "Falsche Daten wurden übergeben: Das Feld Id ist leer";
|
||||
protected override string MessageValidationErrorIDIsNotGuid() => "Falsche Daten wurden übergeben: Der Wert im Feld Id ist kein eindeutiger Identifikator.";
|
||||
protected override string MessageElemenValidationErrorFioISEmpty() => "Falsche Daten wurden übergeben: Das Feld FIO ist leer";
|
||||
protected override string MessageElemenValidationErrorPostNameEmpty() => "Falsche Daten wurden übergeben: Das Feld PostName ist leer";
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace SmallSoftwareTests.LocalizationTests;
|
||||
|
||||
[TestFixture]
|
||||
internal class DefaultTests : BaseLocalizationControllerTests
|
||||
{
|
||||
protected override string GetLocale() => "bla-BLA";
|
||||
protected override string MessageElementExists() => "Уже существует элемент со значением";
|
||||
protected override string MessageElementNotFound() => "Не найден элемент по данным";
|
||||
protected override string MessageElementIdIncorrect() => "Переданы неверные данные";
|
||||
protected override string MessageValidationErrorIDIsEmpty() => "Переданы неверные данные: Значение в поле Id пусто";
|
||||
protected override string MessageValidationErrorIDIsNotGuid() => "Переданы неверные данные: Значение в поле Id не является типом уникального идентификатора";
|
||||
protected override string MessageElemenValidationErrorPostNameEmpty() => "Переданы неверные данные: Значение в поле PostName пусто";
|
||||
protected override string MessageElemenValidationErrorFioISEmpty() => "Переданы неверные данные: Значение в поле FIO пусто";
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace SmallSoftwareTests.LocalizationTests;
|
||||
|
||||
[TestFixture]
|
||||
internal class EnUSTests : BaseLocalizationControllerTests
|
||||
{
|
||||
protected override string GetLocale() => "en-US";
|
||||
protected override string MessageElementExists() => "There is already an element with value";
|
||||
protected override string MessageElementNotFound() => "Not found element by data";
|
||||
protected override string MessageElementIdIncorrect() => "Incorrect data transmitted";
|
||||
protected override string MessageValidationErrorIDIsEmpty() => "Incorrect data transmitted: The value in field Id is empty";
|
||||
protected override string MessageValidationErrorIDIsNotGuid() => "Incorrect data transmitted: The value in the Id field is not a unique identifier type.";
|
||||
protected override string MessageElemenValidationErrorPostNameEmpty() => "Incorrect data transmitted: The value in field PostName is empty";
|
||||
protected override string MessageElemenValidationErrorFioISEmpty() => "Incorrect data transmitted: The value in field FIO is empty";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace SmallSoftwareTests.LocalizationTests;
|
||||
|
||||
[TestFixture]
|
||||
internal class RuRUTests : BaseLocalizationControllerTests
|
||||
{
|
||||
protected override string GetLocale() => "ru-RU";
|
||||
protected override string MessageElementExists() => "Уже существует элемент со значением";
|
||||
protected override string MessageElementNotFound() => "Не найден элемент по данным";
|
||||
protected override string MessageElementIdIncorrect() => "Переданы неверные данные";
|
||||
protected override string MessageValidationErrorIDIsEmpty() => "Переданы неверные данные: Значение в поле Id пусто";
|
||||
protected override string MessageValidationErrorIDIsNotGuid() => "Переданы неверные данные: Значение в поле Id не является типом уникального идентификатора";
|
||||
protected override string MessageElemenValidationErrorPostNameEmpty() => "Переданы неверные данные: Значение в поле PostName пусто";
|
||||
protected override string MessageElemenValidationErrorFioISEmpty() => "Переданы неверные данные: Значение в поле FIO пусто";
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using SmallSoftwareWebApi;
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user