public SqsTestContext(object fixture)
        {
            Address = new Address(fixture.GetType().Name, Environment.MachineName);
			ConnectionConfiguration = 
				SqsConnectionStringParser.Parse(ConfigurationManager.AppSettings["TestConnectionString"]);

            S3Client = AwsClientFactory.CreateS3Client(ConnectionConfiguration);
            SqsClient = AwsClientFactory.CreateSqsClient(ConnectionConfiguration);

			Creator = new SqsQueueCreator
			{
				ConnectionConfiguration = ConnectionConfiguration,
				SqsClient = SqsClient,
                S3Client = S3Client
			};
	        
            _receivedMessages = new Subject<TransportMessage>();
            _exceptionsThrownByReceiver = new Subject<Exception>();

			QueueUrlCache = new SqsQueueUrlCache
			{
                SqsClient = SqsClient,
				ConnectionConfiguration = ConnectionConfiguration
			};


            Sender = new SqsQueueSender
            {
	            ConnectionConfiguration = ConnectionConfiguration,
	            SqsClient = SqsClient,
                S3Client = S3Client,
	            QueueUrlCache = QueueUrlCache,
				QueueCreator = Creator
            };

	        DequeueStrategy = new SqsDequeueStrategy(null)
	        {
		        ConnectionConfiguration = ConnectionConfiguration,
                SqsClient = SqsClient,
                S3Client = S3Client
            };
	        
        }
        public SqsTestContext(object fixture)
        {
            Address = new Address(fixture.GetType().Name, Environment.MachineName);
            ConnectionConfiguration =
                SqsConnectionStringParser.Parse(ConfigurationManager.AppSettings["TestConnectionString"]);

            S3Client  = AwsClientFactory.CreateS3Client(ConnectionConfiguration);
            SqsClient = AwsClientFactory.CreateSqsClient(ConnectionConfiguration);

            Creator = new SqsQueueCreator
            {
                ConnectionConfiguration = ConnectionConfiguration,
                SqsClient = SqsClient,
                S3Client  = S3Client
            };

            _receivedMessages           = new Subject <TransportMessage>();
            _exceptionsThrownByReceiver = new Subject <Exception>();

            QueueUrlCache = new SqsQueueUrlCache
            {
                SqsClient = SqsClient,
                ConnectionConfiguration = ConnectionConfiguration
            };


            Sender = new SqsQueueSender
            {
                ConnectionConfiguration = ConnectionConfiguration,
                SqsClient     = SqsClient,
                S3Client      = S3Client,
                QueueUrlCache = QueueUrlCache,
                QueueCreator  = Creator
            };

            DequeueStrategy = new SqsDequeueStrategy(null)
            {
                ConnectionConfiguration = ConnectionConfiguration,
                SqsClient = SqsClient,
                S3Client  = S3Client
            };
        }
示例#3
0
		public void throws_when_message_is_large_and_no_s3_bucket_configured()
		{
			var sut = new SqsQueueSender
			{
				ConnectionConfiguration = new SqsConnectionConfiguration
				{
					Region = Amazon.RegionEndpoint.APSoutheast2,
					S3BucketForLargeMessages = String.Empty
				}
			};

			var largeTransportMessageToSend = new TransportMessage();
			var stringBuilder = new StringBuilder();
			while (stringBuilder.Length < 256 * 1024)
			{
				stringBuilder.Append("This is a large string. ");
			}
			largeTransportMessageToSend.Body = Encoding.Default.GetBytes(stringBuilder.ToString());

			Assert.Throws<InvalidOperationException>(() => sut.Send(largeTransportMessageToSend,
				new SendOptions(Address.Self)));
		}