示例#1
0
        public async Task TestIndexingAnExistingFitsFileInDb()
        {
            var fitsCreator = new FitsFileInfoService();
            var file        = TestUtils.GenerateRandomFileName();

            _perTestDeletables.Add(file);
            using (var newFitsDb = new FitsDatabase(fitsCreator, null, file, true))
            {
                var fitsFilePath = Path.Combine(TestUtils.GetTestPath(), "Resources", "FitsFiles", "Light_001.fits");
                await newFitsDb.AddFiles(new[] { fitsFilePath, fitsFilePath });

                Assert.AreEqual(1, newFitsDb.FileCount);
            }
        }
示例#2
0
        public async Task TestIndexingAChangedFitsFileInDb()
        {
            var fitsCreator = new Mock <IFitsFileInfoService>();

            fitsCreator.Setup(x => x.GetFitsFileInfo(It.IsAny <string>())).Returns(
                (string filePath) => new MockFitsFileInfo(filePath));

            var file = TestUtils.GenerateRandomFileName();

            using (var newFitsDb = new FitsDatabase(fitsCreator.Object, null, file, true))
            {
                var fitsFilePath = "test.fits";
                // MockFitsFileInfo generates a new comment value and therefore new checksum for every instance,
                // so when it's added a second time it should be recognized as changed.
                await newFitsDb.AddFiles(new[] { fitsFilePath, fitsFilePath });

                Assert.AreEqual(1, newFitsDb.FileCount);
            }
        }
示例#3
0
        public async Task TestStuff()
        {
            var fitsCreator = new FitsFileInfoService();
            var file        = TestUtils.GenerateRandomFileName();

            _perTestDeletables.Add(file);
            using (var newFitsDb = new FitsDatabase(fitsCreator, null, file, true))
            {
                var fitsFilePath = Path.Combine(TestUtils.GetTestPath(), "Resources", "FitsFiles", "Light_001.fits");
                await newFitsDb.AddFiles(new[] { fitsFilePath });

                // var queryable = newFitsDb.FileListAsQueryable();
                var builder = new FitsQueryBuilder();
                var q       = builder.KeywordSearch("TELESCOP", "NexStar");
                var q2      = builder.RaDecRadius(36.801, 33.3, 60);
                var fcount  = newFitsDb.RunQuery(new [] { q, q2 });
                Assert.AreEqual(1, fcount);
            }
        }