Exemplo n.º 1
0
        public void WriteSomeFiles()
        {
            var directory = new DirectoryInfo(tempDirectory);

            foreach (var file in directory.EnumerateFiles())
            {
                file.Delete();
            }

            var properties = new MessageProperties();
            var info       = Helper.CreateMessageRecievedInfo();
            var writer     = new FileMessageWriter();
            var messages   = new List <HosepipeMessage>
            {
                new HosepipeMessage("This is message one", properties, info),
                new HosepipeMessage("This is message two", properties, info),
                new HosepipeMessage("This is message three", properties, info)
            };

            var parameters = new QueueParameters
            {
                QueueName       = "Queue EasyNetQ_Tests_TestAsyncRequestMessage:EasyNetQ_Tests_Messages",
                MessageFilePath = tempDirectory
            };

            writer.Write(messages, parameters);

            foreach (var file in directory.EnumerateFiles())
            {
                Console.Out.WriteLine("{0}", file.Name);
            }
        }
Exemplo n.º 2
0
        public void WriteSomeFiles()
        {
            var directory = new DirectoryInfo(tempDirectory);
            foreach (var file in directory.EnumerateFiles())
            {
                file.Delete();
            }

            var properties = new MessageProperties();
            var info = Helper.CreateMessageRecievedInfo();
            var writer = new FileMessageWriter();
            var messages = new List<HosepipeMessage>
            {
                new HosepipeMessage("This is message one", properties, info),
                new HosepipeMessage("This is message two", properties, info),
                new HosepipeMessage("This is message three", properties, info)
            };

            var parameters = new QueueParameters
            {
                QueueName = "Queue EasyNetQ_Tests_TestAsyncRequestMessage:EasyNetQ_Tests_Messages",
                MessageFilePath = tempDirectory
            };

            writer.Write(messages, parameters);

            foreach (var file in directory.EnumerateFiles())
            {
                Console.Out.WriteLine("{0}", file.Name);
            }
        }
Exemplo n.º 3
0
        public void Should_remove_invalid_file_chars()
        {
            const string originalQueueName          = @"\A/B:C*D?E""F<G>H|I";
            const string expectedSanitisedQueueName = @"_A_B_C_D_E_F_G_H_I";

            var sanitisedQueueName = FileMessageWriter.SanitiseQueueName(originalQueueName);

            sanitisedQueueName.ShouldEqual(expectedSanitisedQueueName);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            //Poor man's DI - create the writer and pass it to the salutation. No container is used.
            //IMessageWriter writer = new ConsoleMessageWriter(); //create concrete writer(Console)
            IMessageWriter writer = new FileMessageWriter();    //create concrete writer(File)
            //IMessageWriter writer = new DataBaseWriter();         //create concrete writer(DataBase)
            var salutation = new Salutation(writer);            //Inject it as dependency

            salutation.Exclaim();                               //Call the action
        }
Exemplo n.º 5
0
        public void WriteSomeFiles()
        {
            var writer = new FileMessageWriter();
            var messages = new List<string>
            {
                "This is message one",
                "This is message two",
                "This is message three"
            };

            var parameters = new QueueParameters
            {
                QueueName = "TheNameOfTheQueue",
                MessageFilePath = @"C:\temp\MessageOutput"
            };

            writer.Write(messages, parameters);
        }
Exemplo n.º 6
0
        public void WriteSomeFiles()
        {
            var writer   = new FileMessageWriter();
            var messages = new List <string>
            {
                "This is message one",
                "This is message two",
                "This is message three"
            };

            var parameters = new QueueParameters
            {
                QueueName       = "Queue EasyNetQ_Tests_TestAsyncRequestMessage:EasyNetQ_Tests_Messages",
                MessageFilePath = @"C:\temp\MessageOutput"
            };

            writer.Write(messages, parameters);
        }
Exemplo n.º 7
0
        public void WriteSomeFiles()
        {
            var writer = new FileMessageWriter();
            var messages = new List<string>
            {
                "This is message one",
                "This is message two",
                "This is message three"
            };

            var parameters = new QueueParameters
            {
                QueueName = "Queue EasyNetQ_Tests_TestAsyncRequestMessage:EasyNetQ_Tests_Messages",
                MessageFilePath = @"C:\temp\MessageOutput"
            };

            writer.Write(messages, parameters);
        }