Beispiel #1
0
        public void Setup()
        {
            _sfp                  = new StandardFolderProvider();
            _folderInfo           = new Mock <IFolderInfo>();
            _fileInfo             = new Mock <IFileInfo>();
            _fileWrapper          = new Mock <IFile>();
            _directoryWrapper     = new Mock <IDirectory>();
            _folderManager        = new Mock <IFolderManager>();
            _fileManager          = new Mock <IFileManager>();
            _pathUtils            = new Mock <IPathUtils>();
            _portalControllerMock = new Mock <IPortalController>();
            _portalControllerMock.Setup(p => p.GetPortalSettings(Constants.CONTENT_ValidPortalId))
            .Returns(GetPortalSettingsDictionaryMock());
            _portalControllerMock.Setup(p => p.GetCurrentPortalSettings()).Returns(GetPortalSettingsMock());
            _cryptographyProviderMock = new Mock <CryptographyProvider>();
            _cryptographyProviderMock.Setup(c => c.EncryptParameter(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Guid.NewGuid().ToString("N"));
            _localeControllerMock = new Mock <ILocaleController>();
            _localeControllerMock.Setup(l => l.GetLocales(Constants.CONTENT_ValidPortalId)).Returns(new Dictionary <string, Locale>
            {
                { "en-us", new Locale() }
            });

            FileWrapper.RegisterInstance(_fileWrapper.Object);
            DirectoryWrapper.RegisterInstance(_directoryWrapper.Object);
            FolderManager.RegisterInstance(_folderManager.Object);
            FileManager.RegisterInstance(_fileManager.Object);
            PathUtils.RegisterInstance(_pathUtils.Object);
            PortalController.SetTestableInstance(_portalControllerMock.Object);
            ComponentFactory.RegisterComponentInstance <CryptographyProvider>("CryptographyProviderMock", _cryptographyProviderMock.Object);
            LocaleController.RegisterInstance(_localeControllerMock.Object);
        }
Beispiel #2
0
        public void Setup()
        {
            _sfp              = new StandardFolderProvider();
            _folderInfo       = new Mock <IFolderInfo>();
            _fileInfo         = new Mock <IFileInfo>();
            _fileWrapper      = new Mock <IFile>();
            _directoryWrapper = new Mock <IDirectory>();
            _folderManager    = new Mock <IFolderManager>();
            _fileManager      = new Mock <IFileManager>();
            _pathUtils        = new Mock <IPathUtils>();

            FileWrapper.RegisterInstance(_fileWrapper.Object);
            DirectoryWrapper.RegisterInstance(_directoryWrapper.Object);
            FolderManager.RegisterInstance(_folderManager.Object);
            FileManager.RegisterInstance(_fileManager.Object);
            PathUtils.RegisterInstance(_pathUtils.Object);
        }