示例#1
0
 public Form1Presenter(IView view, IImageResizer imageResizer, IImagePropertyFacade imagePropertyFacade, IFileIO fileIo)
 {
     _view = view;
     _imageResizer = imageResizer;
     _imagePropertyFacade = imagePropertyFacade;
     _fileIo = fileIo;
 }
        public void SetUp()
        {
            _mockView = MockRepository.GenerateMock<Form1Presenter.IView>();
            _mockImageResizer = MockRepository.GenerateMock<IImageResizer>();
            _mockImagePropertyFacade = MockRepository.GenerateMock<IImagePropertyFacade>();
            _mockFileIo = MockRepository.GenerateMock<IFileIO>();

            _presenter = new Form1Presenter(_mockView, _mockImageResizer, _mockImagePropertyFacade, _mockFileIo);

            _image1 = new Bitmap(800, 600);
            _mockFileIo.Stub(x => x.ImageFromFile(FullSizeImage1FullPath)).Return(_image1);
            _mockImagePropertyFacade.Stub(x => x.GetDateTaken(_image1)).Return(_image1DateTaken);

            _image2 = new Bitmap(1024, 768);
            _mockFileIo.Stub(x => x.ImageFromFile(FullSizeImage2FullPath)).Return(_image2);
            _mockImagePropertyFacade.Stub(x => x.GetDateTaken(_image2)).Return(_image2DateTaken);

            _mockFileIo.Stub(x => x.GetFiles(FullSizeFolderPath, "*.JPG")).Return(new[] { FullSizeImage1FullPath, FullSizeImage2FullPath });
        }