Ejemplo n.º 1
0
        public void GetRemotePath()
        {
            var matcher = new Mock <IPathMatcher>();

            matcher.Setup(m => m.RemoteTargetRootPath).Returns("/");
            var storage      = new MetaDataStorage(this.engine, matcher.Object);
            var remoteFolder = new MappedObject("remoteFolder", "remoteId", MappedObjectType.Folder, null, null);

            storage.SaveMappedObject(remoteFolder);

            string remotePath = storage.GetRemotePath(remoteFolder);

            Assert.That(remotePath, Is.EqualTo("/remoteFolder"));
        }
Ejemplo n.º 2
0
        public void GetRemotePathWithCorrectSlashes([Values(true, false)] bool withValidation)
        {
            var matcher = new Mock <IPathMatcher>();

            matcher.Setup(m => m.RemoteTargetRootPath).Returns("/");
            var storage          = new MetaDataStorage(this.engine, matcher.Object, withValidation);
            var remoteRootFolder = new MappedObject("/", "rootId", MappedObjectType.Folder, null, null);
            var remoteFolder     = new MappedObject("remoteFolder", "remoteId", MappedObjectType.Folder, "rootId", null);

            storage.SaveMappedObject(remoteRootFolder);
            storage.SaveMappedObject(remoteFolder);

            string remotePath = storage.GetRemotePath(remoteFolder);

            Assert.That(remotePath, Is.EqualTo("/remoteFolder"));
        }
Ejemplo n.º 3
0
        public void GetRemotePathThrowsExceptionOnNonExistingIdInObject()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

            storage.GetRemotePath(Mock.Of <IMappedObject>());
        }
Ejemplo n.º 4
0
        public void GetRemotePathThrowsExceptionOnNullArgument()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

            storage.GetRemotePath(null);
        }
Ejemplo n.º 5
0
        public void GetRemotePathThrowsExceptionOnNonExistingIdInObject([Values(true, false)] bool withValidation)
        {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);

            Assert.Throws <ArgumentException>(() => storage.GetRemotePath(Mock.Of <IMappedObject>()));
        }
Ejemplo n.º 6
0
        public void GetRemotePathThrowsExceptionOnNullArgument([Values(true, false)] bool withValidation)
        {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);

            Assert.Throws <ArgumentNullException>(() => storage.GetRemotePath(null));
        }