public async Task Dequeue_PendingAndAlreadyProcessedItem_ReturnsPendingItem(QueueItemStatus status) { using (var scope = new IsolationScope(TestFixtureContext.Provider)) { var connection = scope.Provider.GetRequiredService <IDbConnection>(); await connection.ExecuteSqlAsync("INSERT INTO Kiukie.Queue(StatusId, Payload) OUTPUT Inserted.Id VALUES(@StatusId, @Payload)", new StringItem(status, "Processed")); await connection.ExecuteSqlAsync("INSERT INTO Kiukie.Queue(StatusId, Payload) OUTPUT Inserted.Id VALUES(@StatusId, @Payload)", new StringItem(QueueItemStatus.Pending, "Pending")); var queue = CreateQueue(connection); var item = await queue.DequeueAsync(); Assert.IsNotNull(item); Assert.AreEqual("Pending", item.Payload); } }
/// <summary> /// Convert a boolean to visibility property. /// </summary> /// <param name="value"> /// The value. /// </param> /// <param name="targetType"> /// The target type. /// </param> /// <param name="parameter"> /// The parameter. (A boolean which inverts the output) /// </param> /// <param name="culture"> /// The culture. /// </param> /// <returns> /// Visibility property /// </returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { QueueItemStatus status = (QueueItemStatus)value; switch (status) { case QueueItemStatus.Waiting: case QueueItemStatus.InProgress: return(Visibility.Collapsed); default: return(Visibility.Visible); } } return(Visibility.Collapsed); }
public StringItem(QueueItemStatus status, string payload) { StatusId = (int)status; Payload = payload; }
public QueueItem(string fullPathForItem) { fullPath = fullPathForItem; status = QueueItemStatus.Pending; }