-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Обновлена целевая платформа и пакеты NuGet * Модифицирована первоначальная настройка приложения * Поверхностный рефакторинг всех классов * Модели данных переделаны с классов на записи * Добавлен FocusOnNavigate * Добавление инфраструктуры для классов-обёрток вызова функций JavaScript * Использование классов-обёрток вызова функций JavaScript в проекте локализации * Использование классов-обёрток вызова функций JavaScript в основном приложении * Замена Microsoft.Toolkit.Diagnostics на CommunityToolkit.Diagnostics * Переработка файлов стилей и сценариев под новые возможности .NET 6 * Добавление файлов настроек для модульных тестов * Обновление данных резюме * Обновление сценария сборки и публикации Co-authored-by: Валерий Гуров <ValeriyGourov@live.ru>
- Loading branch information
1 parent
69013d4
commit 5946f1d
Showing
71 changed files
with
2,655 additions
and
2,299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 33 additions & 38 deletions
71
Application.Tests/Infrastructure/Validation/ComplexTypeValidationResultTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using TestInfrastructure; | ||
|
||
namespace Application.Infrastructure.Validation.Tests | ||
namespace Application.Infrastructure.Validation.Tests; | ||
|
||
[TestClass] | ||
public class ComplexTypeValidationResultTests | ||
{ | ||
[TestClass] | ||
public class ComplexTypeValidationResultTests | ||
[TestMethod] | ||
[TestProperty(TestProperties.Constructor, null)] | ||
public void ThrowsArgumentNullExceptionInConstructorIfValidationResultsIsNull() | ||
{ | ||
[TestMethod] | ||
[TestProperty(TestProperties.Constructor, null)] | ||
public void ThrowsArgumentNullExceptionInConstructorIfValidationResultsIsNull() | ||
{ | ||
// Arrange. | ||
string errorMessage = "Test"; | ||
IEnumerable<ValidationResult>? validationResults = null; | ||
// Arrange. | ||
const string errorMessage = "Test"; | ||
IEnumerable<ValidationResult>? validationResults = null; | ||
|
||
// Act. | ||
void act() | ||
{ | ||
// Act. | ||
void act() | ||
{ | ||
#pragma warning disable CS8604 // Возможно, аргумент-ссылка, допускающий значение NULL. | ||
ComplexTypeValidationResult validationResult = new(errorMessage, validationResults); | ||
_ = new ComplexTypeValidationResult(errorMessage, validationResults); | ||
#pragma warning restore CS8604 // Возможно, аргумент-ссылка, допускающий значение NULL. | ||
}; | ||
|
||
// Assert. | ||
Assert.ThrowsException<ArgumentNullException>(act); | ||
} | ||
|
||
[TestMethod] | ||
[TestProperty(TestProperties.PropertyName, nameof(ComplexTypeValidationResult.ValidationResults))] | ||
public void ValidationResultsMustBeFiledAfterCreation() | ||
{ | ||
// Arrange. | ||
string errorMessage = "Test"; | ||
IEnumerable<ValidationResult> validationResults = new List<ValidationResult> | ||
{ | ||
new ValidationResult("Test 1"), | ||
new ValidationResult("Test 2") | ||
}; | ||
// Assert. | ||
Assert.ThrowsException<ArgumentNullException>(act); | ||
} | ||
|
||
// Act. | ||
ComplexTypeValidationResult validationResult = new(errorMessage, validationResults); | ||
[TestMethod] | ||
[TestProperty(TestProperties.PropertyName, nameof(ComplexTypeValidationResult.ValidationResults))] | ||
public void ValidationResultsMustBeFiledAfterCreation() | ||
{ | ||
// Arrange. | ||
const string errorMessage = "Test"; | ||
IEnumerable<ValidationResult> validationResults = new List<ValidationResult> | ||
{ | ||
new ValidationResult("Test 1"), | ||
new ValidationResult("Test 2") | ||
}; | ||
|
||
// Act. | ||
ComplexTypeValidationResult validationResult = new(errorMessage, validationResults); | ||
|
||
// Assert. | ||
CollectionAssert.AreEquivalent(validationResults.ToArray(), validationResult.ValidationResults.ToArray()); | ||
} | ||
// Assert. | ||
CollectionAssert.AreEquivalent(validationResults.ToArray(), validationResult.ValidationResults.ToArray()); | ||
} | ||
} |
Oops, something went wrong.