示例#1
0
        public void ResetFolders()
        {
            const string pathToDefaultSettingFile = "myDefaultPath";
            const string pathToCustomSettingFile  = "myCustomPath";
            var          defaultDirectories       = "[\"dir1\",\"dir2\",\"dir3\"]";

            #region Stubs and Mocks
            var globalSettingsStub = MockRepository.GenerateMock <GlobalSettings>();
            globalSettingsStub.DefaultInstallFolderConfigFile = pathToDefaultSettingFile;
            globalSettingsStub.CustomInstallFolderConfigFile  = pathToCustomSettingFile;

            var dalMock = MockRepository.GenerateMock <IFileSystemDal>();
            dalMock.Expect(x => x.ReadAllText(Arg <string> .Is.Equal(pathToDefaultSettingFile))).Return(defaultDirectories);
            dalMock.Expect(x => x.FileExists(Arg <string> .Is.Equal(pathToCustomSettingFile))).Return(true);
            dalMock.Expect(x => x.FileWriteAllText(Arg <string> .Is.Equal(pathToCustomSettingFile), Arg <string> .Is.Equal(defaultDirectories)));
            #endregion

            var repo = new InstallationDirectoriesRepository(globalSettingsStub, dalMock);
            repo.ResetInstallationFolders();

            #region Validate
            dalMock.VerifyAllExpectations();
            #endregion
        }
 public void ResetInstallationFolders()
 {
     _repository.ResetInstallationFolders();
 }