コード例 #1
0
        public IntegrationTests()
        {
            _directoryPathProviderMock = Substitute.For <IDirectoryPathProvider>();
            _newImageDataProviderMock  = Substitute.For <INewImageDataProvider>();
            _confirmationServiceMock   = Substitute.For <IConfirmationService>();

            _errorHandlerMock = Substitute.For <IErrorHandler>();
            _errorHandlerMock.WhenForAnyArgs(x => x.ShowError(default)).Do(x => throw x.ArgAt <Exception>(0));
コード例 #2
0
 public ImageViewerViewModel(
     IGalleryManager unsamplesDirectoryOpener,
     IDirectoryPathProvider directoryPathProvider,
     IErrorHandler errorHandler,
     IConfirmationService confirmationService,
     INewImageDataProvider newImageDataProvider)
 {
     _galleryManager        = unsamplesDirectoryOpener;
     _directoryPathProvider = directoryPathProvider;
     _errorHandler          = errorHandler;
     _confirmationService   = confirmationService;
     _newImageDataProvider  = newImageDataProvider;
 }
コード例 #3
0
        public ImageViewerViewModelTests()
        {
            _galleryManager            = Substitute.For <IGalleryManager>();
            _directoryPathProviderMock = Substitute.For <IDirectoryPathProvider>();
            _errorHandlerMock          = Substitute.For <IErrorHandler>();
            _confirmationServiceMock   = Substitute.For <IConfirmationService>();
            _newImageDataProvider      = Substitute.For <INewImageDataProvider>();

            _viewModel = Substitute.ForPartsOf <ImageViewerViewModel>(
                _galleryManager,
                _directoryPathProviderMock,
                _errorHandlerMock,
                _confirmationServiceMock,
                _newImageDataProvider);
        }
コード例 #4
0
        public GalleryImageSelectorTests()
        {
            _galleryManager            = Substitute.For <IGalleryManager>();
            _directoryPathProviderMock = Substitute.For <IDirectoryPathProvider>();
            _errorHandlerMock          = Substitute.For <IErrorHandler>();
            _confirmationServiceMock   = Substitute.For <IConfirmationService>();
            _newImageDataProvider      = Substitute.For <INewImageDataProvider>();

            _viewModel = new ImageViewerViewModel(
                _galleryManager,
                _directoryPathProviderMock,
                _errorHandlerMock,
                _confirmationServiceMock,
                _newImageDataProvider);

            _testGallery = new ImageGallery("Test name", new List <GalleryImageInfo>
            {
                new GalleryImageInfo("fullname\\name.jpg", true, new CreditsEntry
                {
                    PhotoUrl = "url",
                    UserName = "******",
                    UserUrl  = "userurl",
                }),
                new GalleryImageInfo("fullname\\name1.jpg", true, new CreditsEntry
                {
                    PhotoUrl = "url1",
                    UserName = "******",
                    UserUrl  = "userurl1",
                }),
                new GalleryImageInfo("fullname\\name2.jpg", true, new CreditsEntry
                {
                    PhotoUrl = "url2",
                    UserName = "******",
                    UserUrl  = "userurl2",
                }),
            });

            _galleryManager.OpenGallery(Arg.Any <string>()).Returns(_testGallery);
            _viewModel.OpenGallery();
        }