public void correctInputTestWithoutException() { var testIOFiles = Substitute.For <IIOfiles>(); var testIImageDetection = Substitute.For <IImageDetection>(); ImageManagement im = new ImageManagement(testIOFiles, testIImageDetection); testIOFiles.loadFile("nopath").Returns <Bitmap>(bitmap); Bitmap realimage = im.GetImageFromPath("nopath"); // Compares if it is bitmaps Assert.AreEqual(realimage, bitmap); }
public void correctInputTestWithException() { var testIOFiles = Substitute.For <IIOfiles>(); var testIImageDetection = Substitute.For <IImageDetection>(); ImageManagement im = new ImageManagement(testIOFiles, testIImageDetection); testIOFiles.loadFile("nopath").Returns(k => { throw new ArgumentException(); }); Bitmap falseimage = im.GetImageFromPath("nopath"); // If there is a exception the catch will return null Assert.AreEqual(falseimage, null); }