private void testMountInfoSerialization(MountInfo mountInfo)
        {
            var xml = mountInfo.Serialize();

            var strResult = xml.ToString();

            var roundtrip = new MountInfo();
            Assert.IsTrue(roundtrip.Validate(xml));
            roundtrip.Deserialize(xml);

            Assert.IsNotNull(mountInfo);
            Assert.IsNotNull(roundtrip);

            Assert.AreEqual<string>(mountInfo.LocalPath, roundtrip.LocalPath);
            Assert.AreEqual<string>(mountInfo.MountPoint, roundtrip.MountPoint);
        }
        public CallResult AddSharedDirectory(string localPath, string virtualPath)
        {
            logger.Info("Adding Shared directory {0} at {1}", localPath, virtualPath);

            //check for previous mount errors
            if (mountErrorOccurred)
            {
                logger.Error("Mount error found");
                return new ErrorResult(RemoteErrorCode.MountError);
            }

            //check if directory exits
            if (!Directory.Exists(localPath))
            {
                return new ErrorResult(RemoteErrorCode.ItemNotFoundError);
            }

            MountInfo info = new MountInfo();
            info.MountPoint = virtualPath;
            info.LocalPath = localPath;

            mounts.Add(info);

            storage.SaveItem("mounts", mounts);

            scanDirectory(localPath);

            return new VoidResult();
        }
 public void TestMountInfoSerialization1()
 {
     var mountInfo = new MountInfo() { LocalPath = "/foo/bar", MountPoint = "/bar/foo" };
     testMountInfoSerialization(mountInfo);
 }