public void GetIdentity_MalformedToken_ReturnsUnauthorized() { const string TOKEN = "some"; _jwtSecurityTokenHandlerMock.Setup(x => x.CanReadToken(TOKEN)).Returns(false); var result = _manager.GetIdentity(TOKEN); Assert.IsNotNull(result); Assert.IsFalse(result.IsAuthenticated); SecurityToken token; _jwtSecurityTokenHandlerMock.Verify(x => x.ValidateToken(It.IsAny <string>(), It.IsAny <TokenValidationParameters>(), out token), Times.Never); }