public async Task GetContactAsync_WhenCalled_ReturnsContact(string identifier)
        {
            IMicrosoftGraphRepository sut = CreateSut();

            IContact result = await sut.GetContactAsync(CreateToken(), identifier);

            Assert.That(result, Is.Not.Null);
        }
        internal static IContact GetContact(this string externalIdentifier, IRefreshableToken token, IMicrosoftGraphRepository microsoftGraphRepository, IContactRepository contactRepository, ref IContact contact)
        {
            NullGuard.NotNullOrWhiteSpace(externalIdentifier, nameof(externalIdentifier))
            .NotNull(token, nameof(token))
            .NotNull(microsoftGraphRepository, nameof(microsoftGraphRepository))
            .NotNull(contactRepository, nameof(contactRepository));

            if (contact != null)
            {
                return(contact);
            }

            contact = microsoftGraphRepository.GetContactAsync(token, externalIdentifier).GetAwaiter().GetResult();

            return(contact == null ? null : contactRepository.ApplyContactSupplementAsync(contact).GetAwaiter().GetResult());
        }
        public void GetContactAsync_WhenIdentifierIsWhiteSpace_ThrowsArgumentNullException()
        {
            IMicrosoftGraphRepository sut = CreateSut();

            ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.GetContactAsync(_fixture.BuildRefreshableTokenMock().Object, " "));

            Assert.That(result.ParamName, Is.EqualTo("identifier"));
        }
        public void GetContactAsync_WhenRefreshableTokenIsNull_ThrowsArgumentNullException()
        {
            IMicrosoftGraphRepository sut = CreateSut();

            ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.GetContactAsync(null, _fixture.Create <string>()));

            Assert.That(result.ParamName, Is.EqualTo("refreshableToken"));
        }