public void LoadSingleRoiOrDefault_returns_requested_roi([Values(0, 1, 2)] int iterator) { var roiDictionaryService = new RoiDictionary(DataStub.TestDirectoryPath); var obtainedRoi = roiDictionaryService.LoadSingleRoiOrDefault("image1"); var nonExistentRoi = roiDictionaryService.LoadSingleRoiOrDefault("nonexistentroi"); Assert.AreEqual(actual: obtainedRoi.Name, expected: DataStub.ReadRoiDataset.Name, message: "Read name is incorrect."); Assert.AreEqual(actual: obtainedRoi.Height, expected: DataStub.ReadRoiDataset.Height, message: "Read height is incorrect."); Assert.AreEqual(actual: obtainedRoi.Width, expected: DataStub.ReadRoiDataset.Width, message: "Read width is incorrect."); Assert.AreEqual(actual: obtainedRoi.RoiPixels[iterator].XCoordinate, expected: DataStub.ReadRoiDataset.RoiPixels[iterator].XCoordinate, message: "Coordinates doesn't match."); Assert.AreEqual(actual: obtainedRoi.RoiPixels[iterator].YCoordinate, expected: DataStub.ReadRoiDataset.RoiPixels[iterator].YCoordinate, message: "Coordinates doesn't match."); Assert.IsNull(nonExistentRoi, "nonExistentRoi != null"); }
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"))); }
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); }