static void Main(string[] args) { Console.Write("Enter connectionstring: "); var connectionString = Console.ReadLine(); Console.Write("Enter queue name: "); var queueName = Console.ReadLine(); var client = new ServiceBusClient(); client.Connect(connectionString, queueName); while (true) { Console.WriteLine(); Console.Write("Enter message type: "); var messageType = Console.ReadLine(); Console.Write("Enter value for foo: "); var foo = Console.ReadLine(); Console.Write("Enter value for bar: "); var bar = Console.ReadLine(); client.Send(messageType, new { Foo = foo, Bar = bar }).Wait(); Console.WriteLine(); } }
public void Should_use_passed_in_queue_parameters_if_specified() { // Given var description = new QueueDescription(this.queueName); var listener = new ServiceBusClient( this.serialiser, this.bus); // When listener.Connect(this.connectionString, this.queueName, description); // Then this.bus.VerifyQueueDescription.ShouldBeSameAs(description); }
public void Should_verify_queue_on_connect() { // Given var listener = new ServiceBusClient( this.serialiser, this.bus); // When listener.Connect(this.connectionString, this.queueName); // Then this.bus.VerifyQueueConnectionString.ShouldEqual(this.connectionString); this.bus.VerifyQueueDescription.ShouldNotBeNull(); this.bus.VerifyQueueDescription.Path.ShouldEqual(this.queueName); }
public void Should_set_message_type() { // Given var description = new QueueDescription(this.queueName); var listener = new ServiceBusClient( this.serialiser, this.bus); listener.Connect(this.connectionString, this.queueName, description); var payload = new Object(); A.CallTo(() => this.serialiser.Serialise(payload)) .Returns("FooBarBaz"); // When listener.Send("messageType", payload).Wait(); // Then this.bus.SentMessageType.ShouldEqual("messageType"); }
public void Should_serialise_message() { // Given object passedPayload = null; var description = new QueueDescription(this.queueName); var listener = new ServiceBusClient( this.serialiser, this.bus); listener.Connect(this.connectionString, this.queueName, description); var payload = new Object(); A.CallTo(() => this.serialiser.Serialise(payload)) .Invokes(foc => passedPayload = foc.Arguments[0]) .Returns("FooBarBaz"); // When listener.Send("messageType", payload).Wait(); // Then passedPayload.ShouldBeSameAs(payload); }