Exemple #1
0
        public void Info_GenericFile_Details()
        {
            const string testFolder = "testInfo";

            if (Directory.Exists(testFolder))
            {
                Directory.Delete(testFolder, true);
            }
            Directory.CreateDirectory(testFolder);

            File.WriteAllText(Path.Join(testFolder, "file.txt"), "test");
            File.WriteAllText(Path.Join(testFolder, "file2.txt"), "test");

            var e = DroneDB.Info(Path.Join(testFolder, "file.txt"), withHash: true)[0];

            Assert.IsNotEmpty(e.Hash);

            // TODO: troubleshoot this and use
            var es = DroneDB.Info(testFolder, true);

            Assert.AreEqual(2, es.Count);
            Assert.AreEqual(EntryType.Generic, es[0].Type);
            Assert.IsTrue(es[0].Size > 0);
            Assert.AreEqual(DateTime.Now.Year, es[0].ModifiedTime.Year);
        }
Exemple #2
0
        public void Info_ImageFile_Details()
        {
            //var expectedMeta = JsonConvert.DeserializeObject<Dictionary<string, string>>(
            //    @"{""cameraPitch"":""-89.9000015258789"",""cameraRoll"":""0.0"",""cameraYaw"":""43.79999923706055"",""captureTime"":""1466699554000.0"",""focalLength"":""3.4222222222222225"",""focalLength35"":""20.0"",""height"":""2250"",""make"":""DJI"",""model"":""FC300S"",""orientation"":""1"",""sensor"":""dji fc300s"",""sensorHeight"":""3.4650000000000003"",""sensorWidth"":""6.16"",""width"":""4000""}");

            using var tempFile = new TempFile(TestFileUrl, BaseTestFolder);

            var res = DroneDB.Info(tempFile.FilePath, withHash: true);

            res.Should().NotBeNull();
            res.Should().HaveCount(1);

            var info = res.First();

            // Just check some fields
            //info.Meta.Should().BeEquivalentTo(expectedMeta);

            info.Properties.Should().NotBeEmpty();
            info.Properties.Should().HaveCount(14);
            info.Properties["make"].Should().Be("DJI");
            info.Properties["model"].Should().Be("FC300S");
            info.Properties["sensor"].Should().Be("dji fc300s");
            info.Hash.Should().Be("246fed68dec31b17dc6d885cee10a2c08f2f1c68901a8efa132c60bdb770e5ff");
            info.Type.Should().Be(EntryType.GeoImage);
            info.Size.Should().Be(3876862);
            // We can ignore this
            // info.Depth.Should().Be(0);
            info.PointGeometry.Should().NotBeNull();
            info.PolygonGeometry.Should().NotBeNull();
        }
Exemple #3
0
        public void Info_InvalidFile_Exception()
        {
            Action act = () => DroneDB.Info("invalid");

            act.Should().Throw <DDBException>();

            act = () => DroneDB.Info((string)null);
            act.Should().Throw <DDBException>();
        }