public void TestMessageSending()
 {
     var creator = new MessageCreator();
     var otherData = "Some Other Data";
     var id = 1;
     creator.CreateAndSendMessage(id, otherData);
     var message = MessageSender.GetNextMessage ();
     var root = message.Root;
     Assert.That (root.Attribute("Id").Value, Is.EqualTo (id.ToString()));
     Assert.That (root.Element ("AdditionalData").Value, Is.EqualTo(otherData));
 }
        public void TestMessageSending()
        {
            var creator   = new MessageCreator();
            var otherData = "Some Other Data";
            var id        = 1;

            creator.CreateAndSendMessage(id, otherData);
            var message = MessageSender.GetNextMessage();
            var root    = message.Root;

            Assert.That(root.Attribute("Id").Value, Is.EqualTo(id.ToString()));
            Assert.That(root.Element("AdditionalData").Value, Is.EqualTo(otherData));
        }
Esempio n. 3
0
        public void SetUp()
        {
            var sender = new Mock <IMessageSender>(MockBehavior.Strict);
            var repo   = new Mock <IDataRepository>(MockBehavior.Strict);

            sender.Setup(s => s.SendMessage(It.IsAny <XDocument>()))
            .Callback <XDocument>(d => result = d);
            repo.Setup(r => r.GetData(id))
            .Returns(new XDocument(new XElement("Document", new XAttribute("Id", this.id))));

            var creator = new MessageCreator(sender.Object, repo.Object);

            creator.CreateAndSendMessage(id, otherData);
        }