/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Identity/test/Identity.Test/RoleValidatorTest.cs
37 строк
1 KB
Shreyas Jejurkar
chore : Remove unwanted `using` statement (#39176)
02 янв 2022, 17:39
Не верифицирован
02 янв 2022, 17:39
c85baf8
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.AspNetCore.Identity.Test; public class RoleValidatorTest { [Fact] public async Task ValidateThrowsWithNull() { // Setup var validator = new RoleValidator<PocoRole>(); var manager = MockHelpers.TestRoleManager<PocoRole>(); // Act // Assert await Assert.ThrowsAsync<ArgumentNullException>("manager", async () => await validator.ValidateAsync(null, null)); await Assert.ThrowsAsync<ArgumentNullException>("role", async () => await validator.ValidateAsync(manager, null)); } [Theory] [InlineData(null)] [InlineData("")] public async Task ValidateFailsWithTooShortRoleName(string input) { // Setup var validator = new RoleValidator<PocoRole>(); var manager = MockHelpers.TestRoleManager<PocoRole>(); var user = new PocoRole { Name = input }; // Act var result = await validator.ValidateAsync(manager, user); // Assert IdentityResultAssert.IsFailure(result, new IdentityErrorDescriber().InvalidRoleName(input)); } }