Exemple #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"));
        }
Exemple #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"));
        }
Exemple #3
0
        public void GetRemotePathThrowsExceptionOnNonExistingIdInObject()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

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

            storage.GetRemotePath(null);
        }
Exemple #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>()));
        }
Exemple #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));
        }