Пример #1
0
        public void LiteDbConnectionInformation_Test()
        {
            var test = new LiteDbConnectionInformation(new QueueConnection("blah", GoodConnection));

            Assert.Equal("blah", test.QueueName);
            Assert.Equal(GoodConnection, test.ConnectionString);
        }
 public VerifyQueueRecordCount(string queueName, string connectionString, LiteDbMessageQueueTransportOptions options, ICreationScope scope)
 {
     _options         = options;
     _connection      = new LiteDbConnectionInformation(new QueueConnection(queueName, connectionString));
     _tableNameHelper = new TableNameHelper(_connection);
     _scope           = scope;
 }
 public VerifyQueueData(QueueConnection queueConnection, LiteDbMessageQueueTransportOptions options, ICreationScope scope)
 {
     _options         = options;
     _connection      = new LiteDbConnectionInformation(queueConnection);
     _tableNameHelper = new TableNameHelper(_connection);
     _scope           = scope;
 }
Пример #4
0
        public static void SetError(QueueConnection queueConnection, ICreationScope scope)
        {
            var connection = new LiteDbConnectionInformation(queueConnection);
            var helper     = new TableNameHelper(connection);
            var connScope  = scope.GetDisposable <LiteDbConnectionManager>();

            if (connScope == null)
            {
                using (var conn = new LiteDatabase(connection.ConnectionString))
                {
                    var col     = conn.GetCollection <Schema.StatusTable>(helper.StatusName);
                    var results = col.Query()
                                  .ToList();
                    foreach (var result in results)
                    {
                        result.Status = QueueStatuses.Error;
                        col.Update(result);
                    }
                }
            }
            else
            {
                using (var conn = connScope.GetDatabase())
                {
                    var col     = conn.Database.GetCollection <Schema.StatusTable>(helper.StatusName);
                    var results = col.Query()
                                  .ToList();
                    foreach (var result in results)
                    {
                        result.Status = QueueStatuses.Error;
                        col.Update(result);
                    }
                }
            }
        }
Пример #5
0
        public void Clone_Test()
        {
            var test  = new LiteDbConnectionInformation(new QueueConnection("blah", GoodConnection));
            var clone = test.Clone();

            Assert.Equal(test.ConnectionString, clone.ConnectionString);
            Assert.Equal(test.QueueName, clone.QueueName);
        }
Пример #6
0
        public static void Verify(QueueConnection queueConnection, long messageCount, ICreationScope scope)
        {
            var connection = new LiteDbConnectionInformation(queueConnection);
            var helper     = new TableNameHelper(connection);
            var connScope  = scope.GetDisposable <LiteDbConnectionManager>();

            if (connScope == null)
            {
                using (var conn = new LiteDatabase(connection.ConnectionString))
                {
                    var col = conn.GetCollection <Schema.MetaDataTable>(helper.MetaDataName);
                    Assert.Equal(messageCount, col.Count());
                }
            }
            else
            {
                using (var conn = connScope.GetDatabase())
                {
                    var col = conn.Database.GetCollection <Schema.MetaDataTable>(helper.MetaDataName);
                    Assert.Equal(messageCount, col.Count());
                }
            }
        }
 public VerifyErrorCounts(string queueName, string connectionString, ICreationScope scope)
 {
     _connection      = new LiteDbConnectionInformation(new QueueConnection(queueName, connectionString));
     _tableNameHelper = new TableNameHelper(_connection);
     _scope           = scope;
 }