public void when_send_message() { var serializer = new TestMessageSerializer(new[] { typeof(SerializerTest1), typeof(SerializerTest2), }); var streamer = new EnvelopeStreamer(serializer); var queueWriter = new FileQueueWriter(new DirectoryInfo(_path), "test"); var sender = new MessageSender(streamer, queueWriter); sender.Send(new SerializerTest1("Name1"), "EnvId", new[] { new MessageAttribute("key1", "val1"), new MessageAttribute("key2", "val2"), }); sender.Send(new SerializerTest1("Name1"), "EnvId"); Assert.AreEqual(2, Directory.GetFiles(_path).Length); }
public void when_put_message() { var bytes = Encoding.UTF8.GetBytes("test messages"); var queueWriter = new FileQueueWriter(new DirectoryInfo(_path), "test"); queueWriter.PutMessage(bytes); var files = new DirectoryInfo(_path).GetFiles(); Assert.AreEqual(1, files.Length); Assert.AreEqual("test messages", File.ReadAllText(files[0].FullName)); }