public void FileOpen() { FileSourceFactory fileSourceFactory = new FileSourceFactory(); ImageSourceService imageSourceManager = new ImageSourceService(fileSourceFactory); FileOperationService fileOperationService = new FileOperationService(imageSourceManager); ApplicationLogic applicationLogic = new ApplicationLogic(); FileOperationController fileOperationController = new FileOperationController(fileOperationService, applicationLogic); string[] files = new string[3] { "ValidFile", "InvalidFile", "ValidFile" }; // IList<IFileSource> imageSourceControllers = null; fileOperationController.OpenFiles(files); // Assert.AreEqual(2, imageSourceControllers.Count); // Assert.AreEqual(files[0], imageSourceControllers[0].Filename); // imageSourceControllers.Clear(); files = null; // Make sure it doesn't crash with these parameters fileOperationController.OpenFiles(files); // Assert.AreEqual(0, imageSourceControllers.Count); files = Array.Empty <string>(); // Make sure it doesn't crash with these parameters fileOperationController.OpenFiles(files); // Assert.AreEqual(0, imageSourceControllers.Count); }
public void CloseAllFiles() { FileSourceFactory fileSourceFactory = new FileSourceFactory(); ImageSourceService imageSourceManager = new ImageSourceService(fileSourceFactory); FileOperationService fileOperationService = new FileOperationService(imageSourceManager); ApplicationLogic applicationLogic = new ApplicationLogic(); FileOperationController fileOperationController = new FileOperationController(fileOperationService, applicationLogic); string[] files = new string[1] { "ValidFile" }; List <IFileSource> imageSourceControllers = new List <IFileSource>(); // bool fileClosed = false; ////fileOperationController.OpenFile += (sender, eventArgs) => { imageSourceControllers.AddRange(eventArgs.ImageSourceControllers); }; ////fileOperationController.CloseAllFiles += (sender, eventArgs) => { fileClosed = true; }; fileOperationController.OpenFiles(files); ////fileOperationController.CloseFiles(); // Assert.IsTrue(fileClosed); }