示例#1
0
        public void GetLocalPathOfNonExistingEntryReturnsNull([Values(true, false)] bool withValidation)
        {
            var matcher = new Mock <IPathMatcher>();

            matcher.Setup(m => m.LocalTargetRootPath).Returns(Path.GetTempPath());
            var    storage     = new MetaDataStorage(this.engine, matcher.Object, withValidation);
            string id          = "nonExistingId";
            var    rootFolder  = new MappedObject("name", "otherId", MappedObjectType.Folder, null, null);
            var    otherFolder = new MappedObject("name", id, MappedObjectType.Folder, "otherId", null);

            storage.SaveMappedObject(rootFolder);

            Assert.That(storage.GetLocalPath(otherFolder), Is.Null);
        }
示例#2
0
        public void GetLocalPath()
        {
            var matcher = new Mock <IPathMatcher>();

            matcher.Setup(m => m.LocalTargetRootPath).Returns(Path.GetTempPath());
            var    storage    = new MetaDataStorage(this.engine, matcher.Object);
            string id         = "remoteId";
            var    rootFolder = new MappedObject("name", id, MappedObjectType.Folder, null, null);

            storage.SaveMappedObject(rootFolder);

            string path = storage.GetLocalPath(rootFolder);

            Assert.That(path, Is.EqualTo(Path.Combine(Path.GetTempPath(), "name")));
        }
示例#3
0
        public void GetLocalPathThrowsExceptionOnNonExistingIdInObject()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

            storage.GetLocalPath(Mock.Of <IMappedObject>());
        }
示例#4
0
        public void GetLocalPathThrowsExceptionOnNullArgument()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

            storage.GetLocalPath(null);
        }
示例#5
0
        public void GetLocalPathThrowsExceptionOnNonExistingIdInObject([Values(true, false)] bool withValidation)
        {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);

            Assert.Throws <ArgumentException>(() => storage.GetLocalPath(Mock.Of <IMappedObject>()));
        }
示例#6
0
        public void GetLocalPathThrowsExceptionOnNullArgument([Values(true, false)] bool withValidation)
        {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);

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