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

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

            storage.GetLocalPath(null);
        }
Esempio n. 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>()));
        }
Esempio n. 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));
        }