Exemplo n.º 1
0
        public void ProcessEvents()
        {
            var eventList      = eventStorage.Get();
            var selectedEvents = eventList.Where(x => DateTime.Today.Date >= x.EventDate.AddDays(-2).Date&& DateTime.Today.Date <= x.EventDate.Date);
            var channels       = channelFactory.GetNotificationChannels().ToList();

            foreach (var selectedEvent in selectedEvents)
            {
                channels.ForEach(c => c.SendEventNotification(selectedEvent));
            }
        }
Exemplo n.º 2
0
        public static T Get <T>(this ITableStorage storage, string tableName, string partitionKey, string rowKey) where T : class, new()
        {
            TableRow row = storage.Get(tableName, partitionKey, rowKey);

            if (row == null)
            {
                return(null);
            }

            return(converter.Convert <T>(row));
        }
Exemplo n.º 3
0
        public string Read(string key)
        {
            TableRow row = _tableStorage.Get(_tableName, _partitionKey, key);

            if (row == null)
            {
                return(null);
            }

            return(row["value"]);
        }
Exemplo n.º 4
0
        public void DeleteRows_AddTwoRows_DeletedDisappears()
        {
            var row1 = new TableRow("part1", "1")
            {
                ["col1"] = "value1"
            };
            var row2 = new TableRow("part1", "2")
            {
                ["col1"] = "value2"
            };

            _tables.Insert(_tableName, new[] { row1, row2 });
            _tables.Delete(_tableName, new[] { new TableRowId("part1", "2") });
            IEnumerable <TableRow> rows = _tables.Get(_tableName, "part1");

            Assert.Equal(1, rows.Count());
        }