public void TestEdge_GetSetEdgeName() { // Substitute for the interface Edge var edgeSub = Substitute.For <IInterfaceEdge>(); // Define a new name string newName = "Prewitt"; // Give the new name for the substitute edgeSub.GetEdgeName().Returns <string>(newName); // Set Edge with the new name iEdge.SetEdgeName(newName); // Check if the names are the same Assert.AreEqual(iEdge.GetEdgeName(), edgeSub.GetEdgeName()); }
// Manage the combo box for the edge // Apply the Edge when one is selected private void ComboBoxEdge_SelectedIndexChanged(object sender, EventArgs e) { // If the combobox is selected > 0 It means that one edge was selected // So the user cannot choose any filters after he select the edge (disable the combobox filter) if (comboBoxEdge.SelectedIndex > 0) { SetComboboxFilterActive(false); } // If the combobox is selected < 0 It means that no edge was selected // So the user can change the Filter that he has selected before // until he hasn't chose a edge (enable the combobox filter) else { SetComboboxFilterActive(true); } // Once an edge/no edge was choosen by the user it will be applied // On the preview bitmap (the bitmap with the filter already applied to it) try { // Each edge is applied on the bitmap where there is already the filter on it // So we will get the current bitmap with the filter currentBitmapEdge = currentBitmapFilter; // Get the name of the filter selected by the user and add it to the interface filter edge.SetEdgeName(comboBoxEdge.SelectedItem.ToString()); // Apply the edge selected on the bitmap through the manager currentBitmapEdge = edgeManager.ApplyEdge(currentBitmapEdge, edge); // Put the bimtap with the applied edge on the picture box pictureBoxForImageLoaded.Image = currentBitmapEdge; } // If there is any exception it will be catch and set the bitmap to null catch (Exception ex) { Console.WriteLine(e); pictureBoxForImageLoaded.Image = null; } }