public void MapConversion()
        {

            MapMessage message = new MapMessage(tibcoSession);
            IDictionary content = new Hashtable();
            content["key1"] = "value1";
            content["key2"] = "value2";

            Expect.Call(session.CreateMapMessage()).Return(message).Repeat.Once();

            mocks.ReplayAll();

            Message msg = converter.ToMessage(content, session);
            Assert.AreEqual(content, converter.FromMessage(msg));

            mocks.VerifyAll();


        }
        public void DictionaryConversionWhereMapHasNonStringTypesForKeys()
        {
            //IMapMessage message = (IMapMessage)mocks.CreateMock(typeof(IMapMessage));
            MapMessage message = new MapMessage(tibcoSession);

            Expect.Call(session.CreateMapMessage()).Return(message);
            mocks.ReplayAll();

            IDictionary content = new Hashtable();
            content.Add(new Cafe(), "value1");
    
            try
            {
                converter.ToMessage(content, session);
                Assert.Fail("Should have thrown MessageConversionException");
            } catch (MessageConversionException)
            {
        
            }

            mocks.VerifyAll();
        }
        /// <summary> Extract a IDictionary from the given MapMessage.</summary>
        /// <param name="message">the message to convert
        /// </param>
        /// <returns> the resulting Map
        /// </returns>
        /// <throws>EMSException if thrown by EMS methods </throws>
        protected virtual IDictionary ExtractMapFromMessage(MapMessage message)
        {
            IDictionary dictionary = new Hashtable();
            IEnumerator e = message.MapNames;
            while (e.MoveNext())
            {
                String key = (String)e.Current;
                dictionary.Add(key, message.GetObject(key));
            }

            return dictionary;
        }