コード例 #1
0
        public void Remove_removes_from_dictionary_properly()
        {
            var roiDictionaryService = new RoiDictionary(DataStub.TestDirectoryPath);

            roiDictionaryService.LoadAllRois();

            Assert.IsTrue(File.Exists(Path.Combine(DataStub.TestDirectoryPath, "addtestfile" + ".png")));

            roiDictionaryService.Remove("addtestfile");

            var obtainedRoi = roiDictionaryService.LoadSingleRoiOrDefault("addtestfile");

            Assert.IsNull(obtainedRoi);

            Assert.IsFalse(File.Exists(Path.Combine(DataStub.TestDirectoryPath, "addtestfile" + ".png")));

            roiDictionaryService.Add(DataStub.AddRoiDataset);
        }
コード例 #2
0
        public void Add_adds_roi_properly()
        {
            var roiDictionaryService = new RoiDictionary(DataStub.TestDirectoryPath);

            roiDictionaryService.Remove("addtestfile");
            var nonExistentRoi = roiDictionaryService.LoadSingleRoiOrDefault("addtestfile");

            Assert.IsNull(nonExistentRoi, "nonExistentRoi != null");

            var pathForNonExistingFile = Path.Combine(DataStub.TestDirectoryPath, "addtestfile" + ".png");

            Assert.IsFalse(File.Exists(pathForNonExistingFile));

            roiDictionaryService.Add(DataStub.AddRoiDataset);

            var obtainedRoi = roiDictionaryService.LoadSingleRoiOrDefault("addtestfile");

            Assert.AreEqual(actual: obtainedRoi.Name, expected: "addtestfile");
            Assert.IsTrue(File.Exists(Path.Combine(DataStub.TestDirectoryPath, "addtestfile" + ".png")));
        }