Beispiel #1
0
        public void ThrowArgumentNulLException_WhenAuthUserParameterIsNull()
        {
            // Arrange
            var authSignInManagerProvider = new Mock <IAuthSignInManagerProvider>();
            var authUserManagerProvider   = new Mock <IAuthUserManagerProvider>();

            var identityAuthAccountService = new IdentityAuthAccountService(authSignInManagerProvider.Object, authUserManagerProvider.Object);

            AuthUser user = null;

            // Act & Assert
            Assert.That(
                async() => await identityAuthAccountService.SignInAsync(user),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(AuthUser)));
        }
Beispiel #2
0
        public async Task InvokeIAuthSignInManagerProvider_SignInManagerPropertySignInAsyncMethodOnceWithCorrectParameters()
        {
            // Arrange
            var authSignInManagerProvider = new Mock <IAuthSignInManagerProvider>();
            var authUserManagerProvider   = new Mock <IAuthUserManagerProvider>();

            var identityAuthAccountService = new IdentityAuthAccountService(authSignInManagerProvider.Object, authUserManagerProvider.Object);

            var user = new AuthUser();

            var signInManager = new Mock <IAuthSignInManager>();

            authSignInManagerProvider.SetupGet(m => m.SignInManager).Returns(signInManager.Object);

            var isPersistent    = false;
            var rememberBrowser = false;

            // Act
            await identityAuthAccountService.SignInAsync(user);

            // Assert
            signInManager.Verify(m => m.SignInAsync(user, isPersistent, rememberBrowser), Times.Once);
        }