示例#1
0
        static void Main(string[] args)
        {
            var client       = new ReminderStorageWebApiClient("https://localhost:5001");
            var reminderItem = new ReminderItemRestricted
            {
                ContactId = "TestContactId",
                Date      = DateTimeOffset.Now,
                Message   = "Test Message"
            };

            Guid id = client.Add(reminderItem);

            Console.WriteLine("Adding done");

            var reminderItemFromStorage = client.Get(id);

            Console.WriteLine(
                "Reading done:\n" +
                $"{reminderItemFromStorage.Id}\n" +
                $"{reminderItemFromStorage.ContactId}\n" +
                $"{reminderItemFromStorage.Date}\n" +
                $"{reminderItemFromStorage.Message}\n");

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            IReminderStorage storageClient = new ReminderStorageWebApiClient(
                "http://localhost:5000/api/reminders");

            // Check that without data storage returns empty list
            var emptyList = storageClient.Get(ReminderItemStatus.Awaiting);

            if (emptyList == null || emptyList.Count > 0)
            {
                throw new Exception();
            }

            // Add reminder item
            var id = storageClient.Add(
                DateTimeOffset.Now.AddMinutes(1),
                "Test Message",
                "12345678",
                ReminderItemStatus.Awaiting);

            // Check that just added reminder item returned by ID
            var item = storageClient.Get(id);

            if (item == null)
            {
                throw new Exception();
            }

            // Check that just added reminder item returned by status
            var awaitngList = storageClient.Get(ReminderItemStatus.Awaiting);

            if (awaitngList == null || awaitngList.Count != 1)
            {
                throw new Exception();
            }

            // Check that Get() by status returns empty list if no corresponding items found
            var readyList = storageClient.Get(ReminderItemStatus.Ready);

            if (readyList == null || readyList.Count != 0)
            {
                throw new Exception();
            }

            // Update item's status
            storageClient.Update(id, ReminderItemStatus.Failed);

            // Check that Get() by status returns not empty list
            var faliedList = storageClient.Get(ReminderItemStatus.Failed);

            if (faliedList == null || faliedList.Count != 1)
            {
                throw new Exception();
            }
        }
示例#3
0
        static void Main()
        {
            var client       = new ReminderStorageWebApiClient("https://localhost:5001");
            var reminderItem = new ReminderItem
            {
                ContactId = "TestContactId",
                Date      = DateTimeOffset.Now,
                Message   = "Test message"
            };

            client.Add(reminderItem);
        }
示例#4
0
        static void Main(string[] args)
        {
            var client       = new ReminderStorageWebApiClient("https://localhost:5001");
            var reminderItem = new ReminderItem
            {
                ContactId = "TestContactId",
                Date      = DateTimeOffset.Now,
                Message   = "Test"
            };

            client.Add(reminderItem);

            Console.WriteLine("f");
        }
        static void Main(string[] args)
        {
            var client = new ReminderStorageWebApiClient("https://localhost:5001");

            var reminderItem = new ReminderItemRestricted()
            {
                Date      = DateTimeOffset.Now,
                ContactId = "TestContactId",
                Message   = "TestMessage"
            };

            // где-то здесь в методе Add в storage id присываивается не тот, который нужен
            var id = client.Add(reminderItem);

            Console.WriteLine("Adding done");

            var reminderItemFromStorage = client.Get(id);

            Console.WriteLine($"Reading done:\n" +
                              $"{reminderItemFromStorage.Id}\n" +
                              $"{reminderItemFromStorage.Date}\n" +
                              $"{reminderItemFromStorage.ContactId}\n" +
                              $"{reminderItemFromStorage.Message}\n");
        }