public void UpdateUserAttributes_Then_RemoveUserAttributes_Returns_ExpectedAttributes()
        {
            // setup
            latch = new CountdownEvent(1);
            // test
            var attributes = new Dictionary <string, Java.Lang.Object>();

            attributes.Add("key1", "value1");
            attributes.Add("key2", "value2");
            attributes.Add("key3", "value3");
            attributes.Add("key4", "value4");
            ACPUserProfile.UpdateUserAttributes(attributes);
            var keysToRemove = new List <string>();

            keysToRemove.Add("key1");
            keysToRemove.Add("key3");
            ACPUserProfile.RemoveUserAttributes(keysToRemove);
            var keysToRetrieve = new List <string>();

            keysToRetrieve.Add("key1");
            keysToRetrieve.Add("key2");
            keysToRetrieve.Add("key3");
            keysToRetrieve.Add("key4");
            ACPUserProfile.GetUserAttributes(keysToRetrieve, new AdobeCallback());
            latch.Wait(1000);
            // verify
            Assert.That(callbackString.Contains("[ key2 : value2 ]"));
            Assert.That(callbackString.Contains("[ key4 : value4 ]"));
        }
Пример #2
0
    void GetUserAttributes()
    {
        Debug.Log("Calling GetUserAttributes");
        var attributeKeys = new List <string>();

        attributeKeys.Add("attrNameTest");
        attributeKeys.Add("mapKey");
        ACPUserProfile.GetUserAttributes(attributeKeys, HandleAdobeGetUserAttributesCallback);
    }
Пример #3
0
 public void UpdateUserAttribute_Then_GetUserAttributes_Returns_ExpectedAttributes()
 {
     // setup
     latch = new CountdownEvent(1);
     // test
     ACPUserProfile.UpdateUserAttribute("key", "value");
     string[] attributes = new string[] { "key" };
     ACPUserProfile.GetUserAttributes(attributes, callback);
     latch.Wait(1000);
     // verify
     Assert.That(callbackString, Is.EqualTo("[ key : value ]"));
 }
        public void UpdateUserAttribute_Then_GetUserAttributes_Returns_ExpectedAttributes()
        {
            // setup
            latch = new CountdownEvent(1);
            // test
            ACPUserProfile.UpdateUserAttribute("key", "value");
            var attributes = new List <string>();

            attributes.Add("key");
            ACPUserProfile.GetUserAttributes(attributes, new AdobeCallback());
            latch.Wait(1000);
            // verify
            Assert.That(callbackString, Is.EqualTo("[ key : value ]"));
        }
        public TaskCompletionSource <string> GetUserAttributes()
        {
            latch        = new CountdownEvent(1);
            stringOutput = new TaskCompletionSource <string>();
            var attributes = new List <string>();

            attributes.Add("firstName");
            attributes.Add("lastName");
            attributes.Add("vehicle");
            attributes.Add("color");
            attributes.Add("insured");
            attributes.Add("age");
            ACPUserProfile.GetUserAttributes(attributes, new AdobeCallback());
            latch.Wait(1000);
            latch.Dispose();
            stringOutput.SetResult(callbackString);
            return(stringOutput);
        }
Пример #6
0
        public void UpdateUserAttributes_Then_GetUserAttributes_Returns_ExpectedAttributes()
        {
            // setup
            latch = new CountdownEvent(1);
            // test
            var attributes = new NSMutableDictionary <NSString, NSString>
            {
                ["key1"] = new NSString("value1"),
                ["key2"] = new NSString("value2")
            };

            ACPUserProfile.UpdateUserAttributes(attributes);
            string[] attributeKeys = new string[] { "key1", "key2" };
            ACPUserProfile.GetUserAttributes(attributeKeys, callback);
            latch.Wait(1000);
            // verify
            Assert.That(callbackString.Contains("[ key1 : value1 ]"));
            Assert.That(callbackString.Contains("[ key2 : value2 ]"));
        }
        public void UpdateUserAttributes_Then_RemoveUserAttribute_Returns_ExpectedAttributes()
        {
            // setup
            latch = new CountdownEvent(1);
            // test
            var attributes = new Dictionary <string, Java.Lang.Object>();

            attributes.Add("key1", "value1");
            attributes.Add("key2", "value2");
            ACPUserProfile.UpdateUserAttributes(attributes);
            ACPUserProfile.RemoveUserAttribute("key1");
            var attributeKeys = new List <string>();

            attributeKeys.Add("key1");
            attributeKeys.Add("key2");
            ACPUserProfile.GetUserAttributes(attributeKeys, new AdobeCallback());
            latch.Wait(1000);
            // verify
            Assert.That(callbackString, Is.EqualTo("[ key2 : value2 ]"));
        }
Пример #8
0
        public TaskCompletionSource <string> GetUserAttributes()
        {
            latch        = new CountdownEvent(1);
            stringOutput = new TaskCompletionSource <string>();
            Action <NSDictionary, NSError> callback = (content, error) =>
            {
                callbackString = "";
                if (error != null)
                {
                    string message = "GetUserAttributes error:" + error.DebugDescription;
                    Console.WriteLine(message);
                    callbackString = message;
                }
                else if (content == null)
                {
                    string message = "GetUserAttributes callback is null.";
                    Console.WriteLine(message);
                    callbackString = message;
                }
                else
                {
                    foreach (KeyValuePair <NSObject, NSObject> pair in content)
                    {
                        callbackString = callbackString + "[ " + pair.Key + ": " + pair.Value + " ]";
                    }
                    Console.WriteLine("Retrieved attributes: " + callbackString);
                }
                if (latch != null)
                {
                    latch.Signal();
                }
            };

            string[] attributes = new string[] { "firstName", "lastName", "vehicle", "color", "insured", "age" };
            ACPUserProfile.GetUserAttributes(attributes, callback);
            latch.Wait(1000);
            latch.Dispose();
            stringOutput.SetResult(callbackString);
            return(stringOutput);
        }