示例#1
0
        public void GetListRepository_ApiIsInitialized_CreatesListRepository()
        {
            Rtm.Init("test", "test");
            var actual = Rtm.GetListRepository(new AuthenticationToken());

            Assert.IsInstanceOf <ListRepository>(actual);
        }
示例#2
0
        public void GetAuthFactory_ApiIsInitialized_CreatesAuthFactory()
        {
            Rtm.Init("test", "test");
            var actual = Rtm.GetAuthFactory();

            Assert.IsInstanceOf <AuthFactory>(actual);
        }
示例#3
0
        private static async Task Run()
        {
            // Initialize the API with your personal API Key and Shared Secret issued by Remember the Milk.  Do this once per runtime session.
            var configs = LoadApiConfigs();

            Rtm.Init(configs.ApiKey, configs.SharedSecret);

            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("---------------------------------------------------------");
                Console.WriteLine("Main Menu - Select an option:");
                Console.WriteLine();
                Console.WriteLine("   1) Authentication Examples");
                Console.WriteLine("   2) List Examples");
                Console.WriteLine("   3) Task Examples");
                Console.WriteLine("   4) Location Examples");
                Console.WriteLine();
                Console.WriteLine("   0) Exit");
                Console.WriteLine();
                Console.WriteLine("---------------------------------------------------------");
                Console.WriteLine();
                Console.Write("--> ");
                var input = Console.ReadLine();

                switch (input)
                {
                case "1":
                    await AuthenticationExamples.Run().ConfigureAwait(false);

                    break;

                case "2":
                    await ListExamples.Run().ConfigureAwait(false);

                    break;

                case "3":
                    await TasksExamples.Run().ConfigureAwait(false);

                    break;

                case "4":
                    await LocationExamples.Run().ConfigureAwait(false);

                    break;

                case "0":
                    return;

                default:
                    Console.WriteLine("Invalid Entry");
                    break;
                }
            }
        }
示例#4
0
        public void Init_ValidArgs_InitializesApi()
        {
            const string apiKey       = "My API Key";
            const string sharedSecret = "My Shared Secret";

            Rtm.Init(apiKey, sharedSecret);

            Assert.AreEqual(apiKey, Rtm.ApiKey);
            Assert.AreEqual(sharedSecret, Rtm.SharedSecret);
        }
示例#5
0
 public void GetListRepository_NullToken_ThrowsArgumentNullException()
 {
     Rtm.Init("test", "test");
     Assert.Throws <ArgumentNullException>(() => Rtm.GetListRepository(null));
 }
示例#6
0
 public void Init_NullValues_ThrowsArgumentNullException(string apiKey, string sharedSecret)
 {
     Assert.Throws <ArgumentNullException>(() => Rtm.Init(apiKey, sharedSecret));
 }