示例#1
0
        public static async Task <bool> TryAddNewContactAsync()
        {
            var newContact = await ContactsSnippets.AddContactItemAsync(
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString(),
                STORY_DATA_IDENTIFIER,
                Guid.NewGuid().ToString(),
                "*****@*****.**",
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString());

            //Cleanup

            await ContactsSnippets.DeleteContactAsync(newContact.Id);

            return(newContact != null);
        }
示例#2
0
        public static async Task <bool> TryUpdateContactAsync()
        {
            var testContact = await ContactsSnippets.AddContactItemAsync(
                "FileAsValue",
                "FirstNameValue",
                STORY_DATA_IDENTIFIER,
                "JobTitleValue",
                "*****@*****.**",
                "WorkPhoneValue",
                "MobilePhoneValue");

            // Verify a valid contact id was returned
            if (testContact == null)
            {
                return(false);
            }


            // Update our contact
            await ContactsSnippets.UpdateContactItemAsync(
                testContact.Id,
                "NewFileAsValue",
                "FirstNameValue",
                STORY_DATA_IDENTIFIER,
                "NewJobTitleValue",
                "*****@*****.**",
                "WorkPhoneValue",
                "MobilePhoneValue",
                null);

            var contactCheck = await ContactsSnippets.GetContactAsync(testContact.Id);

            if (contactCheck == null)
            {
                return(false);
            }

            //Cleanup

            await ContactsSnippets.DeleteContactAsync(testContact.Id);

            return(contactCheck.FileAs == "NewFileAsValue" && contactCheck.JobTitle == "NewJobTitleValue");
        }
示例#3
0
        public static async Task <bool> TryDeleteContactAsync()
        {
            var newContact = await ContactsSnippets.AddContactItemAsync(
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString(),
                STORY_DATA_IDENTIFIER,
                Guid.NewGuid().ToString(),
                "*****@*****.**",
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString());

            // Verify a valid contact id was returned
            if (newContact == null)
            {
                return(false);
            }

            // Verify that count has increased by 1
            var contactCheck = await ContactsSnippets.GetContactAsync(newContact.Id);

            if (contactCheck == null)
            {
                return(false);
            }

            // Delete contact we added
            var contactDeleted = await ContactsSnippets.DeleteContactAsync(newContact.Id);

            if (!contactDeleted)
            {
                return(false);
            }


            contactCheck = await ContactsSnippets.GetContactAsync(newContact.Id);

            return(contactCheck == null);
        }
示例#4
0
        public static async Task <bool> TryGetContactsAsync()
        {
            var contacts = await ContactsSnippets.GetContactsPageAsync();

            return(contacts != null);
        }
示例#5
0
        public static async Task <bool> TryGetOutlookClientAsync()
        {
            var outlookClient = await ContactsSnippets.GetOutlookClientAsync();

            return(outlookClient != null);
        }