GetExternalUserInformation() public method

public GetExternalUserInformation ( Microsoft.AspNetCore.Identity.ExternalLoginInfo externalLoginInfo ) : Task
externalLoginInfo Microsoft.AspNetCore.Identity.ExternalLoginInfo
return Task
        public async Task ReturnCorrectExternalUserInformationWhenTwitterAccountIsNull()
        {
            var sut = new TwitterExternalUserInformationProvider(Mock.Of<ITwitterRepository>());
            var result = await sut.GetExternalUserInformation(new ExternalLoginInfo(new ClaimsPrincipal(), null, null, null));

            Assert.Null(result.Email);
            Assert.Null(result.FirstName);
            Assert.Null(result.LastName);
        }
        public async Task ReturnCorrectExternalUserInformationWhenTwitterAccountUserIsNull()
        {
            var twitterRepository = new Mock<ITwitterRepository>();
            twitterRepository.Setup(x => x.GetTwitterAccount(It.IsAny<string>(), It.IsAny<string>())).ReturnsAsync(new Account());

            var sut = new TwitterExternalUserInformationProvider(twitterRepository.Object);
            var result = await sut.GetExternalUserInformation(new ExternalLoginInfo(new ClaimsPrincipal(), null, null, null));

            Assert.Null(result.Email);
            Assert.Null(result.FirstName);
            Assert.Null(result.LastName);
        }
        public async Task ReturnCorrectExternalUserInformationWhenTwitterUserNameIsEmpty()
        {
            const string email = "email";

            var twitterRepository = new Mock<ITwitterRepository>();
            twitterRepository.Setup(x => x.GetTwitterAccount(It.IsAny<string>(), It.IsAny<string>())).ReturnsAsync(new Account { User = new User { Name = string.Empty, Email = email } });

            var sut = new TwitterExternalUserInformationProvider(twitterRepository.Object);
            var result = await sut.GetExternalUserInformation(new ExternalLoginInfo(new ClaimsPrincipal(), null, null, null));

            Assert.Equal(result.Email, email);
            Assert.Null(result.FirstName);
            Assert.Null(result.LastName);
        }
        public async Task InvokeGetTwitterAccountWithCorrectParameters()
        {
            const string userId = "UserId";
            const string screenName = "ScreenName";

            var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[]
            {
                new Claim("urn:twitter:userid", userId),
                new Claim("urn:twitter:screenname", screenName)
            }));

            var twitterRepository = new Mock<ITwitterRepository>();

            var sut = new TwitterExternalUserInformationProvider(twitterRepository.Object);
            await sut.GetExternalUserInformation(new ExternalLoginInfo(claimsPrincipal, null, null, null));

            twitterRepository.Verify(x => x.GetTwitterAccount(userId, screenName), Times.Once);
        }