コード例 #1
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsAddAndRemoveTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            string Email = DateTime.Now.ToString("yymmdd-hhMMss") + "@test.com";
            Dictionary <string, string> OtherFields = null; // new Dictionary<string, string>() ;
            //int GroupID = 1;
            List <int> GroupID = new List <int>()
            {
                1
            };
            bool OverruleUnsubscribedBounced = false;
            bool expectedAdd = true;
            bool actualAdd;

            // Add contact to group
            actualAdd = target.ContactsAdd(Email, GroupID, OtherFields, OverruleUnsubscribedBounced);

            Assert.AreEqual(expectedAdd, actualAdd);

            // remove Contact from group
            bool actualDelete = true;

            actualDelete = target.ContactsDelete(Email, GroupID);

            Assert.IsTrue(actualDelete);
        }
コード例 #2
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ClearExceptionsTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            target.ClearExceptions();

            Assert.Equals(target.Exceptions.Count, 0);
        }
コード例 #3
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ApiUsernameTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            string actual;

            actual = target.ApiUsername;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #4
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ExceptionsTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Exception> actual;

            actual = target.Exceptions;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #5
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void SecureTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            bool actual;

            actual = target.Secure;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #6
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        private static Prompt.Ymlp.YmlpConnector InitializeApi()
        {
            string ApiKey      = DefaultValues.YmlpKey;
            string ApiUsername = DefaultValues.YmlpUser;
            bool   secure      = false;

            Prompt.Ymlp.YmlpConnector target = new Prompt.Ymlp.YmlpConnector(ApiKey, ApiUsername, secure);
            return(target);
        }
コード例 #7
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void GroupsDeleteTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            int  GroupId  = 2;    // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;

            actual = target.GroupsDelete(GroupId);
            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void PingTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            YmlpResponse actual;

            actual = target.Ping();

            Assert.AreEqual(0, actual.Code);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #9
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void GroupsUpdateTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            int    GroupId   = 1;
            string GroupName = "TestName";

            bool actual;

            actual = target.GroupsUpdate(GroupId, GroupName);
            Assert.IsTrue(actual);
        }
コード例 #10
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void GroupsAddTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            string GroupName = string.Empty; // TODO: Initialize to an appropriate value
            bool   expected  = false;        // TODO: Initialize to an appropriate value
            bool   actual;

            actual = target.GroupsAdd(GroupName);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #11
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void YmlpApiConstructorTest()
        {
            string ApiKey      = DefaultValues.YmlpKey;
            string ApiUsername = DefaultValues.YmlpUser;
            bool   secure      = false;

            Prompt.Ymlp.YmlpConnector target = new Prompt.Ymlp.YmlpConnector(ApiKey, ApiUsername, secure);

            Assert.AreEqual(ApiKey, target.ApiKey);
            Assert.AreEqual(ApiUsername, target.ApiUsername);
            Assert.AreEqual(secure, target.Secure);
        }
コード例 #12
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsUnsubscribeTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            string Email = "*****@*****.**";

            bool expected = true;
            bool actual;

            actual = target.ContactsUnsubscribe(Email);
            Assert.AreEqual(expected, actual);
            Assert.IsNull(target.Exceptions);
        }
コード例 #13
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void FieldsGetListTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Field> FieldList         = null;  // TODO: Initialize to an appropriate value
            List <Field> FieldListExpected = null;  // TODO: Initialize to an appropriate value
            bool         expected          = false; // TODO: Initialize to an appropriate value
            bool         actual;

            actual = target.FieldsGetList(out FieldList);
            Assert.AreEqual(FieldListExpected, FieldList);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #14
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsGetDeletedTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Contact> ContactList = null;

            bool expected = true;
            bool actual;

            actual = target.ContactsGetDeleted(out ContactList);

            Assert.AreEqual(expected, actual);
            Assert.IsNotNull(ContactList);
        }
コード例 #15
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void GroupsEmptyTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            int  GroupId  = 2;
            bool expected = true;
            bool actual;

            actual = target.GroupsEmpty(GroupId);
            Assert.AreEqual(expected, actual);

            // Todo: check # contacts in group ==> now 0
            //target.ContactsGetList(List<YmlpContact> contactslist, GroupId,
        }
コード例 #16
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsGetContactTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            string  Email    = "*****@*****.**";
            Contact expected = new Contact()
            {
                EmailAddress = Email
            };                                                         // TODO: Initialize to an appropriate value
            Contact actual;
            bool    retVal = target.ContactsGetContact(Email, out actual);

            Assert.IsTrue(retVal);
            Assert.AreEqual(expected, actual);
        }
コード例 #17
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void FieldsUpdateTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            int    FieldId          = 1;
            string FieldName        = "testfield1";
            string Alias            = string.Empty;
            string DefaultValue     = string.Empty;
            bool   CorrectUppercase = false;
            bool   expected         = true;
            bool   actual;

            actual = target.FieldsUpdate(FieldId, FieldName, Alias, DefaultValue, CorrectUppercase);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #18
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsGetBouncedTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Contact> contacts;
            //List<int> FieldID = new List<int>();
            //int? Page = 0;
            //int? NumberPerPage = 0;
            //Nullable<DateTime> StartDate = new Nullable<DateTime>(); // TODO: Initialize to an appropriate value
            //Nullable<DateTime> StopDate = new Nullable<DateTime>(); // TODO: Initialize to an appropriate value

            bool actual;

            actual = target.ContactsGetBounced(out contacts);
            Assert.IsTrue(actual);
        }
コード例 #19
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void GroupsGetListTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Group> Groups;
            //List<YmlpGroup> GroupsExpected = null; //
            bool expected = true; // should be true (no errors)
            bool actual;

            actual = target.GroupsGetList(out Groups);

            //Assert.AreEqual(GroupsExpected, Groups);  // Can't guess the result form a webservice
            Assert.AreEqual(expected, actual);
            Assert.IsNull(target.Exceptions);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #20
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsGetListTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Contact> ContactList = null;
            int?           GroupID     = 1;
            List <int>     FieldID     = null;
            //            Nullable<int> Page = new Nullable<int>();
            //            Nullable<int> NumberPerPage = new Nullable<int>();
            //            Nullable<DateTime> StartDate = DateTime.Now;
            //            Nullable<DateTime> StopDate = DateTime.Now;

            bool expected = true;
            bool actual;

            actual = target.ContactsGetList(out ContactList, GroupID, FieldID);
            Assert.IsNotNull(ContactList);
            Assert.AreEqual(expected, actual);
        }
コード例 #21
0
ファイル: YmlpApiTest.cs プロジェクト: dampee/YMLP
        public void ContactsGetUnsubscribedTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Contact>      ContactList   = null;
            List <int>          FieldID       = null;
            int?                Page          = null;
            int?                NumberPerPage = null;
            Nullable <DateTime> StartDate     = null;
            Nullable <DateTime> StopDate      = null;

            bool expected = true;
            bool actual;

            actual = target.ContactsGetUnsubscribed(out ContactList, FieldID, Page, NumberPerPage, StartDate, StopDate);
            Assert.AreEqual(expected, actual);
            Assert.IsNotNull(ContactList);
            Assert.IsNull(target.Exceptions);
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: dampee/YMLP
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            bool          secure = false;
            YmlpConnector proxy  = new Prompt.Ymlp.YmlpConnector(YmlpKey, YmlpUser, secure);

            Console.WriteLine("Available fields");
            List <Field> fl;

            if (proxy.FieldsGetList(out fl) == false)
            {
                Console.WriteLine("Error getting Field list");
                PrintExceptions(proxy.Exceptions);
                return;
            }
            else
            {
                foreach (var i in fl)
                {
                    Console.WriteLine("id: {0} / field: {1}", i.Id, i.FieldName);
                }
            }

            List <Group> grouplist;

            if (proxy.GroupsGetList(out grouplist) == false)
            {
                Console.WriteLine("Error getting groups, exit!");
                PrintExceptions(proxy.Exceptions);
                return;
            }

            foreach (var group in grouplist)
            {
                // Get all information about all contacts in a group
                Console.WriteLine("GROUP  ---  {0} (id: {1}, # contacts: {2})", group.GroupName, group.Id, group.NumberOfContacts);

                // Get all the available fields
                var            fieldlist = fl.Select(f => f.Id).ToList();
                List <Contact> cl;
                if (proxy.ContactsGetList(out cl, group.Id, fieldlist) == false)
                {
                    Console.WriteLine("Error getting contacts");
                    PrintExceptions(proxy.Exceptions);
                    return;
                }
                else
                {
                    // Loop all contacts
                    foreach (var contact in cl)
                    {
                        Console.WriteLine("contact e-mail: {0}", contact.EmailAddress);
                        Console.WriteLine("        state : {0}", contact.State);
                        Console.WriteLine("        create: {0}", contact.CreateDate);
                        if (contact.Fields.Count > 0)
                        {
                            Console.WriteLine("        Extra fields found");
                        }
                        foreach (var field in contact.Fields)
                        {
                            // For every contact print all fields from that contact
                            Console.WriteLine(" {0,22}: {1}", field.Key, field.Value);
                        }
                    }
                }
            }
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }