Exemple #1
0
        public async Task DeleteContactAsync_WhenCalled_DeletesContact()
        {
            IMicrosoftGraphRepository sut = CreateSut();

            IName    name    = new PersonName("Albert", "Johnson");
            IContact contact = new Contact(name);

            IContact createdContact = await sut.CreateContactAsync(CreateToken(), contact);

            await sut.DeleteContactAsync(CreateToken(), createdContact.ExternalIdentifier);
        }
Exemple #2
0
        public async Task CreateContactAsync_WhenCalled_CreatesContact()
        {
            IMicrosoftGraphRepository sut = CreateSut();

            IName    name    = new PersonName("Albert", "Johnson");
            IContact contact = new Contact(name);

            IContact result = await sut.CreateContactAsync(CreateToken(), contact);

            try
            {
                Assert.That(result, Is.Not.Null);
            }
            finally
            {
                await sut.DeleteContactAsync(CreateToken(), result.ExternalIdentifier);
            }
        }
Exemple #3
0
        public async Task UpdateContactAsync_WhenCalled_CreatesContact()
        {
            IMicrosoftGraphRepository sut = CreateSut();

            IName    name    = new PersonName("Albert", "Johnson");
            IContact contact = new Contact(name);

            IContact createdContact = await sut.CreateContactAsync(CreateToken(), contact);

            try
            {
                createdContact.Address.StreetLine1 = "1234, Johnson Street";
                createdContact.Address.StreetLine2 = "Johnson Town";
                createdContact.Address.PostalCode  = "12345";
                createdContact.Address.City        = "Petersburg";
                createdContact.Address.State       = "TX";
                createdContact.Birthday            = new DateTime(1970, 7, 15);
                createdContact.HomePhone           = "+1 123 4444 5555";
                createdContact.MailAddress         = "*****@*****.**";
                IContact updatedContact = await sut.UpdateContactAsync(CreateToken(), createdContact);

                Assert.That(updatedContact, Is.Not.Null);

                updatedContact.Address.StreetLine1 = null;
                updatedContact.Address.StreetLine2 = null;
                updatedContact.Address.PostalCode  = null;
                updatedContact.Address.City        = null;
                updatedContact.Address.State       = null;
                updatedContact.Birthday            = null;
                updatedContact.HomePhone           = null;
                updatedContact.MailAddress         = null;
                updatedContact = await sut.UpdateContactAsync(CreateToken(), updatedContact);

                Assert.That(updatedContact, Is.Not.Null);
            }
            finally
            {
                await sut.DeleteContactAsync(CreateToken(), createdContact.ExternalIdentifier);
            }
        }
Exemple #4
0
        public void DeleteContactAsync_WhenIdentifierIsWhiteSpace_ThrowsArgumentNullException()
        {
            IMicrosoftGraphRepository sut = CreateSut();

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

            Assert.That(result.ParamName, Is.EqualTo("identifier"));
        }
Exemple #5
0
        public void DeleteContactAsync_WhenRefreshableTokenIsNull_ThrowsArgumentNullException()
        {
            IMicrosoftGraphRepository sut = CreateSut();

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

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