Changed cast style as suggested, improved some member names to make them less ambiguous

This commit is contained in:
Ben Magee 2019-12-22 23:21:20 +00:00
parent 00c6d392a1
commit d1461b4238
No known key found for this signature in database
GPG Key ID: F03F50C6333B2D9F

View File

@ -23,8 +23,8 @@ namespace Jellyfin.Api.Tests.Auth
{ {
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly Mock<IAuthService> _authServiceMock; private readonly Mock<IAuthService> _jellyfinAuthServiceMock;
private readonly Mock<IOptionsMonitor<AuthenticationSchemeOptions>> _optionsMock; private readonly Mock<IOptionsMonitor<AuthenticationSchemeOptions>> _optionsMonitorMock;
private readonly Mock<ISystemClock> _clockMock; private readonly Mock<ISystemClock> _clockMock;
private readonly Mock<IServiceProvider> _serviceProviderMock; private readonly Mock<IServiceProvider> _serviceProviderMock;
private readonly Mock<IAuthenticationService> _authenticationServiceMock; private readonly Mock<IAuthenticationService> _authenticationServiceMock;
@ -44,8 +44,8 @@ namespace Jellyfin.Api.Tests.Auth
_fixture = new Fixture().Customize(fixtureCustomizations); _fixture = new Fixture().Customize(fixtureCustomizations);
AllowFixtureCircularDependencies(); AllowFixtureCircularDependencies();
_authServiceMock = _fixture.Freeze<Mock<IAuthService>>(); _jellyfinAuthServiceMock = _fixture.Freeze<Mock<IAuthService>>();
_optionsMock = _fixture.Freeze<Mock<IOptionsMonitor<AuthenticationSchemeOptions>>>(); _optionsMonitorMock = _fixture.Freeze<Mock<IOptionsMonitor<AuthenticationSchemeOptions>>>();
_clockMock = _fixture.Freeze<Mock<ISystemClock>>(); _clockMock = _fixture.Freeze<Mock<ISystemClock>>();
_serviceProviderMock = _fixture.Freeze<Mock<IServiceProvider>>(); _serviceProviderMock = _fixture.Freeze<Mock<IServiceProvider>>();
_authenticationServiceMock = _fixture.Freeze<Mock<IAuthenticationService>>(); _authenticationServiceMock = _fixture.Freeze<Mock<IAuthenticationService>>();
@ -56,7 +56,7 @@ namespace Jellyfin.Api.Tests.Auth
_serviceProviderMock.Setup(s => s.GetService(typeof(IAuthenticationService))) _serviceProviderMock.Setup(s => s.GetService(typeof(IAuthenticationService)))
.Returns(_authenticationServiceMock.Object); .Returns(_authenticationServiceMock.Object);
_optionsMock.Setup(o => o.Get(It.IsAny<string>())) _optionsMonitorMock.Setup(o => o.Get(It.IsAny<string>()))
.Returns(new AuthenticationSchemeOptions .Returns(new AuthenticationSchemeOptions
{ {
ForwardAuthenticate = null ForwardAuthenticate = null
@ -79,11 +79,11 @@ namespace Jellyfin.Api.Tests.Auth
[Fact] [Fact]
public async Task HandleAuthenticateAsyncShouldFailWithNullUser() public async Task HandleAuthenticateAsyncShouldFailWithNullUser()
{ {
_authServiceMock.Setup( _jellyfinAuthServiceMock.Setup(
a => a.Authenticate( a => a.Authenticate(
It.IsAny<HttpRequest>(), It.IsAny<HttpRequest>(),
It.IsAny<AuthenticatedAttribute>())) It.IsAny<AuthenticatedAttribute>()))
.Returns((User) null); .Returns((User)null);
var authenticateResult = await _sut.AuthenticateAsync(); var authenticateResult = await _sut.AuthenticateAsync();
@ -96,7 +96,7 @@ namespace Jellyfin.Api.Tests.Auth
{ {
var errorMessage = _fixture.Create<string>(); var errorMessage = _fixture.Create<string>();
_authServiceMock.Setup( _jellyfinAuthServiceMock.Setup(
a => a.Authenticate( a => a.Authenticate(
It.IsAny<HttpRequest>(), It.IsAny<HttpRequest>(),
It.IsAny<AuthenticatedAttribute>())) It.IsAny<AuthenticatedAttribute>()))
@ -153,7 +153,7 @@ namespace Jellyfin.Api.Tests.Auth
var user = _fixture.Create<User>(); var user = _fixture.Create<User>();
user.Policy.IsAdministrator = isAdmin; user.Policy.IsAdministrator = isAdmin;
_authServiceMock.Setup( _jellyfinAuthServiceMock.Setup(
a => a.Authenticate( a => a.Authenticate(
It.IsAny<HttpRequest>(), It.IsAny<HttpRequest>(),
It.IsAny<AuthenticatedAttribute>())) It.IsAny<AuthenticatedAttribute>()))