private void RoundTrip(CollectionMemento memento)
        {
            string[] strings1   = memento.ToEncodedStrings();
            var      newMemento = new CollectionMemento(NakedObjectsFramework.LifecycleManager, NakedObjectsFramework.NakedObjectManager, NakedObjectsFramework.MetamodelManager, strings1);

            string[] strings2 = newMemento.ToEncodedStrings();
            Assert.IsTrue(strings1.SequenceEqual(strings2), "memento failed roundtrip");

            var copyMemento = new CollectionMemento(NakedObjectsFramework.LifecycleManager, NakedObjectsFramework.NakedObjectManager, NakedObjectsFramework.MetamodelManager, memento, new object[] {});

            string[] strings3 = copyMemento.ToEncodedStrings();
            Assert.IsTrue(strings1.SequenceEqual(strings3), "memento failed copy");
        }
        public void CollectionMementoToStringWithNull()
        {
            mocks.ViewDataContainer.Object.ViewData["Services"] = NakedObjectsFramework.GetServices();

            INakedObject service = NakedObjectsFramework.ServicesManager.GetService("ClaimRepository");
            IActionSpec  action  = service.Spec.GetObjectActions().Single(a => a.Id == "FindMyClaims");

            INakedObject[] parms = new[] { null, "" }.Select(o => NakedObjectsFramework.NakedObjectManager.CreateAdapter(o, null, null)).ToArray();

            var cm = new CollectionMemento(NakedObjectsFramework.LifecycleManager, NakedObjectsFramework.NakedObjectManager, NakedObjectsFramework.MetamodelManager, service, action, parms);

            string[] strings = cm.ToEncodedStrings();
            var      cm2     = new CollectionMemento(NakedObjectsFramework.LifecycleManager, NakedObjectsFramework.NakedObjectManager, NakedObjectsFramework.MetamodelManager, strings);
            var      claims  = (IEnumerable)cm2.RecoverCollection().Object;

            Assert.AreEqual(5, claims.Cast <object>().Count());
            Assert.AreEqual(cm2, cm2.RecoverCollection().Oid);
        }